wangguoyu 4 ay önce
ebeveyn
işleme
2317cc727a

+ 12 - 0
api/shipin.js

@@ -12,3 +12,15 @@ export function getVideoAuth(data = {}) {
     timeout: 20000
   })
 }
+
+export function getVideoAuthYk(data = {}) {
+  return request({
+    'url': '/common/video/auth',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 17 - 15
pages/study/index.vue

@@ -80,11 +80,11 @@
 			console.log(selectZhang.value);
 			// 已登录
 			// 选择年级进入调用此接口
-			//options.flag == 'selectGrades'
-			if(!selectZhang.value.eggFlag){
-				nextTick(() => {
-					eggDialogRef.value.eggShow();
-				})
+			//options.flag == 'selectGrades'
+			if (!selectZhang.value.eggFlag) {
+				nextTick(() => {
+					eggDialogRef.value.eggShow();
+				})
 			}
 			getZhangInfo()
 			// 蛋
@@ -248,15 +248,17 @@
 
 	function goLookShipin(data) {
 		if (!cacheManager.get('auth')) {
-
+			infoData.cardId = cardId.value
+			infoData.nianji = nianji.value
+			infoData.zhangId = zhangId.value
 			uni.redirectTo({
-				url: '/pages/study/lookShipin?jieNumber=' + data.number + '&cardId=' + cardId.value + '&nianji=' +
-					nianji.value + '&zhangId=' + zhangId.value + '&videoId=' + infoData.jieList[0].videoId
+				url: '/pages/study/lookShipin?youkePageData=' + JSON.stringify(infoData)
+
 			})
 			return;
 		} else {
 			uni.redirectTo({
-				url: '/pages/study/lookShipin?jieNumber=' + data.number
+				url: '/pages/study/lookShipin?jieId=' + data.jieId
 			})
 		}
 
@@ -264,16 +266,16 @@
 	}
 
 	function listClick(data, index) {
-		if (!cacheManager.get('auth') && data.number != 1) {
+		if (!cacheManager.get('auth') && data.firstFlag != 1) {
 			youkeDialogRef.value.handleShow();
 			return;
 		}
 		const authCode = getUserIdentity();
-		if (!(authCode == 'VIP' || data.number == 1)) {
+		if (!(authCode == 'VIP' || data.firstFlag == 1)) {
 			goPayDialogRef.value.handleShow();
 			return false
 		}
-		if (data.number == infoData.jieList.length && data.jieName == '单元测试') {
+		if (data.type == 2) {
 			// 最后一项
 			goKaoshi(data)
 		} else {
@@ -298,9 +300,9 @@
 	}
 
 	function eggBtn() {
-		console.log('点击:开启提分之旅');
-		cacheManager.updateObject('auth', {
-			eggFlag:true
+		console.log('点击:开启提分之旅');
+		cacheManager.updateObject('auth', {
+			eggFlag: true
 		})
 	}
 </script>

+ 83 - 51
pages/study/lookShipin.vue

@@ -32,9 +32,9 @@
 				</view>
 			</view>
 		</uni-popup>
-
-
+		<tip-middle-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :content="YouKeContent"></tip-middle-dialog>
 	</view>
+
 </template>
 
 <script>
@@ -47,7 +47,9 @@
 	} from '@dcloudio/uni-app';
 	import {
 		getVideoAuth,
+		getVideoAuthYk,
 	} from "@/api/shipin.js"
+	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
 	import {
 		toast,
 		getUserIdentity
@@ -69,19 +71,31 @@
 				nianji: '',
 				zhangId: '',
 				seekTime: '',
-				jieNumber: '',
+				jieId: '',
 				shipinTitle: '',
-				cacheZhangInfo: {}
+				cacheZhangInfo: {},
+				YouKeContent: '您当前是游客身份,登录后才能浏览内容,现在去登录?'
 			}
 		},
+		components:{
+			tipMiddleDialog
+		},
 		onLoad(options) {
 			if (!cacheManager.get('auth')) {
+				console.log(
+			JSON.parse(	options.youkePageData)	
+		
+				);
+			const youkeData = 	JSON.parse(	options.youkePageData)	
+				
 				// 游客
-				this.videoId = options.videoId
-				this.nianji = options.nianji
-				this.zhangId = options.zhangId
-				this.cardId = options.cardId
-				this.getLive(); //获取播放凭证
+				this.videoId = youkeData.jieList[0].videoId
+				this.nianji = youkeData.nianji
+				this.zhangId = youkeData.zhangId
+				this.cardId = youkeData.cardId
+				this.shipinTitle = youkeData.numberStr + ' ' + youkeData.zhangName
+				this.progressMarkers = youkeData.jieList[0].jiedianList
+				this.getLiveYk(); //获取播放凭证
 			} else {
 				this.init(options)
 			}
@@ -95,41 +109,33 @@
 			this.hideFlag = 'hide'
 		},
 		methods: {
+
 			init(options) {
-				this.jieNumber = options.jieNumber
-				if (!(cacheManager.get('zhangInfo') && options.jieNumber)) {
-					toast('数据错误,缓存丢失/ number丢失')
+				this.jieId = options.jieId
+				if (!(cacheManager.get('zhangInfo') && options.jieId)) {
+					toast('数据错误,缓存丢失/ jieId丢失')
 					return false
 				}
 				this.cacheZhangInfo = cacheManager.get('zhangInfo')
 
-				let currentObject = this.cacheZhangInfo.jieList.find(item => item.number == options.jieNumber);
+				let currentObject = this.cacheZhangInfo.jieList.find(item => item.jieId == options.jieId);
 				this.shipinTitle = this.cacheZhangInfo.numberStr + ' ' + this.cacheZhangInfo.zhangName
-				// lastFlag是否是本章最后一节,0否1是  type,1视频,2试题
-				if (currentObject.lastFlag == 1 && currentObject.type == 2) {
-					uni.redirectTo({
-						url: `/pages/unitTest/index?jieNumber=` + currentObject.number
-					})
-				} else if (currentObject.lastFlag == 1 && currentObject.type == 1) {
-					// 当前是本章最后一节,并且是 视频 切换下一章
-					this.goNextZhang()
-				} else {
-					this.pageData = {
-						...currentObject
-					}
-					console.log(this.pageData);
-					this.videoId = this.pageData.videoId
-					this.jieName = this.pageData.jieName
-					this.progressMarkers = this.pageData.jiedianList
-					this.getLive(); //获取播放凭证
+
+				this.pageData = {
+					...currentObject
 				}
+				console.log(this.pageData);
+				this.videoId = this.pageData.videoId
+				this.jieName = this.pageData.jieName
+				this.progressMarkers = this.pageData.jiedianList
+				this.getLive(); //获取播放凭证
 			},
 			goNextZhang() {
 				let that = this
 				let req = {
-					nianji: that.currentObject.nianji,
-					zhangId: that.currentObject.zhangId,
-					cardId: that.currentObject.cardId,
+					nianji: that.pageData.nianji,
+					zhangId: that.pageData.zhangId,
+					cardId: that.pageData.cardId,
 				}
 				userZhangNextInfo(req).then(res => {
 					cacheManager.set('zhangInfo', res.data)
@@ -138,9 +144,16 @@
 						cardId: res.data.cardId,
 						nianji: res.data.nianji,
 					})
-					that.init({
-						jieNumber: 1
-					})
+					if (res.data.jieList.length > 0) {
+						that.jieId = res.data.jieList[0].jieId
+						uni.redirectTo({
+							url: '/pages/study/lookShipin?jieId=' + that.jieId
+						})
+					} else {
+						toast('切换下一章无jieList')
+						return false
+					}
+
 				})
 			},
 			playEnd(data) {
@@ -152,19 +165,33 @@
 			},
 			goNext() {
 				this.$refs.popupRef.close();
-				this.hideFlag = "show"
-				this.videoId = ''
-				this.progressMarkers = []
-				this.pageData = null
-				this.playAuth = ''
-				this.cacheZhangInfo = {}
-				Number(this.jieNumber++)
-				// this.init({
-				// 	jieNumber: this.jieNumber
-				// })
-				uni.redirectTo({
-					//url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
-					url: '/pages/study/lookShipin?jieNumber=' + this.jieNumber
+				if (!cacheManager.get('auth')) {
+					console.log(this);
+					this.$refs.youkeDialogRef.handleShow();
+				} else {
+					Number(this.jieId++)
+					// lastFlag是否是本章最后一节,0否1是  type,1视频,2试题
+					if (this.pageData.lastFlag == 1 && this.pageData.type == 2) {
+						uni.redirectTo({
+							url: `/pages/unitTest/index?jieId=` + this.pageData.jieId
+						})
+					} else if (this.pageData.lastFlag == 1 && this.pageData.type == 1) {
+						// 当前是本章最后一节,并且是 视频 切换下一章
+						this.goNextZhang()
+					} else {
+						uni.redirectTo({
+							//url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
+							url: '/pages/study/lookShipin?jieId=' + this.jieId
+						})
+					}
+				}
+			},
+			getLiveYk() {
+				let req = {
+					videoId: this.videoId
+				}
+				getVideoAuthYk(req).then(res => {
+					this.playAuth = res.data
 				})
 			},
 			getLive() {
@@ -184,7 +211,8 @@
 			goUpPage() {
 				if (!cacheManager.get('auth')) {
 					uni.redirectTo({
-						url: '/pages/study/index?cardId=' + this.cardId+ '&nianji=' + this.nianji+ '&zhangId=' + this.zhangId
+						url: '/pages/study/index?cardId=' + this.cardId + '&nianji=' + this.nianji + '&zhangId=' +
+							this.zhangId
 					})
 				} else {
 					uni.redirectTo({
@@ -193,8 +221,12 @@
 					})
 				}
 
+			},
+			ykConfirm() {
+				uni.redirectTo({
+					url: '/pages/login/index'
+				});
 			}
-
 		},
 		created() {
 			// console.log("getLive")

+ 2 - 2
pages/study/product/shuxue.vue

@@ -23,8 +23,8 @@
 					</view>
 					<view v-if="isVip !== 'VIP'">
 						<!-- 序号或锁 -->
-						<view v-if="item.number ==1" class="brand-icon">{{ item.number }}</view>
-						<view v-if="item.number !=1" class="brand-lock"></view>
+						<view v-if="item.firstFlag ==1" class="brand-icon">{{ item.number }}</view>
+						<view v-if="item.firstFlag !=1" class="brand-lock"></view>
 						<!-- 动物类型 -->
 						<view v-if="item.daeFlag && growthType ==0" class="animal-img dan-img"></view>
 						<view v-if="item.daeFlag && growthType ==1" class="animal-img xiao-e-img"></view>

+ 1 - 1
pages/study/product/yingyu.vue

@@ -26,7 +26,7 @@
 					</view>
 					<view v-if="isVip !== 'VIP'">
 						<!-- 锁 -->
-						<view v-if="item.number !='Lesson 1'" class="brand-lock"></view>
+						<view v-if="item.firstFlag !='1'" class="brand-lock"></view>
 						<!-- 动物类型 -->
 						<view v-if="item.daeFlag && growthType ==0" class="animal-img dan-img"></view>
 						<view v-if="item.daeFlag && growthType ==1" class="animal-img xiao-e-img"></view>