Selaa lähdekoodia

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 6 kuukautta sitten
vanhempi
commit
fab113ed85
4 muutettua tiedostoa jossa 54 lisäystä ja 38 poistoa
  1. 6 0
      components/chengji/chengji.vue
  2. 2 1
      pages/study/index.vue
  3. 18 5
      pages/unitTest/useUnit.js
  4. 28 32
      pages/wrong/index.vue

+ 6 - 0
components/chengji/chengji.vue

@@ -124,9 +124,15 @@
 	
 	function showAnswerReply(item) {
 		if (item.type == 1) {
+      if (item.reply == null) {
+        return '未答'
+      }
 			// 单选题
 			return getLetterByIndex(item.reply)
 		} else if (item.type == 2){
+      if (item.reply == null) {
+        return '未答'
+      }
 			if (item.reply == 1) {
 				return '正确'
 			} else {

+ 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({

+ 28 - 32
pages/wrong/index.vue

@@ -11,8 +11,7 @@
 				<view v-if="data.current === 0">
 					<scroll-view scroll-y="true" refresher-enabled="true"
 						:refresher-triggered="data.shuxue.loading" :refresher-threshold="50"
-						refresher-background="transparent" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
-						@refresherabort="onAbort" class="cuoti-scroll-view">
+						refresher-background="lightgreen" @refresherrefresh="onRefresh" class="cuoti-scroll-view">
 						<!--数学-->
 						<uni-list>
 							<uni-list-item v-for="item in data.shuxue.list" class="list-item-box">
@@ -20,7 +19,7 @@
 									<!-- 时间 -->
 									<view class="item-date-row">
 										<icon class="data-icon"></icon>
-										<text>{{ item.date }}</text>
+										<text>{{ item.cdate }}</text>
 									</view>
 									<!-- 数量 -->
 									<view class="item-cuoti-row">
@@ -31,27 +30,35 @@
 								</template>
 							</uni-list-item>
 							<uni-load-more :status="data.shuxue.state" @click="getMore(0)"
-								:contentText="data.shuxue.contentText"></uni-load-more>
+								:contentText="data.shuxue.state_text"></uni-load-more>
 						</uni-list>
 					</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="item-date-row">
+                    <icon class="data-icon"></icon>
+                    <text>{{ item.cdate }}</text>
+                  </view>
+                  <!-- 数量 -->
+                  <view class="item-cuoti-row">
+                    <icon class="cuoti-icon"></icon>
+                    <view class="cuoti-content">错题数:<text class="cuoti-text">{{ item.count }}</text>题</view>
+                  </view>
+                  <view @click="getCuotiData(item)" class="cuoti-btn">查看错题</view>
+                </template>
+              </uni-list-item>
+							<uni-load-more :status="data.yingyu.state" @click="getMore(1)"
+								:contentText="data.yingyu.state_text"></uni-load-more>
+						</uni-list>
+					</scroll-view>
 				</view>
 			</view>
 		</view>
@@ -258,11 +265,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(() => '');
 			}
 		})
 	}
@@ -291,16 +297,6 @@
 		refreshData(data.current);
 	}
 
-	function onRestore() {
-		data.shuxue.loading = 'restore'; // 需要重置
-		// console.log("onRestore");
-	}
-
-	function onAbort() {
-		// console.log("onAbort");
-	}
-
-
 	onLoad(() => {
 		getMore(data.current);
 	})