Эх сурвалжийг харах

Merge branch 'master' of https://gitee.com/he2802/saas_applet

chenxiong 3 жил өмнө
parent
commit
d4906df76f

+ 59 - 34
pages2/class/detail.vue

@@ -130,7 +130,7 @@
 		</view>
 		<!-- 播放前拍照end -->
 		<u-popup v-model="showSet" :mask-close-able="false" mode="center">
-			<view style="width: 250rpx;height: 250rpx;display: flex;align-items:center">
+			<view style="height: 250rpx;display: flex;align-items:center;padding: 0 30rpx;">
 				<button open-type="openSetting" @bindopensetting="openSetting" class="btnSet">相机授权</button>
 			</view>
 		</u-popup>
@@ -237,9 +237,12 @@ export default {
 		this.courseDetail();
 		this.getGoodsDetail();
 		this.getAnswerList();
+		
 	},
 	onShow() {
 		var self = this;
+		//相机授权
+		this.getCameraSetting()
 		this.$api.getbaseprofiletplists({ goodsId: self.goodsId }).then(res => {
 			if (res.data.code === 200 && res.data.rows.length) {
 				if (res.data.rows[0].keyValue) {
@@ -335,7 +338,6 @@ export default {
 	},
 	mounted() {
 		uni.$on('changeSection', oldSectionId => {
-			this.ossAvatarUrl = '';
 			this.postStudyRecord(0, oldSectionId);
 		});
 		uni.$on('getSection', item => {
@@ -358,51 +360,56 @@ export default {
 		      success: res => {
 		        if (res.authSetting['scope.camera']) {
 		          // 用户已经授权
-		          
+		           self.showSet = false
 		        } else {
 		          // 用户还没有授权,向用户发起授权请求
 		          wx.authorize({
 		            scope: 'scope.camera',
 		            success() { // 用户同意授权
-		             
+		              self.showSet = false
 		            },
 		            fail() { // 用户不同意授权
 		             self.showSet = true
-		              wx.showToast({
+		             /* wx.showToast({
 		                title: '摄像头授权失败',
 		                icon: 'none',
 		                duration: 3000
-		              })
+		              }) */
 		            }
 		          })
 		        }
 		      },
 		      fail: res => {
-		        console.log('获取用户授权信息失败')
-		        wx.showToast({
-		          title: '获取用户授权信息失败',
-		          icon: 'none',
-		          duration: 3000
-		        })
+		       
 		       
 		      }
 		    })
 		  },
 		openJY(){
-	//		this.getCameraSetting()
-	//		this.openPhoto();
-	//		this.getCameraSetting()
-			/* wx.openSetting({
-			      success (res) {
-			        if(res.authSetting['scope.camera']){
-	//		          self.setData({ showCamera:true})
-			        }
-			      }
-			    }) */
-
-
 			this.$u.toast('此功能正在开发中');
 		},
+		//播放笔记视频
+		async playNoteVideo(item) {
+			if (this.timer) {
+				clearInterval(this.timer);
+			}
+			if (this.vid) {
+				//切换视频
+				var polyvPlayerContext = this.selectComponent('#playerVideo');
+				polyvPlayerContext.changeVid(item.recordingUrl);
+			} else {
+				this.vid = item.recordingUrl;
+			}
+			this.recordObj = {studyDuration:item.noteSecond}
+			if (this.recordObj.studyDuration) {
+				this.needSeek = true; //需要跳转到播放记录
+			}
+			this.startStatus = true;
+		
+			//获取节笔记
+			this.getNoteList();
+		},
+		//正常播放视频
 		async playVideo(item) {
 			if (this.timer) {
 				clearInterval(this.timer);
@@ -438,13 +445,23 @@ export default {
 				});
 			});
 		},
+		
 		jumpNote(item) {
 			this.noteId = item.noteId;
-			this.$u.toast('即将跳到笔记位置');
-			//跳到笔记时刻
-			var polyvPlayerContext = this.selectComponent('#playerVideo');
-			polyvPlayerContext.seek(item.noteSecond);
-			polyvPlayerContext.play();
+			//没视频播放
+			if(this.playSectionId==0){
+				this.$u.toast('即将跳到笔记位置');
+				this.$store.commit('setPlaySectionId', {playSectionId  :item.sectionId});
+				this.playNoteVideo(item);
+			}else{
+				//正在看当前笔记视频
+				this.$u.toast('即将跳到笔记位置');
+				//跳到笔记时刻
+				var polyvPlayerContext = this.selectComponent('#playerVideo');
+				polyvPlayerContext.seek(item.noteSecond);
+				polyvPlayerContext.play();
+			}
+			
 		},
 		postNote() {
 			let self = this;
@@ -491,7 +508,12 @@ export default {
 		},
 		getNoteList() {
 			let self = this;
-			this.$api.noteList({ sectionId: this.playSectionId, courseId: this.courseId, gradeId: this.gradeId, goodsId: this.goodsId }).then(res => {
+			self.noteList = [];
+			let data = { courseId: this.courseId, gradeId: this.gradeId, goodsId: this.goodsId }
+			if(this.playSectionId>0){
+				data.sectionId = this.playSectionId
+			}
+			this.$api.noteList(data).then(res => {
 				if (res.data.code == 200) {
 					self.noteList = res.data.rows;
 				}
@@ -536,8 +558,9 @@ export default {
 			});
 		},
 		postContent() {
-			if (!this.ctxValue) {
+			if (!this.ctxValue||this.ctxValue=='') {
 				this.$u.toast('请输入内容');
+				return
 			}
 			this.postAnswer();
 		},
@@ -758,7 +781,8 @@ export default {
 				console.log(self.gradeId, 698);
 				self.getMenuList();
 				self.getReMenuList(); //获取重修目录
-
+				//获取节笔记
+				this.getNoteList();
 				if (self.goodsData.goodsPlayConfig) {
 					self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
 					if (self.goodsPlayConfig.autoPlay > 0) {
@@ -842,12 +866,13 @@ export default {
 
 <style lang="scss" scope>
 	.btnSet{
-		width: 100px;
 		height: 50px;
+		width: 400rpx;
 		background: #007AFF;
-		border-radius: 40rpx;
+		border-radius: 25rpx;
 		color: #FFFFFF;
 		font-size: 28rpx;
+		line-height: 50px;
 	}
 .btnReply {
 	width: 80rpx;

+ 1 - 0
pages2/plan/create.vue

@@ -274,6 +274,7 @@ export default {
 							showCancel: false,
 							success: function(resst) {
 								if (resst.confirm) {
+									uni.setStorageSync('updateHome',1)
 									uni.navigateBack();
 								}
 							}