he2802 3 năm trước cách đây
mục cha
commit
047370a32e

+ 7 - 0
common/httpList/course.js

@@ -2,6 +2,13 @@ import {
 	myRequest
 } from '../request.js'
 export default {
+	recordLast(data) {
+		return myRequest({
+			url: '/study/record/last',
+			method: 'get',
+			data: data
+		})
+	},
 	menuExamList(data) {
 		return myRequest({
 			url: '/course/menu/exam/list',

+ 5 - 0
components/course/courseSection.vue

@@ -93,6 +93,11 @@ export default {
 				//切换为同一节
 				return
 			}
+			if(this.playSectionId){
+				//切换视频
+				let oldSectionId = this.playSectionId
+				eventHub.$emit('changeSection', oldSectionId)
+			}
 			//设置播放的节ID
 			this.$store.commit('setPlaySectionId', {playSectionId  :this.newId});
 	//		return

+ 1 - 3
pages2/bank/questionBank.vue

@@ -448,7 +448,6 @@ export default {
 		 * 点击后退按钮
 		 */
 		clickLeft() {
-			
 			if(this.bankType == 1) {
 				this.needBack = false;
 				uni.navigateBack({
@@ -457,11 +456,10 @@ export default {
 			} else if(this.bankType == 2){
 				let ansCount = this.questionOverNum();  //已答题数
 				this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
-				
 				//所有题目答完
 				if(this.lastCount == 0) {
 					this.testOver = true;
-				//未答完
+					//未答完
 				} else {
 					this.isLastCount = true;
 				}

+ 17 - 9
pages2/bank/question_record.vue

@@ -122,21 +122,29 @@
 			 */
 			async doRepeat (id,goodsId,moduleId = 0, chapterId = 0) {
 				await this.getDetail()
-				if(this.goodsData.examConfigList) {
-					let count = await this.examRecordCount(id);
-					//超过答题次数
-					if(count >= this.goodsData.examConfigList) {
-						uni.showToast({
-							title:'该试卷只能答题'+this.goodsData.examConfigList+'次!'
-						})
-						return
-					}
+				let count = await this.examRecordCount(id);
+				let answerNum = await this.getExamDetail(id);
+				//超过答题次数
+				if(answerNum>0&&count >= answerNum) {
+					this.$u.toast('该试卷只能答题'+answerNum+'次!');
+					return
 				}
 				
 				uni.navigateTo({
 					url:'/pages2/bank/questionBankExplain?id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
 				})
 			},
+			/**
+			 * @param {Object} exam_id
+			 * 获取试卷可以做的次数
+			 */
+			getExamDetail(exam_id){
+				return new Promise(resolve => {
+				this.$api.getExamDetail(exam_id).then(res => {
+					resolve(res.data.data.answerNum)
+				})
+				})
+			},
 			/**
 			 * 查询试卷历史做题次数
 			 */

+ 60 - 18
pages2/class/detail.vue

@@ -17,6 +17,7 @@
 					:autoplay="autoplay"
 					:isAllowSeek="isAllowSeek"
 					:playbackRate="playbackRate"
+					:startTime="startTime"
 				></polyv-player>
 			</view>
 			<view>
@@ -229,7 +230,9 @@ export default {
 			ctxValue:'',
 			noteList:[],
 			noteValue:'',
-			noteId:0
+			noteId:0,
+			recordObj:0,
+			needSeek:false  //第一次播放是否需要跳转
 		};
 	},
 	onUnload() {},
@@ -254,7 +257,23 @@ export default {
 		
 	},
 	mounted() {
+		eventHub.$on('changeSection', oldSectionId => {
+			this.ossAvatarUrl = ""
+			this.postStudyRecord(0,oldSectionId)
+		});
 		eventHub.$on('getSection', item => {
+			this.playVideo(item)
+		});
+		eventHub.$on('levelId', item => {
+			let arr = item.split('-')
+			//点击节获取的各层级ID
+			this.moduleId = arr[0]
+			this.chapterId = arr[1]
+			console.log(item,99)
+		});
+	},
+	methods: {
+		async playVideo(item){
 			if(this.timer){
 				clearInterval(this.timer);
 			}
@@ -265,20 +284,31 @@ export default {
 			 }else{
 				 this.vid = item.recordingUrl
 			 }
+			 this.recordObj = await this.getRecordLast();
+			 if(this.recordObj.studyDuration){
+				this.needSeek = true //需要跳转到播放记录
+			 }
+			 console.log(this.startTime,789)
 			this.startStatus = true
-			this.startTime = 0
+			
 			//获取节笔记
 			this.getNoteList()
-		});
-		eventHub.$on('levelId', item => {
-			let arr = item.split('-')
-			//点击节获取的各层级ID
-			this.moduleId = arr[0]
-			this.chapterId = arr[1]
-			console.log(item,99)
-		});
-	},
-	methods: {
+		},
+		getRecordLast(){
+			let self = this
+			return new Promise(resolve=>{
+				let data = {
+						gradeId:self.gradeId,
+						goodsId:self.goodsId,
+						sectionId:self.playSectionId,
+						courseId: self.courseId,
+					}
+					self.$api.recordLast(data).then(res => {
+						resolve(res.data.data)
+					});
+			})
+			
+		},
 		jumpNote(item){
 			this.noteId = item.noteId
 			this.$u.toast('即将跳到笔记位置');
@@ -297,7 +327,7 @@ export default {
 				this.$u.toast('请输入内容');
 				retun
 			}
-			 var polyvPlayerContext = this.selectComponent('#playerVideo');
+			var polyvPlayerContext = this.selectComponent('#playerVideo');
 			let noteDate = this.$method.getZeroTime()
 			let noteSecond= polyvPlayerContext.getCurrentTime()
 			if(!noteSecond){
@@ -312,7 +342,6 @@ export default {
 				noteText:this.noteValue,
 				noteDate:noteDate,
 				noteSecond:noteSecond}
-				console.log(data,66)
 			this.$api.postNote(data).then(res => {
 				if (res.data.code == 200) {
 					this.$u.toast('发布成功');
@@ -373,14 +402,19 @@ export default {
 			}
 			this.postAnswer()
 		},
-		postStudyRecord(status=0) {
+		postStudyRecord(status=0,sectionId=self.playSectionId) {
+			let currentTime = 0
+			 var polyvPlayerContext = this.selectComponent('#playerVideo');
+			 if(polyvPlayerContext){
+				  currentTime =polyvPlayerContext.getCurrentTime() 
+			 }
 			let self = this;
 			let data = {
 				photo:self.ossAvatarUrl,
-				sectionId:parseInt(self.playSectionId),
+				sectionId:parseInt(sectionId),
 				goodsId:parseInt(self.goodsId),
 				courseId:parseInt(self.courseId),
-				studyDuration:parseInt(self.studyDuration),
+				studyDuration:parseInt(currentTime>0?currentTime:self.studyDuration),
 				gradeId:parseInt(self.gradeId),
 				chapterId:parseInt(self.chapterId),
 				moduleId:parseInt(self.moduleId)
@@ -481,7 +515,7 @@ export default {
 			let self = this
 		        var polyvPlayerContext = this.selectComponent('#playerVideo');
 				if (polyvPlayerContext != null) {
-					let PlayCurrentTime = polyvPlayerContext.getCurrentTime();
+					let PlayCurrentTime = polyvPlayerContext.getVideoPlayDuration();
 					this.studyDuration = PlayCurrentTime
 					if(this.currentTime<PlayCurrentTime){
 						this.playTime+=(PlayCurrentTime-this.currentTime)
@@ -505,7 +539,14 @@ export default {
 				}
 		},
 		onStateChange(newstate, oldstate) {
+			console.log(newstate,6989)
 			if (newstate.detail.newstate == 'playing') {
+				if(this.needSeek){
+					var polyvPlayerContext = this.selectComponent('#playerVideo');
+					polyvPlayerContext.seek(this.recordObj.studyDuration)
+					polyvPlayerContext.play()
+					this.needSeek = false
+				}
 				//开始播放
 				if(this.timer){
 					clearInterval(this.timer);
@@ -569,6 +610,7 @@ export default {
 			this.$api.goodsDetail(this.goodsId).then(res => {
 				self.goodsData = res.data.data;
 				self.gradeId = self.goodsData.gradeId
+				console.log(self.gradeId,698)
 				self.getMenuList();
 				self.getReMenuList() //获取重修目录
 				

+ 5 - 1
pages2/plan/index.vue

@@ -238,7 +238,6 @@ export default {
 			this.haveNextMonth = false;
 			this.havePreviousMonth = false;
 			this.workList = this.listItem.goodsVos;
-			return;
 			if (this.listItem !== undefined) {
 				for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
 					let item = this.listItem.calendarStudyVo[i];
@@ -370,6 +369,11 @@ export default {
 				item.show = 'none';
 			}
 		},
+		updateHomePlan(){
+			const pages = getCurrentPages(); //获取页面栈
+			const beforePage = pages[pages.length - 2]; //前一个页面
+		//	beforePage.$vm.updateHomePlan();
+		},
 		close_calendar() {
 			this.isOpen = false;
 			this.showDayList = this.calendarStudyVo.miniDayStudyList;