Explorar o código

feat:课程详情显示已购买的课程

xuqiaoying %!s(int64=3) %!d(string=hai) anos
pai
achega
21293aaeb0

+ 2 - 2
common/request.js

@@ -5,10 +5,10 @@ import api from './api.js'
 var num = 1
 //接口api   
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
-export const BASE_URL = 'https://test.xyyxt.net'   //预发布
+// export const BASE_URL = 'https://test.xyyxt.net'   //预发布
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'http://192.168.1.222:5055'    //后端本地更新到222
-// export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
+export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
 // export const BASE_URL = 'http://192.168.1.7:5055'    //后端本地
 
  //图片上传api

+ 54 - 71
pages2/bank/detail.vue

@@ -112,6 +112,22 @@
 				<view class="btn2" @click="buy">立即购买</view>
 			</view>
 		</view>
+
+		<!-- 已购买过课程的弹窗 -->
+		<u-popup v-model="bugCourseModel" mode="center" border-radius="40">
+			<view class="had_bugCourse">
+				<image src="/pages2/static/hadBug.png" class="share"></image>
+				<view class="tips">
+					<view class="warns">温馨提示</view>
+					<view class="words">您<text>已购买过</text>该商品课程</view>
+					<view class="words">可立即前往学习</view>
+				</view>
+				<view class="tip_botton">
+					<view class="cancel_btn" @click="changeKown()">知道了</view>
+					<view class="confirm_btn" @click="toStudy()">去学习</view>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -133,7 +149,9 @@ export default {
 			id: '',
 			goodsData: {},
 			bankList: [],
-			goodsExamConfig: []
+			goodsExamConfig: [],
+			bugCourseModel: false, // 弹窗
+			hadBuyCourse: {}, // 已购买课程信息
 		};
 	},
 	filters: {
@@ -149,6 +167,7 @@ export default {
 		this.id = option.id;
 		this.getDetail();
 		this.goodsBankList();
+		this.getIsBuy() // 判断是否已经购买过该课程
 		wx.showShareMenu({
 			withShareTicket: true,
 			menus: ["shareAppMessage", "shareTimeline"]
@@ -164,7 +183,6 @@ export default {
 		}
 	},
 	onShareAppMessage() {
-		console.log('asdsaufga-------')
 		return {
 			title: this.goodsData.goodsName,
 			path: `/pages2/bank/detail?id=` + this.id,
@@ -338,7 +356,39 @@ export default {
 			uni.switchTab({
 			    url: '/pages/shopping/shoppingCart'
 			})
-		}
+		},
+		getIsBuy() {
+			this.$http({
+				url: '/order/buyGoodsNotExpired',
+				method: 'get',
+				data: { goodsId: this.id }
+			}).then((res) => {
+				if (res.data.code == 200) {
+					if (res.data.data) { // 有data返回是已经购买过的课程
+						this.hadBuyCourse = res.data.data
+						this.bugCourseModel = true
+					}
+				}
+			})
+		},
+		changeKown() {
+			this.bugCourseModel = false
+		},
+		toStudy() {
+			let sysTime = this.$method.timest()
+			const { serviceStartTime, serviceEndTime, goodsId, orderGoodsId} = this.hadBuyCourse
+			if (serviceStartTime && serviceEndTime && (sysTime <= serviceStartTime || sysTime >= serviceEndTime)) {
+				uni.showToast({
+					icon: 'none',
+					title: '不在学习服务期,不能进入学习'
+				})
+				return;
+			}
+			uni.navigateTo({
+				url:'/pages2/bank/question_detail?id='+goodsId+'&orderGoodsId='+orderGoodsId
+			})
+			this.bugCourseModel = false
+		},
 	}
 };
 </script>
@@ -348,16 +398,13 @@ page {
 }
 </style>
 <style lang="scss" scope>
+@import '../../pages3/course/index.scss';
 .contents {
 	width: 100%;
 	height: 100%;
 	background-color: #ffffff;
 	margin-top: 16rpx;
 	overflow: hidden;
-	// border-radius: 24rpx 24rpx 0rpx 0rpx;
-	// position: relative;
-	// top: -27rpx;
-	// left: 0;
 	
 	// tab
 	.tabs {
@@ -390,21 +437,12 @@ page {
 	}
 }
 .cou_title {
-	// height: 210rpx;
 	padding: 24rpx 32rpx 40rpx 32rpx;
 	display: flex;
 	flex-direction: column;
 	justify-content: space-around;
 }
 .prices {
-	// .price_sym {
-	// 	font-size: 20rpx;
-	// 	color: #333333;
-	// 	position: relative;
-	// 	top: -23rpx;
-	// 	left: 0;
-	// 	margin-right: 10rpx;
-	// }
 	.price_word {
 		font-size: 40rpx;
 		font-weight: 800;
@@ -556,61 +594,6 @@ page {
 	margin-right: 11rpx;
 	font-size: 24rpx;
 }
-.bottomBox {
-	position: fixed;
-	bottom: 0;
-	width: 100%;
-	left: 0;
-	height: 98rpx;
-	background-color: #ffffff;
-	display: flex;
-	justify-content: space-between;
-	align-items: center;
-	padding: 0 24rpx;
-	box-shadow: 0px -5px 20px 1px rgba(1,99,235,0.1000);
-	.icons {
-		display: flex;
-		.share_w {
-			font-size: 20rpx;
-			color: #666666;
-			margin-top: 6rpx;
-		}
-		.icon_item {
-			text-align: center;
-		}
-		.ones {
-			margin-left: 32rpx;
-			margin-right: 60rpx;
-			position: relative;
-			top: 0;
-			left: 0;
-			/deep/ button::after{
-				border: none; 
-			}
-			.bt_share {
-				width: 38rpx;
-				height: 38rpx;
-				position: absolute;
-				top: 3rpx;
-				left: 0;
-				z-index: 100;
-				opacity: 0;
-			}
-		}
-	}
-	.share {
-		width: 38rpx;
-		height: 38rpx;
-		position: relative;
-		top: 3rpx;
-		z-index: 99;
-		margin-bottom: 4rpx;
-	}
-	.shopcar {
-		width: 40rpx;
-		height: 40rpx;
-	}
-}
 .blackFont {
 	color: #333333;
 	margin: 0 4rpx;

BIN=BIN
pages2/static/hadBug.png


+ 3 - 0
pages2/wd/course.vue

@@ -76,6 +76,9 @@ export default {
     this.gradeId = Number(option.gid);
     this.orderGoodsId = Number(option.orderGoodsId);
     // uni.setStorageSync('courseGoodsId', this.goodsId);
+    if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
+      return;
+    }
     this.courseCourseList();
     this.$store.getters.dictObj;
   },

+ 151 - 73
pages3/course/detail.vue

@@ -114,6 +114,22 @@
 				<view class="btn2" @click="buy">立即购买 </view>
 			</view>
 		</view>
+
+		<!-- 已购买过课程的弹窗 -->
+		<u-popup v-model="bugCourseModel" mode="center" border-radius="40">
+			<view class="had_bugCourse">
+				<image src="/pages3/static/imgs/hadBug.png" class="share"></image>
+				<view class="tips">
+					<view class="warns">温馨提示</view>
+					<view class="words">您<text>已购买过</text>该商品课程</view>
+					<view class="words">可立即前往学习</view>
+				</view>
+				<view class="tip_botton">
+					<view class="cancel_btn" @click="changeKown()">知道了</view>
+					<view class="confirm_btn" @click="toStudy()">去学习</view>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -148,7 +164,9 @@ export default {
 			isFirstEnter:true, //是否首次进入
 			timer:null,
 			businessData:{},
-			startTime:0
+			startTime:0,
+			bugCourseModel: false, // 弹窗
+			hadBuyCourse: {}, // 已购买课程信息
 		};
 	},
 	computed: { ...mapGetters(['userInfo','goodsAuditionConfigIdList','playSectionId','hideBuyState']) },
@@ -157,6 +175,7 @@ export default {
 		this.getDetail()
 		this.goodsCourseList()
 		this.appCommonGoodsCourseModuleFreeExamList();
+		this.getIsBuy() // 判断是否已经购买过该课程
 		wx.showShareMenu({
 			withShareTicket: true,
 			menus: ["shareAppMessage", "shareTimeline"]
@@ -436,7 +455,135 @@ export default {
 			uni.switchTab({
 			    url: '/pages/shopping/shoppingCart'
 			})
-		}
+		},
+		getIsBuy() {
+			this.$http({
+				url: '/order/buyGoodsNotExpired',
+				method: 'get',
+				data: { goodsId: this.id }
+			}).then((res) => {
+				if (res.data.code == 200) {
+					if (res.data.data) { // 有data返回是已经购买过的课程
+						this.hadBuyCourse = res.data.data
+						this.bugCourseModel = true
+					}
+				}
+			})
+		},
+		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)
+
+			// 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:'暂无可观看的视频课程'
+			// 						})
+			// 					}
+
+			// 				}
+			// 			});					
+			// 	}
+			// })
+		},
+		// 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)
+		// 		})
+		// 	})
+		// },
 	}
 };
 </script>
@@ -446,6 +593,7 @@ export default {
 	}
 </style>
 <style lang="scss" scope>
+@import './index.scss';
 	.video_t2 {
 		font-size: 24rpx;
 		font-family: PingFang SC;
@@ -492,27 +640,14 @@ export default {
 		background-color: #ffffff;
 		margin-top: 16rpx;
 		overflow: hidden;
-		// border-radius: 24rpx 24rpx 0rpx 0rpx;
-		// position: relative;
-		// top: -27rpx;
-		// left: 0;
 	}
 	.cou_title {
-		// height: 210rpx;
 		padding: 24rpx 32rpx 40rpx 32rpx;
 		display: flex;
 		flex-direction: column;
 		justify-content: space-around;
 	}
 	.prices {
-		// .price_sym {
-		// 	font-size: 20rpx;
-		// 	color: #333333;
-		// 	position: relative;
-		// 	top: -23rpx;
-		// 	left: 0;
-		// 	margin-right: 10rpx;
-		// }
 		.price_word {
 			font-size: 40rpx;
 			font-weight: 800;
@@ -568,9 +703,6 @@ export default {
 	.icon_up{
 		width: 32rpx;
 		height: 32rpx;
-	}
-	.contentBox{
-		
 	}
 	.courseItemBox{
 		background: #FFFFFF;
@@ -611,61 +743,7 @@ export default {
 		margin-right: 11rpx;
 		font-size: 24rpx;
 	}
-	.bottomBox{
-		position: fixed;
-		bottom: 0;
-		width: 100%;
-		left: 0;
-		height: 132rpx ;
-		background-color: #FFFFFF;
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		padding: 0 24rpx;
-		box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(0,0,0,0.1000);
-		.icons {
-			display: flex;
-			.share_w {
-				font-size: 24rpx;
-				color: #333;
-				margin-top: 6rpx;
-			}
-			.icon_item {
-				text-align: center;
-			}
-			.ones {
-				margin-left: 32rpx;
-				margin-right: 60rpx;
-				position: relative;
-				top: 0;
-				left: 0;
-				/deep/ button::after{
-					border: none; 
-				}
-				.bt_share {
-					width: 38rpx;
-					height: 38rpx;
-					position: absolute;
-					top: 3rpx;
-					left: 0;
-					z-index: 100;
-					opacity: 0;
-				}
-			}
-		}
-		.share {
-			width: 38rpx;
-			height: 38rpx;
-			position: relative;
-			top: 3rpx;
-			z-index: 99;
-			margin-bottom: 4rpx;
-		}
-		.shopcar {
-			width: 40rpx;
-			height: 40rpx;
-		}
-	}
+	
 	.blackFont{
 		margin: 0 4rpx;
 	}

+ 124 - 0
pages3/course/index.scss

@@ -0,0 +1,124 @@
+// 和pages2/bank/detail 页面公用的样式
+// 底部按钮
+.bottomBox{
+    position: fixed;
+    bottom: 0;
+    width: 100%;
+    left: 0;
+    height: 132rpx ;
+    background-color: #FFFFFF;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 24rpx;
+    box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(0,0,0,0.1000);
+    .icons {
+        display: flex;
+        .share_w {
+            font-size: 24rpx;
+            color: #333;
+            margin-top: 6rpx;
+        }
+        .icon_item {
+            text-align: center;
+        }
+        .ones {
+            margin-left: 32rpx;
+            margin-right: 60rpx;
+            position: relative;
+            top: 0;
+            left: 0;
+            /deep/ button::after{
+                border: none; 
+            }
+            .bt_share {
+                width: 38rpx;
+                height: 38rpx;
+                position: absolute;
+                top: 3rpx;
+                left: 0;
+                z-index: 100;
+                opacity: 0;
+            }
+        }
+    }
+    .share {
+        width: 38rpx;
+        height: 38rpx;
+        position: relative;
+        top: 3rpx;
+        z-index: 99;
+        margin-bottom: 4rpx;
+    }
+    .shopcar {
+        width: 40rpx;
+        height: 40rpx;
+    }
+}
+// 弹窗
+.had_bugCourse {
+	width: 600rpx;
+	height: 424rpx;
+	position: relative;
+	top: 0;
+	left: 0;
+	.share {
+		width: 100%;
+		height: 288rpx;
+		position: absolute;
+		top: 0;
+		left: 0;
+		z-index: 99;
+	}
+	.tips {
+		width: 100%;
+		height: 288rpx;
+		text-align: center;
+		position: absolute;
+		top: 0;
+		left: 0;
+		z-index: 100;
+		.warns {
+			margin: 56rpx 0rpx 24rpx;
+			font-size: 36rpx;
+			font-weight: bold;
+			color: #222222;
+		}
+		.words {
+			font-size: 32rpx;
+			font-weight: 400;
+			color: #222222;
+			margin-top: 6rpx;
+			>text {
+				color: #3577E8;
+			}
+		}
+	}
+	.tip_botton {
+		width: 100%;
+		height: 136rpx;
+		padding: 0rpx 48rpx;
+		display: flex;
+		justify-content: space-between;
+		position: absolute;
+		left: 0;
+		bottom: 0;
+		.confirm_btn, .cancel_btn {
+			width: 236rpx;
+			height: 88rpx;
+			line-height: 88rpx;
+			text-align: center;
+			border-radius: 240rpx;
+			font-size: 32rpx;
+			font-weight: 500;
+		}
+		.confirm_btn {
+			color: #fff;
+			background-color: #3577E8;
+		}
+		.cancel_btn {
+			color: #222222;
+			background-color: #F0F0F0;
+		}
+	}
+}

BIN=BIN
pages3/static/imgs/hadBug.png


+ 3 - 0
pages5/liveDetail/course.vue

@@ -72,6 +72,9 @@ export default {
     this.gradeId = Number(option.goodsId);
     this.orderGoodsId = Number(option.orderGoodsId);
     // uni.setStorageSync('courseGoodsId', this.goodsId);
+    if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
+      return;
+    }
     this.courseCourseList();
     this.$store.getters.dictObj;
   },