Эх сурвалжийг харах

课程/题库进入学习

xuqiaoying 3 жил өмнө
parent
commit
37dba9b86b

+ 126 - 35
pages/learn/index.vue

@@ -43,7 +43,7 @@
 								</view>
 								<view class="progress_down">
 									<view class="progress_bar" style="width: 50%;">
-										<u-line-progress :showText="false" height="22" active-color="#ff9900" :show-percent="false"
+										<u-line-progress :showText="false" height="32" active-color="#ff9900" :show-percent="false"
 											:percent="((item.stuAllNum+item.recordNum) / (item.secAllNum+item.examNum)) * 100"></u-line-progress>
 									</view>
 									<view class="enter_into" @click.stop="studyIn(item.goodsId,item.gradeId,item,index)">进入学习</view>
@@ -107,9 +107,9 @@
 								</view>
 								<view class="progress_down">
 									<view class="progress_bar" style="width: 50%;">
-										<u-line-progress :show-percent="false" height="22" active-color="#007AFF" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
+										<u-line-progress :show-percent="false" height="32" active-color="#007AFF" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
 									</view>
-									<view class="enter_into">进入学习</view>
+									<view class="enter_into" @click="studyques(item,index)">进入练习</view>
 								</view>
 
 							</view>
@@ -137,6 +137,15 @@ export default {
 				pageSize: 50
 			},
 			activeItem: {},
+			itemIndex: '',
+			confirmTimer:null,
+			confirmCount:10,
+			confirmChecked:false,
+			showUserConfirmInfo:false,
+			selectItem: {},
+			selectClassModal: false,
+			gradeList: [],
+			gradeValue: -1,
 			sysTime: 0,
 			// totalC: 0,
 			courseLists: [],
@@ -145,15 +154,17 @@ export default {
 				pageNum: 1,
 				pageSize: 50
 			},
-			// totalQ: 0,
+			queitemIndex:'',
         }
     },
 	onLoad(option) {
 		this.getcourseList()
 		this.getlistQuestion()
 	},
-	onShow() {
-		console.log('sfsdg', this.$method)
+	async onShow() {
+		await this.commonSystemTime()
+		this.sysTime = +this.$method.timest()
+		console.log('this.sysTime', this.sysTime)
 	},
 	methods: {
 		toChoose() {
@@ -161,6 +172,7 @@ export default {
 				url:'/pages/course/index'
 			})
 		},
+		// 商品/课程列表
 		getcourseList() {
 			this.$api.courseGoodsList(this.paramC).then(res => {
 				if (res.data.code == 200) {
@@ -168,6 +180,7 @@ export default {
 				}
 			})
 		},
+		// 题库列表
 		getlistQuestion() {
 			this.$api.listGoodsUserQuestion(this.paramQ).then(res => {
 				if (res.data.code == 200) {
@@ -175,10 +188,15 @@ export default {
 				}
 			})
 		},
+		commonSystemTime() {
+			return new Promise(resolve => {
+				this.$api.commonSystemTime().then(res => {
+					this.sysTime = res.data.data;
+				})
+			})
+		},
 		async studyIn(v, i, item, index) {
-
-				
-			this.activeItem = item;
+			this.activeItem = item
 			if (item.interfaceAccountId > 0) { //学习账号已开通
 
 				if (item.learnStatus == 1) { //跳转第三方h5
@@ -198,8 +216,6 @@ export default {
 					});
 					return;
 				}
-
-
 				return;
 			}
 			
@@ -245,7 +261,7 @@ export default {
 				return;
 			}
 			
-			var confirmDetail = true;
+			var confirmDetail = true
 			if (item.educationName == '继续教育') { 
 				if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') { 
 					confirmDetail = await this.userConfirmInfoDetail()
@@ -288,6 +304,7 @@ export default {
 			}
 
 			// if (item.educationName == '继续教育') {
+				// /lock/lockStatus
 				this.$api.lockLockStatus({
 					action: 'jxjy',
 					uuid:this.$method.getUuid()
@@ -295,7 +312,7 @@ export default {
 					if (res.data.code == 200) { //有其他端在操作,不能学习
 						uni.showToast({
 							icon: 'none',
-						title: res.data.msg,
+							title: res.data.msg,
 							mask: true,
 							duration: 3000
 						})
@@ -339,30 +356,104 @@ export default {
 						
 					}
 				})
-			// } else {
-			// 	if (item.courseNum == 1) {
 
-			// 		this.$api.courseCourseList({
-			// 			pageNum: 1,
-			// 			pageSize: 1,
-			// 			goodsId: item.goodsId,
-			// 			gradeId: item.gradeId,
-			// 			orderGoodsId: item.orderGoodsId,
-			// 		}).then(res => {
-			// 			if (res.data.code == 200) {
-			// 				uni.navigateTo({
-			// 						url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
-			// 					})
+		},
+		/**
+		 * @param {Object} goodsId 商品id
+		 * 查询商品重修状态
+		 */
+		courseGoodsRebuildStatus(goodsId, gradeId) {
+			return new Promise(resolve => {
+				this.$api.courseGoodsRebuildStatus({
+					goodsId: goodsId,
+					gradeId: gradeId
+				}).then(res => {
+					resolve(res.data.data)
+				})
+			})
+		},
+		userConfirmInfoDetail(){
+			return new Promise(resolve => {
+				this.$api.userConfirmInfoDetail({
+					orderGoodsId:this.activeItem.orderGoodsId,
+				}).then(res => {
+					if(!res.data.data) {
+						clearInterval(this.confirmTimer);
+						this.confirmCount = 10;
+						this.showUserConfirmInfo = true;
+							this.confirmTimer = setInterval(() => {
+							if(this.confirmCount > 0) {
+								this.confirmCount-- 
+							} else {
+								clearInterval(this.confirmTimer);
+							}
 							
-			// 			}
-			// 		});
-			// 		return;
-			// 	}
-			// 	this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
-				
-			// }
-
-
+						},1000)
+					} else {
+						if(res.data.data.pushInfo) {
+							resolve(true)
+						} else {
+							uni.showModal({
+								showCancel:false,
+								title:'提示',
+								content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
+							})
+							resolve(false)
+						}
+						
+					}
+				})
+			})
+		},
+		selectClass(item, index) {
+			console.log(item)
+			this.itemIndex = index;
+			this.selectItem = item;
+			this.selectClassModal = true;
+			this.goodsGradeList(item.goodsId);
+		},
+		goodsGradeList(id) {
+			this.$api.goodsGradeList({
+				goodsId: id
+			}).then(res => {
+				if (res.data.code == 200) {
+					this.gradeList = res.data.rows
+					if (this.gradeList.length == 0) {
+						let item = {
+							className: '系统分班',
+							gradeId: 0
+						}
+						this.gradeList.push(item)
+					} else {
+						let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
+							.studentNum == item.studentUpper))
+						//所有班级都满了
+						if (isGradeFull) {
+							let item = {
+								className: '系统分班',
+								gradeId: 0
+							}
+							this.gradeList.unshift(item)
+						}
+					}
+				}
+			});
+		},
+		// 进入刷题
+		studyques(item,index){
+			console.log(item)
+			this.queitemIndex = index;
+			let sysTime = this.$method.timest()
+			if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
+				uni.showToast({
+					icon: 'none',
+					title: '不在学习服务期,不能进入学习'
+				})
+				return;
+			}
+			uni.navigateTo({
+				url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
+			})
 		},
 	}
 }

+ 1 - 0
pages2/wd/question_bank.vue

@@ -77,6 +77,7 @@
 			// this.getDict()
 		},
 		onUnload() {
+			console.log('liking离开')
 			clearInterval(this.timer)
 			this.$api.lockDelLock({
 				action:'bank'