wangxy 5 달 전
부모
커밋
3f9d4574eb
4개의 변경된 파일33개의 추가작업 그리고 18개의 파일을 삭제
  1. 2 2
      components/points/uni-points.vue
  2. 3 5
      pages/unitTest/index.vue
  3. 26 9
      pages/unitTest/useUnit.js
  4. 2 2
      pages/wrong/index.vue

+ 2 - 2
components/points/uni-points.vue

@@ -8,7 +8,7 @@
 			</view>
 			<view class="score-btn-box">
 				<view @click="checkAnswer" class="ckst-btn"></view>
-				<view @click="goStudyContinue" v-if="showContinue" class="jxxx-btn"></view>
+				<view @click="goStudyContinue"  class="jxxx-btn" v-if="isLastZhang"></view>
 			</view>
 		</view>
 	</uni-popup>
@@ -21,7 +21,7 @@
 	} from "vue"
 	
 	const props = defineProps({
-		showContinue: {
+		isLastZhang: {
 			type: Boolean,
 			default: true
 		}

+ 3 - 5
pages/unitTest/index.vue

@@ -12,7 +12,7 @@
 					<view class="body" v-if="item.mta_show">
 						<danxuan :question="item" v-if="item.type == '1'"></danxuan>
 						<panduan :question="item" v-if="item.type == '2'"></panduan>
-						<tiankong :question="item" v-if="item.type == '3'"></tiankong>
+						<tiankong :question="item" v-if="item.type == '3'" :placeholders="item.placeholders"></tiankong>
 					</view>
 				</template>
 			</w-swiper>
@@ -28,9 +28,8 @@
 
 		<!-- 答卷 -->
 		<chengji ref="chengjiRef" :list="list"  @back="handleBack"></chengji>
-
 		<!-- 分数弹窗 -->
-		<uniPointsVue ref="uniPointsRef" @checkAnswer="checkAnswer" @goStudy="goStudyContinue" :showContinue="zhangType== 'last'"></uniPointsVue>
+		<uniPointsVue ref="uniPointsRef" @checkAnswer="checkAnswer" @goStudy="goStudyContinue" :isLastZhang="!!haveFlag"></uniPointsVue>
 	</view>
 
 </template>
@@ -67,8 +66,7 @@
 		nianji,
 		xueke,
 		showTishi,
-		zhangType,
-
+		haveFlag,
 		handleSubmit,
 		initPage,
 		handleCloseTishi

+ 26 - 9
pages/unitTest/useUnit.js

@@ -23,7 +23,6 @@ function useJifen() {
 		rightAnswer: 0, // 答对
 		wrongAnswer: 0, // 答错
 		jifen: 0, // 积分
-		zhangType: '' // 当前章类型  'last' 代表最后一章,最后一章无继续
 	})
 
 	function updateJifen({rightAnswer,wrongAnswer,jifen}) {
@@ -54,24 +53,37 @@ export function useExam() {
 		zhangId: null,
 		nianji: null,
 		xueke: null,
+		haveFlag: false, // 是否有下一章
 	})
 	onLoad((options) => {
-		const { cardId } = cacheManager.get('auth');
-		const {
-			jieId,zhangId,nianji
-		} = options;
-		data.jieId = jieId; // 需要路由参数 节Id
+		const jieNumber = options.jieNumber
+		if (!(cacheManager.get('zhangInfo') && options.jieNumber)) {
+			toast('数据错误,缓存丢失/ number丢失')
+			return false
+		}
+		const cacheZhangInfo = cacheManager.get('zhangInfo');
+		let currentObject = cacheZhangInfo.jieList.find(item => item.number == options.jieNumber);
+		const { cardId,zhangId,nianji } = cacheManager.get('auth');
+		
+		data.jieId = currentObject.jieId; // 需要路由参数 节Id
 		data.zhangId = zhangId;// 需要路由参数 章Id
 		data.nianji = nianji; // 需要年纪Id 来执行返回页面
 		data.xueke = cardId; // 需要年纪Id 来执行返回页面
-	
+		data.haveFlag = cacheZhangInfo.haveFlag
 		
 		// 初始化页面数据
 		initPage();
 	})
 	
 	watch(() => data.list, (val) => {
-		const list = data.list.filter(item => item.reply!==null);
+		const list = data.list.filter(item => {
+			if (item.type == 3) {
+				// 填空题 所有试题答完
+				return !item.reply.some(citem => citem.trim() == '');
+			} else {
+				return item.reply!==null
+			}
+		});
 		data.count = list.length;
 	},{deep: true})
 
@@ -92,6 +104,11 @@ export function useExam() {
 		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(() => '');
+			}
 		})
 	}
 
@@ -109,7 +126,7 @@ export function useExam() {
 	async function handleSubmit(dom) {
 		const result = [];
 		data.list.forEach(item => {
-			result.push({reply: item.reply,stId: item.stId})
+			result.push({reply: item.reply ? JSON.stringify(item.reply):'',stId: item.stId})
 		})
 		
 		const [error, cdata] =await catchError(httpUnit.getExamSubmit({

+ 2 - 2
pages/wrong/index.vue

@@ -276,11 +276,11 @@
 
 	function onRestore() {
 		data.shuxue.loading = 'restore'; // 需要重置
-		console.log("onRestore");
+		// console.log("onRestore");
 	}
 
 	function onAbort() {
-		console.log("onAbort");
+		// console.log("onAbort");
 	}