Browse Source

修复测试bug

chenxiong 3 years ago
parent
commit
18ca2a1579

+ 6 - 1
pages2/bank/detail.vue

@@ -88,7 +88,7 @@
 			</view>
 		</view>
 		<view class="bottomBox">
-			<view class="priceTag">¥ {{ goodsData.standPrice }}</view>
+			<view class="priceTag">¥ {{ toFixed(goodsData.standPrice) }}</view>
 			<view style="display: flex;color: #FFFFFF;align-items: center;">
 				<view class="btn1" @click="addCart">加购物车</view>
 				<view class="btn2" @click="buy">立即购买</view>
@@ -133,6 +133,11 @@ export default {
 	},
 	onShow() {},
 	methods: {
+		toFixed(number) {
+			if(number) {
+				return number.toFixed(2)
+			}
+		},
 		getDetail() {
 			this.$api.commonGoodsDetail(this.id).then(res => {
 				if (res.data.data.mobileDetailHtml) {

+ 32 - 3
pages2/bank/questionBank.vue

@@ -62,7 +62,6 @@
 									<view class="flex_auto">{{ item.content }}</view>
 								</view>
 							</view>
-							<view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">确认答案</view>
 							<view v-if="bank.ques">
 								<view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
 									<text
@@ -77,6 +76,7 @@
 									<view class="flex_auto">{{ item.content }}</view>
 								</view>
 							</view>
+							<view v-if="!bank.ques" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmit(bankIndex)">确认答案</view>
 							<view v-if="bank.ques">
 								<view class="pad_8 answer">
 									<view>
@@ -94,6 +94,7 @@
 								</view>
 							</view>
 						</view>
+						
 					</template>
 
 					<template v-if="bank.type == 3">
@@ -169,7 +170,7 @@
 									v-for="(tab, tabIndex) in bank.jsonStr"
 									@click="tabSelect(tabIndex, bankIndex)"
 								>
-									问题{{ tabIndex }}
+									问题{{ tabIndex+1 }}
 								</view>
 							</view>
 							<view v-for="(ansItem, ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
@@ -224,7 +225,7 @@
 											<rich-text :nodes="option.content"></rich-text>
 										</view>
 									</view>
-									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
+									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(ansItem.optionsList)}" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
 									<view v-if="bank.ques && bank.ques[ansIndex]">
 										<view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
 											<text :class="{ right: right(bankIndex, ansIndex, option), wrong: wrong(bankIndex, ansIndex, option) }" class="activeTI">
@@ -1206,6 +1207,14 @@ export default {
 		checkboxSelectChild(bindex, ansIndex, childIndex) {
 			this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex], 'checked', !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked);
 		},
+		
+		isCheckboxChecked(arr) {
+			return arr.some(item => {
+				if (item.checked) {
+					return true;
+				}
+			});
+		},
 
 		/**
 		 * @param {Object} 多选确认
@@ -1218,6 +1227,14 @@ export default {
 					arr.push(item.optionsId);
 				}
 			});
+			
+			if(!arr.length) {
+				uni.showToast({
+					title:'请选择答案',
+					icon:'none'
+				})
+				return;
+			}
 
 			this.$set(this.questionList[bindex], 'ques', arr);
 			this.isDoOver();
@@ -1261,6 +1278,14 @@ export default {
 					arr.push(item.optionsId);
 				}
 			});
+			
+			if(!arr.length) {
+				uni.showToast({
+					title:'请选择答案',
+					icon:'none'
+				})
+				return;
+			}
 
 			this.$set(this.questionList[bindex].ques, ansIndex, arr);
 			this.isDoOver();
@@ -1941,6 +1966,10 @@ export default {
 	line-height: 80rpx;
 	font-size: 30rpx;
 	border-radius: 40rpx;
+	
+	&.disabled {
+		opacity: 0.6;
+	}
 }
 .titles {
 	overflow: hidden;

+ 7 - 1
pages2/bank/questionBankAllExplain.vue

@@ -142,7 +142,13 @@
 					<template v-if="bank.type == 4">
 						<view class="pad_8 titBox">
 							<view class="tabs">
-								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
+								<view class="tab" 
+									:class="{current:tabIndex == bank.current}" 
+									:key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" 
+									@click="tabSelect(tabIndex,bankIndex)"
+								>
+									问题{{tabIndex+1}}
+								</view>
 							</view>
 							<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
 								<view class="titles">

+ 37 - 3
pages2/bank/questionBankContinue.vue

@@ -60,7 +60,7 @@
 									<view class="flex_auto">{{ item.content }}</view>
 								</view>
 							</view>
-							<view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">
+							<view v-if="!bank.ques" class="submit_checkbox" :class="{disabled:isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmit(bankIndex)">
 								确认答案
 							</view>
 							<view v-if="bank.ques">
@@ -161,7 +161,13 @@
 					<template v-if="bank.type == 4">
 						<view class="pad_8 titBox">
 							<view class="tabs">
-								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
+								<view class="tab" 
+									:class="{current:tabIndex == bank.current}" 
+									:key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" 
+									@click="tabSelect(tabIndex,bankIndex)"
+								>
+									问题{{tabIndex+1}}
+								</view>
 							</view>
 							<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
 								<view class="titles">
@@ -201,7 +207,7 @@
 											<rich-text :nodes="option.content"></rich-text>
 										</view>
 									</view>
-									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex,ansIndex)">
+									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" :class="{disabled:isCheckboxChecked(ansItem.optionsList)}" @click="checkboxSubmitChild(bankIndex,ansIndex)">
 										确认答案
 									</view>
 									<view v-if="bank.ques && bank.ques[ansIndex]">
@@ -872,6 +878,14 @@ export default {
 				});
 		},
 		
+		isCheckboxChecked(arr) {
+			return arr.some(item => {
+				if (item.checked) {
+					return true;
+				}
+			});
+		},
+		
 		/**
 		 * @param {Object} 多选确认
 		 */
@@ -885,6 +899,14 @@ export default {
 				}
 			})
 			
+			if(!arr.length) {
+				uni.showToast({
+					title:'请选择答案',
+					icon:'none'
+				})
+				return;
+			}
+			
 			this.$set(this.questionList[bindex],'ques',arr)
 			this.isDoOver()
 			
@@ -903,6 +925,14 @@ export default {
 				}
 			})
 			
+			if(!arr.length) {
+				uni.showToast({
+					title:'请选择答案',
+					icon:'none'
+				})
+				return;
+			}
+			
 			this.$set(this.questionList[bindex].ques,ansIndex,arr)
 			this.isDoOver()
 		},
@@ -1429,6 +1459,10 @@ export default {
 	line-height: 80rpx;
 	font-size: 30rpx;
 	border-radius: 40rpx;
+	
+	&.disabled {
+		opacity: 0.6;
+	}
 }
 .titles {
 	overflow: hidden;

+ 1 - 1
pages2/bank/questionBankExplain.vue

@@ -109,7 +109,7 @@
 					<template v-if="bank.type == 4">
 						<view class="pad_8 titBox">
 							<view class="tabs">
-								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
+								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex+1}}</view>
 							</view>
 							<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
 								<view class="titles">

+ 1 - 1
pages2/bank/questionBankExplainDetail.vue

@@ -163,7 +163,7 @@
 					<template v-if="bank.type == 4">
 						<view class="pad_8 titBox">
 							<view class="tabs">
-								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
+								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex+1}}</view>
 							</view>
 							<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
 								<view class="titles">

+ 1 - 1
pages2/bank/questionBankTest.vue

@@ -152,7 +152,7 @@
 						<!-- 案例题 -->
 						<template v-if="bank.type == 4">
 							<view class="tabs">
-								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
+								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex+1}}</view>
 							</view>
 							<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
 								<view class="titles">

+ 1 - 1
pages2/bank/questionBankWrongExplain.vue

@@ -142,7 +142,7 @@
 					<template v-if="bank.type == 4">
 						<view class="pad_8 titBox">
 							<view class="tabs">
-								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
+								<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex+1}}</view>
 							</view>
 							<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
 								<view class="titles">

+ 3 - 3
pages2/class/detail.vue

@@ -116,14 +116,14 @@
 			<view v-show="current == 3" >
 				<view class="menuBox" v-for="(item, index) in reMenuList" :key="index">
 					<!--模块 -->
-					<view v-if="item.type == 1"><courseModule :courseId="courseId" :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
+					<view v-if="item.type == 1"><courseModule :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
 					<!--章 -->
 					<view v-if="item.type == 2">
-						<courseChapter :courseId="courseId" :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter>			
+						<courseChapter :courseId="courseId" :gradeId="gradeId" :goodsId="goodsId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter>			
 					</view>
 					<!--节 -->
 					<view v-if="item.type == 3">
-						<courseSection :courseId="courseId" :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection>
+						<courseSection :courseId="courseId" :gradeId="gradeId" :goodsId="goodsId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection>
 					</view>
 				</view>
 			</view>

+ 31 - 3
pages2/class/questionBank.vue

@@ -62,7 +62,7 @@
 									<view class="flex_auto">{{ item.content }}</view>
 								</view>
 							</view>
-							<view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">确认答案</view>
+							<view v-if="!bank.ques" class="submit_checkbox" :class="{disabled:isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmit(bankIndex)">确认答案</view>
 							<view v-if="bank.ques">
 								<view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
 									<text
@@ -169,7 +169,7 @@
 									v-for="(tab, tabIndex) in bank.jsonStr"
 									@click="tabSelect(tabIndex, bankIndex)"
 								>
-									问题{{ tabIndex }}
+									问题{{ tabIndex+1 }}
 								</view>
 							</view>
 							<view v-for="(ansItem, ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
@@ -224,7 +224,7 @@
 											<rich-text :nodes="option.content"></rich-text>
 										</view>
 									</view>
-									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
+									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" :class="{disabled:isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
 									<view v-if="bank.ques && bank.ques[ansIndex]">
 										<view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
 											<text :class="{ right: right(bankIndex, ansIndex, option), wrong: wrong(bankIndex, ansIndex, option) }" class="activeTI">
@@ -1290,6 +1290,14 @@ export default {
 		checkboxSelectChild(bindex, ansIndex, childIndex) {
 			this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex], 'checked', !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked);
 		},
+		
+		isCheckboxChecked(arr) {
+			return arr.some(item => {
+				if (item.checked) {
+					return true;
+				}
+			});
+		},
 
 		/**
 		 * @param {Object} 多选确认
@@ -1302,6 +1310,14 @@ export default {
 					arr.push(item.optionsId);
 				}
 			});
+			
+			if(!arr.length) {
+				uni.showToast({
+					title:'请选择答案',
+					icon:'none'
+				})
+				return;
+			}
 
 			this.$set(this.questionList[bindex], 'ques', arr);
 			this.isDoOver()
@@ -1322,6 +1338,14 @@ export default {
 					arr.push(item.optionsId);
 				}
 			});
+			
+			if(!arr.length) {
+				uni.showToast({
+					title:'请选择答案',
+					icon:'none'
+				})
+				return;
+			}
 
 			this.$set(this.questionList[bindex].ques, ansIndex, arr);
 			this.isDoOver()
@@ -1944,6 +1968,10 @@ export default {
 	line-height: 80rpx;
 	font-size: 30rpx;
 	border-radius: 40rpx;
+	
+	&.disabled {
+		opacity: 0.6;
+	}
 }
 .titles {
 	overflow: hidden;

+ 6 - 1
pages2/course/detail.vue

@@ -70,7 +70,7 @@
 			</view>
 		</view>
 		<view class="bottomBox">
-			<view class="priceTag">¥ {{detail.standPrice}}</view>
+			<view class="priceTag">¥ {{toFixed(detail.standPrice)}}</view>
 			<view style="display: flex;color: #FFFFFF;align-items: center;">
 				<view class="btn1" @click="addCart">加购物车</view>
 				<view class="btn2" @click="buy">立即购买 </view>
@@ -161,6 +161,11 @@ export default {
 		})
 	},
 	methods: {
+		toFixed(number) {
+			if(number) {
+				return number.toFixed(2)
+			}
+		},
 		onStateChange(newstate, oldstate) {
 			if (newstate.detail.newstate == 'playing') {
 				//开始播放