소스 검색

错题调整

wangxy 4 달 전
부모
커밋
d237791846
3개의 변경된 파일43개의 추가작업 그리고 37개의 파일을 삭제
  1. 2 1
      pages/study/index.vue
  2. 18 5
      pages/unitTest/useUnit.js
  3. 23 31
      pages/wrong/index.vue

+ 2 - 1
pages/study/index.vue

@@ -242,7 +242,8 @@
 
 	function goKaoshi(data) {
 		uni.redirectTo({
-			url: `/pages/unitTest/index?jieNumber=` + data.number
+			// url: `/pages/unitTest/index?jieNumber=` + data.number
+			url: `/pages/unitTest/index?jieId=` + data.jieId
 		})
 	}
 

+ 18 - 5
pages/unitTest/useUnit.js

@@ -124,7 +124,7 @@ export function useExam() {
 			if (item.type == 3) {
 				item.result = JSON.parse(item.result);
 				item.placeholders = item.result.map((item, cindex) => `[bank${cindex}]`)
-				item.reply = item.result.map(() => '');
+				item.reply = item.reply ? JSON.parse(item.reply): item.result.map(() => '');
 			}
 		})
 	}
@@ -143,10 +143,23 @@ export function useExam() {
 	async function handleSubmit(dom) {
 		const result = [];
 		data.list.forEach(item => {
-			result.push({
-				reply: item.reply ? JSON.stringify(item.reply) : '',
-				stId: item.stId
-			})
+			if (item.type == 1) {
+				result.push({
+					reply: item.reply,
+					stId: item.stId
+				})
+			} else if (item.type == 2) {
+				result.push({
+					reply: item.reply ,
+					stId: item.stId
+				})
+			} else if (item.type ==3){
+				result.push({
+					reply: item.reply ? JSON.stringify(item.reply) : '',
+					stId: item.stId
+				})
+			}
+		
 		})
 
 		const [error, cdata] = await catchError(httpUnit.getExamSubmit({

+ 23 - 31
pages/wrong/index.vue

@@ -11,15 +11,14 @@
 				<view v-if="data.current === 0">
 					<scroll-view style="height: 300px;" scroll-y="true" refresher-enabled="true"
 						:refresher-triggered="data.shuxue.loading" :refresher-threshold="50"
-						refresher-background="lightgreen" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
-						@refresherabort="onAbort">
+						refresher-background="lightgreen" @refresherrefresh="onRefresh">
 						<!--数学-->
 						<uni-list>
 							<uni-list-item v-for="item in data.shuxue.list">
 								<template v-slot:body>
 									<view class="slot-box">
 										<!-- 时间 -->
-										<text class="slot-text">日期{{ item.date }}</text>
+										<text class="slot-text">日期{{ item.cdate }}</text>
 										<!-- 数量 -->
 										<text class="slot-text">错题数:{{ item.count }}题</text>
 										<button @click="getCuotiData(item)">查看错题</button>
@@ -32,22 +31,26 @@
 					</scroll-view>
 				</view>
 				<view v-if="data.current === 1">
-					<!--英语-->
-					<uni-list>
-						<uni-list-item v-for="item in data.yingyu.list">
-							<template v-slot:body>
-								<view class="slot-box">
-									{{ item }}
-									<text class="slot-text">title</text>
-									<text class="slot-text">date</text>
-									<text class="slot-text">wrong</text>
-									<button>查看错题</button>
-								</view>
-							</template>
-						</uni-list-item>
-						<uni-load-more :status="data.yingyu.state" @click="getMore(1)"
-							:contentText="data.yingyu.contentText"></uni-load-more>
-					</uni-list>
+					<scroll-view style="height: 300px;" scroll-y="true" refresher-enabled="true"
+						:refresher-triggered="data.yingyu.loading" :refresher-threshold="50"
+						refresher-background="lightgreen" @refresherrefresh="onRefresh">
+						<!--英语-->
+						<uni-list>
+							<uni-list-item v-for="item in data.yingyu.list">
+								<template v-slot:body>
+									<view class="slot-box">
+										<!-- 时间 -->
+										<text class="slot-text">日期{{ item.cdate }}</text>
+										<!-- 数量 -->
+										<text class="slot-text">错题数:{{ item.count }}题</text>
+										<button @click="getCuotiData(item)">查看错题</button>
+									</view>
+								</template>
+							</uni-list-item>
+							<uni-load-more :status="data.yingyu.state" @click="getMore(1)"
+								:contentText="data.yingyu.contentText"></uni-load-more>
+						</uni-list>
+					</scroll-view>
 				</view>
 			</view>
 		</view>
@@ -254,11 +257,10 @@
 	function formatListToUse(list) {
 		list.forEach((item, index) => {
 			item.mta_show = false;
-			item.reply = null;
 			if (item.type == 3) {
 				item.result = JSON.parse(item.result);
 				item.placeholders = item.result.map((item, cindex) => `[bank${cindex}]`)
-				item.reply = item.result.map(() => '');
+				item.reply = item.reply ? JSON.parse(item.reply) : item.result.map(() => '');
 			}
 		})
 	}
@@ -287,16 +289,6 @@
 		refreshData(data.current);
 	}
 
-	function onRestore() {
-		data.shuxue.loading = 'restore'; // 需要重置
-		// console.log("onRestore");
-	}
-
-	function onAbort() {
-		// console.log("onAbort");
-	}
-
-
 	onLoad(() => {
 		getMore(data.current);
 	})