chenxiong 3 tahun lalu
induk
melakukan
0ed1241af7
2 mengubah file dengan 83 tambahan dan 8 penghapusan
  1. 24 0
      common/httpList/goods.js
  2. 59 8
      pages2/bank/question_detail.vue

+ 24 - 0
common/httpList/goods.js

@@ -17,6 +17,30 @@ export default {
 			noToken: true
 		})
 	},
+	goodsBank(data) {
+		return myRequest({
+			url: '/goods/bank/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	goodsBank(data) {
+		return myRequest({
+			url: '/goods/bank/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	
+	bankExamExamList(data) {
+		return myRequest({
+			url: '/bank/exam/exam/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	
+	
 	goodsDetail(data) {
 		return myRequest({
 			url: '/goods/'+ data,

+ 59 - 8
pages2/bank/question_detail.vue

@@ -74,7 +74,9 @@
 								<view v-if="item2.showList">
 									<view class="article active" style="margin-left:62rpx;" v-for="(article, index3) in item2.list" :key="index3">
 										<view class="flex_auto">{{ article.examName }}</view>
-										<view class="btn" @click="toDo(article.examId, goodsData.goodsId, item1.majorId, item2.chapterExamId)">做题</view>
+										<view class="btn" @click="toDo(article.examId, goodsData.goodsId, item1.majorId, item2.chapterExamId)" v-if="article.recordStatus == -1">做题</view>
+										<view class="btn" @click="continueDo(article.recordId,article.examId, goodsData.goodsId, item2.chapterExamId, item1.majorId)" v-if="article.recordStatus == 0">继续</view>
+										<view class="btn" @click="doRepeat(article.recordId,article.examId, goodsData.goodsId, item2.chapterExamId, item1.majorId)" v-if="article.recordStatus == 1">重做</view>
 									</view>
 								</view>
 								<u-line v-if="item1.length > 1"></u-line>
@@ -93,7 +95,9 @@
 						<view v-if="item1.showList">
 							<view class="article active" style="margin-left:64rpx;" v-for="(article, index2) in item1.list" :key="index2">
 								<view class="flex_auto">{{ item1.name }}</view>
-								<view class="btn" @click="toDo(article.examId, goodsData.goodsId, 0, item1.majorId)">做题</view>
+								<view class="btn" @click="toDo(article.examId, goodsData.goodsId, 0, item1.majorId)" v-if="article.recordStatus == -1">做题</view>
+								<view class="btn" @click="continueDo(article.recordId,article.examId, goodsData.goodsId, 0, item1.majorId)" v-if="article.recordStatus == 0">继续</view>
+								<view class="btn" @click="doRepeat(article.recordId,article.examId, goodsData.goodsId, item1.majorId,0)" v-if="article.recordStatus == 1">重做</view>
 							</view>
 						</view>
 					</template>
@@ -101,7 +105,9 @@
 					<template v-if="item1.type == 3">
 						<view class="article active">
 							<view class="flex_auto">{{ item1.name }}</view>
-							<view class="btn" @click="toDo(item1.majorId, goodsData.goodsId, 0, 0)">做题</view>
+							<view class="btn" @click="toDo(item1.majorId, goodsData.goodsId, 0, 0)" v-if="item1.recordStatus == -1">做题</view>
+							<view class="btn" @click="continueDo(item1.recordId,item1.majorId, goodsData.goodsId, 0, 0)" v-if="item1.recordStatus == 0">继续</view>
+							<view class="btn" @click="doRepeat(item1.recordId,item1.majorId, goodsData.goodsId, 0, 0)" v-if="item1.recordStatus == 1">重做</view>
 						</view>
 					</template>
 				</view>
@@ -132,12 +138,60 @@ export default {
 		// this.getCollectNum();
 		// this.getWrongNum()
 		this.goodsBankQuestionNum();
+		this.goodsBank();
 	},
 	onShow() {
 		
 		this.goodsBankQuestionNum();
 	},
 	methods: {
+		/**
+		 * 继续做题
+		 */
+		continueDo(recordId,examId,goodsId,chapterId = 0,moduleId = 0) {
+			uni.navigateTo({
+				url:'/pages2/bank/questionBankExplain?continue=1&recordId=' +recordId +'&id=' +examId +'&goodsid=' +goodsId +'&chapterId='+chapterId+'&moduleId='+moduleId
+			})
+		},
+		/**
+		 * 重做
+		 * @param {Object} recordId
+		 * @param {Object} examId
+		 * @param {Object} goodsId
+		 * @param {Object} chapterExamId
+		 */
+		doRepeat(recordId,examId,goodsId,chapterExamId=0,moduleId=0) {
+			uni.showModal({
+			    title: '提示',
+			    content: '是否清空答案重做?',
+				cancelText:'查看上次',
+				cancelColor:'',
+				confirmText:'重做',
+				confirmColor:'',
+			    success: (res) => {
+			        if (res.confirm) {
+						uni.navigateTo({
+							url:'/pages2/bank/questionBank?id=' +examId +'&goodsid=' +goodsId +'&moduleId=0&chapterId=' +chapterExamId
+						})
+			        } else if (res.cancel) {
+						uni.navigateTo({
+							url:'/pages2/bank/questionBankExplain?isHistory=1&recordId='+recordId +'&id=' +examId +'&goodsid=' +goodsId +'&moduleId=0&chapterId=' +chapterExamId
+						})
+			            console.log('查看上次答题');
+			        }
+			    }
+			});
+		},
+		/**
+		 * 获取课程目录
+		 */
+		goodsBank() {
+			this.$api.goodsBank({
+				goodsId: this.id
+			}).then(res => {
+				this.bankList = res.data.data;
+			});
+		},
 		getDetail() {
 			this.$api.commonGoodsDetail(this.id).then(res => {
 				console.log(res);
@@ -254,19 +308,16 @@ export default {
 		},
 		changeItem(index1, id, type, index2) {
 			if (type == 1) {
-				console.log();
 				if (this.bankList[index1].list[index2].list) {
-					console.log(2);
 					this.$set(this.bankList[index1].list[index2], 'showList', !this.bankList[index1].list[index2].showList);
 					return;
 				}
 
 				this.$api
-					.goodsExamList({
+					.bankExamExamList({
 						chapterExamId: id
 					})
 					.then(res => {
-						console.log(3);
 						this.$set(this.bankList[index1].list[index2], 'showList', true);
 						this.$set(this.bankList[index1].list[index2], 'list', res.data.data);
 					});
@@ -277,7 +328,7 @@ export default {
 				}
 
 				this.$api
-					.goodsExamList({
+					.bankExamExamList({
 						chapterExamId: id
 					})
 					.then(res => {