فهرست منبع

教师研修视频详情修改

liurongli 3 هفته پیش
والد
کامیت
a0fd282945
3فایلهای تغییر یافته به همراه48 افزوده شده و 27 حذف شده
  1. 3 0
      androidPrivacy.json
  2. 6 1
      manifest.json
  3. 39 26
      pages/teacherStudy/videoDetails.vue

+ 3 - 0
androidPrivacy.json

@@ -0,0 +1,3 @@
+{
+    "prompt": "template"
+}

+ 6 - 1
manifest.json

@@ -26,7 +26,9 @@
             "landscape-secondary" // 横屏(home键在设备左侧)
         ],
         /* 模块配置 */
-        "modules" : {},
+        "modules" : {
+            "VideoPlayer" : {}
+        },
         /* 应用发布信息 */
         "distribute" : {
             /* android打包配置 */
@@ -88,6 +90,9 @@
                         "spotlight@3x" : "unpackage/res/icons/120x120.png"
                     }
                 }
+            },
+            "splashscreen" : {
+                "useOriginalMsgbox" : true
             }
         }
     },

+ 39 - 26
pages/teacherStudy/videoDetails.vue

@@ -50,14 +50,14 @@
 				课程简介:{{state?.videoInfo?.courseContent}}
 			</view>
 		</view>
+		<!-- 提示框 -->
+		<custom-popup-dialog ref="popupDialogRef" title="试题弹出" dialogWidth="702" :isMaskClick="false" :showDialogClose="false" :showCloseBtn="false" @DialogConfirm="DialogConfirm">
+			<view class="dialog_questions_input">
+				<view class="questions_title">{{state?.question?.codeName}}:{{state?.question?.questionsName}}</view>
+				<uni-easyinput type="textarea" v-model="state.questionsAnswer" :style="state.easyinputStyle" placeholder="请输入你的回答" placeholderStyle="font-weight: 400;font-size: 28rpx;color: #999999;"></uni-easyinput>
+			</view>
+		</custom-popup-dialog>	
 	</view>
-	<!-- 提示框 -->
-	<custom-popup-dialog ref="popupDialogRef" title="试题弹出" dialogWidth="702" :isMaskClick="false" :showDialogClose="false" :showCloseBtn="false" @DialogConfirm="DialogConfirm">
-		<view class="dialog_questions_input">
-			<view class="questions_title">{{state?.question?.codeName}}:{{state?.question?.questionsName}}</view>
-			<uni-easyinput type="textarea" v-model="state.questionsAnswer" :style="state.easyinputStyle" placeholder="请输入你的回答" placeholderStyle="font-weight: 400;font-size: 28rpx;color: #999999;"></uni-easyinput>
-		</view>
-	</custom-popup-dialog>	
 </template>
 
 <script setup>
@@ -103,7 +103,7 @@
 			if(res.code == 200){
 				const resData = res.data;
 				resData.initialTime = timeToSecond(resData.courseLearnTime ?? '');//视频初始播放位置
-				state.lastValidTime = resData.initialTime;//上一次播放进度
+				state.lastValidTime = timeToSecond(resData.courseLearnTime ?? '');
 				resData.duration = timeToSecond(resData.videoTime ?? '');//视频时长,单位为秒(s)
 				if(resData?.questionsList?.length > 0){
 					resData.questionsList.forEach(item=>{
@@ -125,24 +125,32 @@
 	//播放进度变化时触发,event.detail = {currentTime, duration} 。触发频率 250ms 一次
 	const videoTimeupdate = (event) => {
 		const currentTime = event.detail.currentTime;
-		// 1. 判断:如果当前时间小于记录值,说明在回退
-		const diff = (Number(currentTime) - Number(state.lastValidTime)).toFixed(2);
-		const dragStatus = state.videoInfo.dragStatus || 0;//0 不可拖拽、默认不可拖拽
-		if (diff > 0.35 && dragStatus == 0) {
-			videoCtx.value.seek(state.lastValidTime);
-		}
-		state.currentTime = formatSecondsToHms(currentTime);
-		const questionsList = state?.videoInfo?.questionsList || [];
-		const question = questionsList.find(item=>item.showTime == state.currentTime);//视频显示的时间
-		if(question && !question.isWriteAnswer){//未作答
-			videoCtx?.value?.pause();//暂停播放
-			state.questionsAnswer = '';
-			state.question = question;//试题弹框信息
-			popupDialogRef.value.OpenDialog();
+		if(currentTime > 0){
+			// 1. 判断:如果当前时间小于记录值,说明在回退
+			const diff = (Number(currentTime) - Number(state.lastValidTime)).toFixed(2);
+			const dragStatus = state.videoInfo.dragStatus || 0;//0 不可拖拽、默认不可拖拽
+			const learnStatus = state.videoInfo.learnStatus ?? 3;//学习状态
+			const progress = state.videoInfo.progress;//进度
+			if (diff > 0.35 && dragStatus == 0 && (learnStatus!=4 || (learnStatus!=1 && progress!='100%'))) {
+				videoCtx.value.seek(state.lastValidTime);
+			}
+			state.currentTime = formatSecondsToHms(currentTime);
+			const questionsList = state?.videoInfo?.questionsList || [];
+			const question = questionsList.find(item=>item.showTime == state.currentTime);//视频显示的时间
+			if(question && !question.isWriteAnswer){//未作答
+				videoCtx?.value?.pause();//暂停播放
+				state.questionsAnswer = '';
+				state.question = question;//试题弹框信息
+				popupDialogRef.value.OpenDialog();
+			}
+			state.lastValidTime = currentTime;//上一次播放进度
+			// 教师学习进度更新接口
+			if(learnStatus!=4 || (learnStatus!=1 && progress!='100%')){
+				state.videoInfo.progress = Math.min(currentTime / Number(state.videoInfo.duration) * 100, 100).toFixed(2) + '%';
+				setSynTeachLearnData();
+			}
 		}
-		state.lastValidTime = currentTime;//上一次播放进度
-		// 教师学习进度更新接口
-		setSynTeachLearnData();
+		
 	}
 	//提交试题
 	const DialogConfirm = () => {
@@ -174,11 +182,16 @@
 	const setSynTeachLearnData = () => {
 		const videoTime = state.videoInfo.videoTime ?? '';//视频时长
 		// 学习状态: 1-已结束(原已过期状态-课程结束了,但是用户没学完),2-待开始,3-未完成,4-已完成
-		const learnStatus = state.videoInfo.learnStatus ?? 3;//视频时长
+		const learnStatus = state.videoInfo.learnStatus ?? 3;
 		synTeachLearnData({
 			teachCourseId:state.id,
 			courseLearnTime:state.currentTime,
 			learnStatus:state.currentTime==videoTime && learnStatus!=1 && learnStatus!=4?4:learnStatus
+		}).then(res=>{
+			if(res.code==200 && state.currentTime==videoTime && learnStatus!=1 && learnStatus!=4){
+				state.videoInfo.learnStatus = 4;//学习状态
+				state.videoInfo.progress = '100%';//进度
+			}
 		})
 	}
 	// 数字补零工具