chenxiong vor 3 Jahren
Ursprung
Commit
1481b34ed5

+ 8 - 0
common/httpList/goods.js

@@ -203,6 +203,14 @@ export default {
 		})
 	},
 	
+	bankRecordDoNum(data) {
+		return myRequest({
+			url: '/bank/record/doNum',
+			data:data,
+			method: 'GET',
+		})
+	},
+	
 	wrongRecordTypeList(data) {
 		return myRequest({
 			url: '/exam/wwrong/record/type_list',

+ 31 - 3
components/course/courseChapter.vue

@@ -102,12 +102,19 @@ export default {
 			if(this.learningOrder == 1) {
 				if(this.canLearn) {
 					
-					if(item.answerNum - item.doNum > 0 && item.answerNum > 0) {
-						this.$set(this.list[index],'doNum',(item.doNum+1))
+					let num = await this.bankRecordDoNum(item.typeId)
+					//有次数限制
+					if(item.answerNum - num > 0 && item.answerNum > 0) {
+						// this.$set(this.list[index],'doNum',(item.doNum+1))
 						console.log(this.list[index])
 						uni.navigateTo({
 							url:'/pages2/class/questionBank?courseId='+this.courseId+'&gradeId='+this.gradeId+'&isFromVideo=1&id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
 						})
+					//没有答题次数限制
+					} else if(item.answerNum == 0) {
+						uni.navigateTo({
+							url:'/pages2/class/questionBank?courseId='+this.courseId+'&gradeId='+this.gradeId+'&isFromVideo=1&id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
+						}) 
 					} else {
 						uni.showToast({
 							icon:'none',
@@ -123,12 +130,19 @@ export default {
 					})
 				}
 			} else {
+				let num = await this.bankRecordDoNum(item.typeId)
+				//有次数限制
 				if(item.answerNum - item.doNum > 0 && item.answerNum > 0) {
-					this.$set(this.list[index],'doNum',(item.doNum+1))
+					// this.$set(this.list[index],'doNum',(item.doNum+1))
 					console.log(this.list[index])
 					uni.navigateTo({
 						url:'/pages2/class/questionBank?courseId='+this.courseId+'&gradeId='+this.gradeId+'&isFromVideo=1&id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
 					})
+				//没有答题次数限制
+				} else if(item.answerNum == 0) {
+						uni.navigateTo({
+							url:'/pages2/class/questionBank?courseId='+this.courseId+'&gradeId='+this.gradeId+'&isFromVideo=1&id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
+						})
 				} else {
 					uni.showToast({
 						icon:'none',
@@ -140,6 +154,20 @@ export default {
 			}
 			
 		},
+		bankRecordDoNum(examId) {
+			return new Promise(resolve => {
+				this.$api.bankRecordDoNum({
+					goodsId:this.goodsId,
+					gradeId:this.gradeId,
+					chapterId:this.menuItem.id,
+					courseId:this.courseId,
+					moduleId:0,
+					examId:examId,
+				}).then(res => {
+					resolve(res.data.data)
+				})
+			})
+		},
 		openChapter(item){
 			this.down = !this.down
 			if(!this.down&&this.list.length==0){

+ 21 - 0
pages2/class/questionBank.vue

@@ -433,6 +433,12 @@
 			<view class="text">左右滑动切换上下题</view>
 			<view class="btn" @click="hideDialog">我知道了</view>
 		</view>
+		
+		<view class="dialog-arrow" v-if="showArrow">
+			<image class="pointer" src="/static/arrow-left.png" mode=""></image>
+			<view class="text">您当前正在测试, 若想退出请点击左上角返回按钮。</view>
+			<view class="btn" @click="showArrow = false">我知道了</view>
+		</view>
 
 		<view class="dialog_wrap" v-if="testOver">
 			<view class="bg"></view>
@@ -550,6 +556,7 @@ export default {
 			lastCount: 0, //剩余没有回答的题目数
 			chapterId: 0,
 			moduleId: 0,
+			showArrow:false, //退出提示
 			isFromVideo:'',
 			gradeId:'',
 			courseId:0,
@@ -589,6 +596,7 @@ export default {
 			for (var k in globalData.bankData) {
 				this[k] = globalData.bankData[k];
 			}
+			this.showArrow = true;
 			
 			//需要拍没拍过直接弹出摄像头
 			if(this.needPhoto && !this.isTakePhoto) {
@@ -623,6 +631,11 @@ export default {
 			clearInterval(this.timer)
 			return;
 		}
+		
+		if(this.needPhoto && !this.isTakePhoto) {
+			return;
+		} 
+		
 		//考试试卷 阻止ios手势返回,自动跳回答题页
 		if (this.needBack) {
 			let app = getApp();
@@ -812,6 +825,14 @@ export default {
 		 * 点击后退按钮
 		 */
 		clickLeft() {
+			//需要拍照没有拍直接返回
+			if(this.needPhoto && !this.isTakePhoto) {
+				this.isSubmit = true;
+				uni.navigateBack({
+					delta:1
+				})
+				return;
+			}
 			if (this.bankType == 1) {
 				let ansCount = this.questionOverNum(); //已答题数
 				this.lastCount = this.questionList.length - ansCount; //统计未答完的题数

+ 5 - 5
pages2/plan/create.vue

@@ -292,11 +292,11 @@ export default {
 							}
 						});
 					} else {
-						uni.showToast({
-							title: result.data.msg,
-							icon: 'none',
-							duration: 2000
-						});
+						uni.showModal({
+							title:'提示',
+							content:result.data.msg,
+							showCancel:false,
+						})
 					}
 				});
 			}

+ 1 - 1
pages3/polyv/detail.vue

@@ -69,7 +69,7 @@
 						{{courseHandoutsData.handoutsName}}
 						<!-- 这是后台配置的讲义标题过长省略这是后台配置的讲义标题过长省略 -->
 					</view>
-					<view class="btn" @click="openDocument">
+					<view class="btn" v-if="courseHandoutsData.handoutsUrl" @click="openDocument">
 						<u-icon name="download" color="#007AFF" size="40"></u-icon>
 					</view>
 				</view>