Browse Source

feat:课程详情已购课程跳转

xuqiaoying 3 years ago
parent
commit
c6b1dca5c6
1 changed files with 101 additions and 102 deletions
  1. 101 102
      pages3/course/detail.vue

+ 101 - 102
pages3/course/detail.vue

@@ -473,117 +473,116 @@ export default {
 		changeKown() {
 			this.bugCourseModel = false
 		},
-		toStudy() {
-			// console.log('==============')
-			// let item = this.hadBuyCourse
-			// if (item.goodsType == 6) { // 进入直播课
-			// 	this.toLive(item)
-			// 	return
-			// }
-			// // /course/goodsRebuildStatus查询用户商品重修状态
-			// let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
+		async toStudy() {
+			let item = this.hadBuyCourse
+			if (item.goodsType == 6) { // 进入直播课
+				this.toLive(item)
+				return
+			}
+			// /course/goodsRebuildStatus查询用户商品重修状态
+			let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
 
-			// if (rebuildStatus == 0) {
-			// 	this.$navTo.togo('/pages2/learn/details', {
-			// 		gradeId: item.gradeId,
-			// 		goodsId: item.goodsId,
-			// 		orderGoodsId: item.orderGoodsId,
-			// 	});
-			// 	return;
-			// }
+			if (rebuildStatus == 0) {
+				this.$navTo.togo('/pages2/learn/details', {
+					gradeId: item.gradeId,
+					goodsId: item.goodsId,
+					orderGoodsId: item.orderGoodsId,
+				});
+				return;
+			}
 
-			// // /lock/lockStatus
-			// this.$api.lockLockStatus({
-			// 	action: 'jxjy',
-			// 	uuid:this.$method.getUuid()
-			// }).then(res => {
-			// 	if (res.data.code == 200) { //有其他端在操作,不能学习
-			// 		uni.showToast({
-			// 			icon: 'none',
-			// 			title: res.data.msg,
-			// 			mask: true,
-			// 			duration: 3000
-			// 		})
-			// 	} else if (res.data.code == 500) { //可以学习
-			// 			this.$http({
-			// 				url: '/course/courseList',
-			// 				method: 'get',
-			// 				data: {
-			// 					pageNum: 1,
-			// 					pageSize: 1,
-			// 					goodsId: item.goodsId,
-			// 					gradeId: item.gradeId,
-			// 					orderGoodsId: item.orderGoodsId,
-			// 				},
-			// 			})
-			// 			.then(res => {
-			// 				if (res.data.code == 200) {
-			// 					if(res.data.total > 1) {
-			// 						this.$navTo.togo(`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}&orderGoodsId=${item.orderGoodsId}`);
-			// 					} else if(res.data.total == 1) {
-			// 						uni.navigateTo({
-			// 							url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
-			// 						})
-			// 					} else {
-			// 						uni.showToast({
-			// 							icon:'none',
-			// 							title:'暂无可观看的视频课程'
-			// 						})
-			// 					}
+			// /lock/lockStatus
+			this.$api.lockLockStatus({
+				action: 'jxjy',
+				uuid:this.$method.getUuid()
+			}).then(res => {
+				if (res.data.code == 200) { //有其他端在操作,不能学习
+					uni.showToast({
+						icon: 'none',
+						title: res.data.msg,
+						mask: true,
+						duration: 3000
+					})
+				} else if (res.data.code == 500) { //可以学习
+						this.$http({
+							url: '/course/courseList',
+							method: 'get',
+							data: {
+								pageNum: 1,
+								pageSize: 1,
+								goodsId: item.goodsId,
+								gradeId: item.gradeId,
+								orderGoodsId: item.orderGoodsId,
+							},
+						})
+						.then(res => {
+							if (res.data.code == 200) {
+								if(res.data.total > 1) {
+									this.$navTo.togo(`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}&orderGoodsId=${item.orderGoodsId}`);
+								} else if(res.data.total == 1) {
+									uni.navigateTo({
+										url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
+									})
+								} else {
+									uni.showToast({
+										icon:'none',
+										title:'暂无可观看的视频课程'
+									})
+								}
 
-			// 				}
-			// 			});					
-			// 	}
-			// })
+							}
+						})		
+				}
+			})
 		},
-		// toLive(item) {
-		// 	this.$api.courseCourseList({
-		// 		pageNum: 1,
-		// 		pageSize: 1,
-		// 		goodsId: item.goodsId,
-		// 		gradeId: 0,
-		// 		orderGoodsId: item.orderGoodsId,
-		// 	}).then(res => {
-		// 		if (res.data.code == 200) {
-		// 			if(res.data.total > 1) {
-		// 				uni.navigateTo({
-		// 					url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
-		// 				})
-		// 			} else if(res.data.total == 1) {
-		// 				uni.navigateTo({
-		// 					url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
-		// 				})
-		// 			} else {
-		// 				uni.showToast({
-		// 					icon:'none',
-		// 					title:'暂无可观看的直播课程'
-		// 				})
-		// 			}
+		toLive(item) {
+			this.$api.courseCourseList({
+				pageNum: 1,
+				pageSize: 1,
+				goodsId: item.goodsId,
+				gradeId: 0,
+				orderGoodsId: item.orderGoodsId,
+			}).then(res => {
+				if (res.data.code == 200) {
+					if(res.data.total > 1) {
+						uni.navigateTo({
+							url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
+						})
+					} else if(res.data.total == 1) {
+						uni.navigateTo({
+							url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
+						})
+					} else {
+						uni.showToast({
+							icon:'none',
+							title:'暂无可观看的直播课程'
+						})
+					}
 				
-		// 		}
-		// 	})
-		// },
+				}
+			})
+		},
 		/**
 		 * @param {Object} goodsId 商品id
 		 * 查询商品重修状态
 		 */
-		// courseGoodsRebuildStatus(goodsId, gradeId) {
-		// 	return new Promise(resolve => {
-		// 		this.$http({
-		// 			url: '/course/goodsRebuildStatus',
-		// 			method: 'get',
-		// 			data: {
-		// 				goodsId: goodsId,
-		// 				gradeId: gradeId
-		// 			},
-		// 			// noLoading: true,
-		// 			// compleLoading: true, // 请求成功是否还要继续显示加载中
-		// 		})
-		// 		.then(res => {
-		// 			resolve(res.data.data)
-		// 		})
-		// 	})
-		// },
+		courseGoodsRebuildStatus(goodsId, gradeId) {
+			return new Promise(resolve => {
+				this.$http({
+					url: '/course/goodsRebuildStatus',
+					method: 'get',
+					data: {
+						goodsId: goodsId,
+						gradeId: gradeId
+					},
+					// noLoading: true,
+					// compleLoading: true, // 请求成功是否还要继续显示加载中
+				})
+				.then(res => {
+					resolve(res.data.data)
+				})
+			})
+		},
 	}
 };
 </script>