Bladeren bron

错题调整

wangxy 5 maanden geleden
bovenliggende
commit
c6e8507dee
1 gewijzigde bestanden met toevoegingen van 18 en 5 verwijderingen
  1. 18 5
      pages/wrong/index.vue

+ 18 - 5
pages/wrong/index.vue

@@ -5,8 +5,8 @@
 			<text class="nav-bar-title">我的错题</text>
 		</view>
 		<view class="cuoti-border-box">
-			<uni-segmented-control :current="data.current" :values="data.items" 
-			 active-color="#3A7FE9" @clickItem="onChangeTab" class="cuo-tab-box"/>
+			<uni-segmented-control :current="data.current" :values="data.items" active-color="#3A7FE9"
+				@clickItem="onChangeTab" class="cuo-tab-box" />
 			<view class="cuoti-content-box">
 				<view v-if="data.current === 0">
 					<scroll-view style="height: 300px;" scroll-y="true" refresher-enabled="true"
@@ -51,7 +51,7 @@
 				</view>
 			</view>
 		</view>
-		<cuoti ref="wrongRef" :list="data.wrongList" @back="handleBackFromCuoti" ></cuoti>
+		<cuoti ref="wrongRef" :list="data.wrongList" @back="handleBackFromCuoti"></cuoti>
 	</view>
 </template>
 
@@ -114,14 +114,14 @@
 			refreshData(data.current);
 		}
 	}
-	
+
 	function refreshData(code) {
 		const opt = {
 			page: 1,
 			size: 10, // 固定查询10条
 			cardId: data.current + 1 // 前台索引加1为学科cardId
 		}
-		
+
 		if (code == 0) {
 			data.shuxue.list = [];
 			// 数学
@@ -251,11 +251,24 @@
 		})
 	}
 
+	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(() => '');
+			}
+		})
+	}
+
 	function getCuotiData(item) {
 		getWrongInfo({
 			cardId: data.current + 1,
 			cdate: item.cdate
 		}).then(res => {
+			formatListToUse(res.data)
 			data.wrongList = res.data;
 			wrongRef.value.showPopup();
 		})