wangguoyu hace 5 meses
padre
commit
5c16acc013
Se han modificado 3 ficheros con 129 adiciones y 102 borrados
  1. 1 1
      pages/login/login.vue
  2. 4 30
      pages/study/index.vue
  3. 124 71
      pages/study/lookShipin.vue

+ 1 - 1
pages/login/login.vue

@@ -145,7 +145,7 @@
 			},
 			
 			goIndex() {
-				uni.navigateTo({
+				uni.redirectTo({
 					url: `/pages/login/index`
 				})
 			}

+ 4 - 30
pages/study/index.vue

@@ -222,41 +222,15 @@
 		let zhangId = selectZhang.value ? selectZhang.value.zhangId : infoData.zhangId;
 		let nianji = selectZhang.value.nianji;
 		let cardId = selectZhang.value.cardId;
-		uni.navigateTo({
-			url: `/pages/unitTest/index?jieId=${data.jieId}&zhangId=${zhangId}&nianji=${nianji}&cardId=${cardId}`
+		uni.redirectTo({
+			url: `/pages/unitTest/index`
 		})
 	}
 
 	function goLookShipin(data) {
-
-		data.progressMarkers = [{
-			offset: 30,
-			isCustomized: true,
-			coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
-			title: '变式1',
-			time: '00:00:30',
-			describe: 'test string',
-		}, {
-			offset: 120,
-			isCustomized: true,
-			coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
-			title: '变式2',
-			time: '00:02:00',
-			describe: 'test string',
-		}, {
-			offset: 300,
-			isCustomized: true,
-			coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-			title: '变式3',
-			time: '00:05:00',
-			describe: 'test string',
-		}]
-		data.zhangId = infoData.zhangId
-		data.nianji = infoData.nianji
-		data.cardId = infoData.cardId
-		uni.navigateTo({
+		uni.redirectTo({
 			//url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
-			url: '/pages/study/lookShipin?studyData=' + JSON.stringify(data)
+			url: '/pages/study/lookShipin?jieNumber='+data.number
 		})
 	}
 

+ 124 - 71
pages/study/lookShipin.vue

@@ -52,8 +52,13 @@
 		getVideoRefresh
 	} from "@/api/shipin.js"
 	import {
-		toast
-	} from "@/utils/common.js"
+		toast,
+		getUserIdentity
+	} from "@/utils/common";
+	import {
+		userZhangNextInfo,
+	} from "@/api/learnPlan.js"
+	import cacheManager from "@/utils/cacheManager.js";
 	export default {
 		data() {
 			return {
@@ -63,20 +68,15 @@
 				jieName: '',
 				hideFlag: 'show',
 				videoId: "", //阿里云视频id
-				seekTime: ''
+				seekTime: '',
+				jieNumber: '',
+				cacheZhangInfo: {}
 			}
 		},
 		onLoad(options) {
-			let data = JSON.parse(options.studyData)
-			console.log(data);
-			this.pageData = {
-				...data
-			}
-			console.log(this.pageData);
-			this.videoId = data.videoId
-			this.jieName = data.jieName
-			this.progressMarkers = data.progressMarkers
-			this.getLive(); //获取播放凭证
+
+			this.init(options)
+
 		},
 		onHide() {
 			console.log('onHideonHideonHideonHide');
@@ -87,6 +87,51 @@
 			this.hideFlag = 'hide'
 		},
 		methods: {
+			init(options) {
+				this.jieNumber = options.jieNumber
+				if (!(cacheManager.get('zhangInfo') && options.jieNumber)) {
+					toast('数据错误,缓存丢失/ number丢失')
+					return false
+				}
+				this.cacheZhangInfo = cacheManager.get('zhangInfo')
+
+				let currentObject = this.cacheZhangInfo.jieList.find(item => item.number == options.jieNumber);
+				// lastFlag是否是本章最后一节,0否1是  type,1视频,2试题
+				if (currentObject.lastFlag == 1 && currentObject.type == 2) {
+					uni.redirectTo({
+						url: `/pages/unitTest/index`
+					})
+				} 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(); //获取播放凭证
+				}
+			},
+			goNextZhang() {
+				let that = this
+				let req = {
+					nianji: that.currentObject.nianji,
+					zhangId: that.currentObject.zhangId,
+					cardId: that.currentObject.cardId,
+				}
+				userZhangNextInfo(req).then(res => {
+					cacheManager.set('zhangInfo', res.data)
+					cacheManager.updateObject('auth', {
+						zhangId: res.data.zhangId,
+						cardId: res.data.cardId,
+						nianji: res.data.nianji,
+					})
+					that.init({jieNumber: 1})
+				})
+			},
 			playEnd(data) {
 				this.$refs.popupRef.open();
 			},
@@ -96,8 +141,16 @@
 			},
 			goNext() {
 				this.$refs.popupRef.close();
-				toast("暂无此功能");
-				return false
+				this.hideFlag = "show"
+				this.videoId = ''
+				this.progressMarkers = []
+				this.pageData = null
+				this.playAuth = ''
+				this.cacheZhangInfo = {}
+				Number(this.jieNumber++)
+				this.init({
+					jieNumber: this.jieNumber
+				})
 			},
 			getLive() {
 				let req = {
@@ -113,9 +166,9 @@
 			},
 			goUpPage() {
 				// this.$refs.popupRef.open();
-				uni.navigateTo({
+				uni.redirectTo({
 					//	url: `/pages/study/index?xueqi=${data.activeXueqi}&nianji=${data.activeNianji}&flag=selectGrades`
-					url: `/pages/study/index?xueqi=${this.pageData.xueqi}&nianji=${this.pageData.nianji}&zhangId=${this.pageData.zhangId}`
+					url: `/pages/study/index`
 
 				})
 			}
@@ -221,59 +274,59 @@
 			playAli() {
 				let that = this
 				//配置播放器
-			var player = new Aliplayer({
-				id: "wgy-player-test",
-				"vid": this.videoId,
-				"playauth": this.playAuth,
-				// "playConfig": {
-				// 	"EncryptType": 'AliyunVoDEncryption'
-				// },
-				"skinLayout": [{
-						"name": "bigPlayButton",
-						"align": "blabs",
-						"x": 30,
-						"y": 80
-					},
-					{
-						"name": "controlBar",
-						"align": "blabs",
-						"x": 0,
-						"y": 0,
-						"children": [{
-								"name": "progress",
-								"align": "blabs",
-								"x": 0,
-								"y": 44
-							},
-							{
-								"name": "playButton",
-								"align": "tl",
-								"x": 15,
-								"y": 12
-							},
-							{
-								"name": "fullScreenButton",
-								"align": "tr",
-								"x": 10,
-								"y": 12
-							}
-						]
-					}
-				],
-				"qualitySort": "asc",
-				"format": "mp4",
-				"mediaType": "video",
-				"encryptType": 1,
-				"progressMarkers": this.progressMarkers,
-				"width": '100%',
-				"height": '500px',
-				"autoplay": false,
-				"isLive": false,
-				"rePlay": false,
-				"playsinline": true,
-				"preload": false,
-				"controlBarVisibility": "hover",
-				"useH5Prism": true
+				var player = new Aliplayer({
+					id: "wgy-player-test",
+					"vid": this.videoId,
+					"playauth": this.playAuth,
+					// "playConfig": {
+					// 	"EncryptType": 'AliyunVoDEncryption'
+					// },
+					"skinLayout": [{
+							"name": "bigPlayButton",
+							"align": "blabs",
+							"x": 30,
+							"y": 80
+						},
+						{
+							"name": "controlBar",
+							"align": "blabs",
+							"x": 0,
+							"y": 0,
+							"children": [{
+									"name": "progress",
+									"align": "blabs",
+									"x": 0,
+									"y": 44
+								},
+								{
+									"name": "playButton",
+									"align": "tl",
+									"x": 15,
+									"y": 12
+								},
+								{
+									"name": "fullScreenButton",
+									"align": "tr",
+									"x": 10,
+									"y": 12
+								}
+							]
+						}
+					],
+					"qualitySort": "asc",
+					"format": "mp4",
+					"mediaType": "video",
+					"encryptType": 1,
+					"progressMarkers": this.progressMarkers,
+					"width": '100%',
+					"height": '500px',
+					"autoplay": false,
+					"isLive": false,
+					"rePlay": false,
+					"playsinline": true,
+					"preload": false,
+					"controlBarVisibility": "hover",
+					"useH5Prism": true
 
 				}, function(player) {});
 				this.player = player;
@@ -300,7 +353,7 @@
 					s_tag.src = 'https://g.alicdn.com/de/prismplayer/2.9.6/aliplayer-min.js';
 					s_tag.charset = 'utf-8';
 					s_tag.onload = () => {
-					//	this.playAli()
+						//	this.playAli()
 						resolve();
 					}
 					document.body.appendChild(s_tag);