Explorar o código

教师发展学生学习bug修改

liurongli hai 1 mes
pai
achega
b759a8cef8

+ 49 - 12
pages.json

@@ -1,59 +1,58 @@
 {
-	"pages": [
-		{
+	"pages": [{
 			"path": "pages/login/index",
 			"style": {
 				"navigationBarTitleText": "登录",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/login/agreement",
 			"style": {
 				"navigationBarTitleText": "用户协议和隐私政策",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/workspace/index",
 			"style": {
 				"navigationBarTitleText": "工作台",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/workspace/schedule",
 			"style": {
 				"navigationBarTitleText": "校历安排",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/todo/index",
 			"style": {
 				"navigationBarTitleText": "待办",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/message/index",
 			"style": {
 				"navigationBarTitleText": "消息",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/my/index",
 			"style": {
 				"navigationBarTitleText": "我的",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/my/updatePassword",
 			"style": {
 				"navigationBarTitleText": "修改密码",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
 		},
 		{
@@ -135,12 +134,24 @@
 			}
 		},
 		{
-			"path": "pages/teacherStudy/videoDetails",
+			"path": "pages/teacherStudy/videoDetails/index",
 			"style": {
 				"navigationBarTitleText": "教师研修-视频详情",
 				"navigationStyle": "custom"
 			}
 		},
+		{
+			"path": "pages/teacherStudy/videoDetails/subNVue/questionPopup",
+			"style": {
+				"navigationStyle": "custom",
+				"background": "transparent",
+				"app-plus": {
+					"type": "popup",
+					"popup": "none",
+					"animation":"none"
+				}
+			}
+		},
 		{
 			"path": "pages/teacherStudy/learningMonitor/taskDetails",
 			"style": {
@@ -156,10 +167,36 @@
 			}
 		},
 		{
-			"path": "pages/studentStudy/videoDetails",
+			"path": "pages/studentStudy/videoDetails/index",
 			"style": {
 				"navigationBarTitleText": "学生学习-视频详情",
 				"navigationStyle": "custom"
+				// "app-plus": {
+				// 	"subNVues": [{
+				// 		"id": "videoQuestionPopup",
+				// 		"path": "pages/studentStudy/videoDetails/subNVue/questionPopup",
+				// 		"style": {
+				// 			"position": "absolute",
+				// 			"top": "0",
+				// 			"left": "0",
+				// 			"width": "100%",
+				// 			"height": "100%",
+				// 			"background": "transparent"
+				// 		}
+				// 	}]
+				// }
+			}
+		},
+		{
+			"path": "pages/studentStudy/videoDetails/subNVue/questionPopup",
+			"style": {
+				"navigationStyle": "custom",
+				"background": "transparent",
+				"app-plus": {
+					"type": "popup",
+					"popup": "none",
+					"animation":"none"
+				}
 			}
 		},
 		{

+ 1 - 1
pages/studentStudy/courseCenter/index.vue

@@ -212,7 +212,7 @@
 	//视频详情
 	const GoVideoDetails = (id) => {
 		uni.navigateTo({
-			url: `/pages/studentStudy/videoDetails?id=${id}`
+			url: `/pages/studentStudy/videoDetails/index?id=${id}`
 		});
 	}
 </script>

+ 1 - 1
pages/studentStudy/myLearning/index.vue

@@ -244,7 +244,7 @@
 	//视频详情
 	const GoVideoDetails = (id) => {
 		uni.navigateTo({
-			url: `/pages/studentStudy/videoDetails?id=${id}`
+			url: `/pages/studentStudy/videoDetails/index?id=${id}`
 		});
 	}
 </script>

+ 30 - 5
pages/studentStudy/videoDetails.vue → pages/studentStudy/videoDetails/index.vue

@@ -5,12 +5,12 @@
 		<view class="page_content">
 			<view class="video_content">
 				<!-- duration:指定视频时长,单位为秒(s) initial-time:指定视频初始播放位置,单位为秒(s) -->
+				<!-- :duration="state?.videoInfo?.duration" -->
 				<video 
 					ref="myVideoRef"
 					id="myVideoRef"
 					:title="state?.videoInfo?.courseName || ''"
 					:initial-time="state?.videoInfo?.initialTime"
-					:duration="state?.videoInfo?.duration"
 					:show-mute-btn="true"
 					:poster="state?.videoInfo?.videoCoverUrl"
 					:src="state?.videoInfo?.attachmentUrl"
@@ -68,12 +68,13 @@
 	import { teacherSelectCourseDetail,addQuestionAnswerData,updateFollowCountTeacher,synTeacherLearnData } from '@/reqApi/studentStudy.js';
 	import {
 		onLoad,
-		onUnload
+		onUnload,
+		onShow
 	} from '@dcloudio/uni-app';
 	import {
 		reactive,
 		ref,
-		getCurrentInstance
+		getCurrentInstance,
 	} from 'vue';
 	const state = reactive({
 		id: '', //视频id
@@ -97,6 +98,16 @@
 		videoCtx.value = uni.createVideoContext('myVideoRef', instance.proxy);
 		GetCourseDetail();
 	})
+	onShow(() => {
+		// #ifdef APP-PLUS
+		const answer = uni.getStorageSync('videoDetailQuestionPopupSubmit');
+		if(answer){
+			state.questionsAnswer = answer?answer:'';
+			uni.removeStorageSync('videoDetailQuestionPopupSubmit');
+			DialogConfirm();
+		}
+		// #endif
+	})
 	//视频详情
 	const GetCourseDetail = () => {
 		teacherSelectCourseDetail(state.id).then(res => {
@@ -132,16 +143,28 @@
 			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);
+				videoCtx.value.seek(state.lastValidTime);//跳转到s秒
 			}
 			state.currentTime = formatSecondsToHms(currentTime);
 			const questionsList = state?.videoInfo?.questionsList || [];
 			const question = questionsList.find(item=>item.showTime == state.currentTime);//视频显示的时间
-			if(question && !question.isWriteAnswer){//未作答
+			const isSelf = state?.videoInfo?.courseType==1// 0任务学习 1 自主学习 自主学习不弹试题
+			if(question && !isSelf && !question.isWriteAnswer){//未作答
 				videoCtx?.value?.pause();//暂停播放
 				state.questionsAnswer = '';
 				state.question = question;//试题弹框信息
+				// #ifdef APP-PLUS
+				//打开nvue弹窗页面,把question对象编码传过去
+				uni.setStorageSync('videoDetailSendQuestion', JSON.stringify(question))
+				setTimeout(()=>{
+					uni.navigateTo({
+						url:'/pages/studentStudy/videoDetails/subNVue/questionPopup'
+					})
+				},0)
+				// #endif
+				// #ifndef APP-PLUS
 				popupDialogRef.value.OpenDialog();
+				// #endif
 			}
 			state.lastValidTime = currentTime;//上一次播放进度
 			// 教师学习进度更新接口
@@ -168,7 +191,9 @@
 		}).then(res=>{
 			if(res.code == 200){
 				state.question.isWriteAnswer = true;//状态修改成已作答
+				// #ifndef APP-PLUS
 				popupDialogRef.value.CloseDialog();//关闭弹框
+				// #endif
 				videoCtx?.value?.play();//播放
 			}else{
 				uni.showToast({

+ 139 - 0
pages/studentStudy/videoDetails/subNVue/questionPopup.nvue

@@ -0,0 +1,139 @@
+<template>
+	<view class="video_question_popup_mask" @touchmove.stop.prevent>
+		<view class="video_question_popup_wrapper">
+			<view class="video_question_popup_header">
+				<text class="video_question_popup_title">试题弹出</text>
+			</view>
+			<view class="video_question_popup_content">
+				<view class="video_question_popup_content_title">{{ question?.codeName }}:{{ question?.questionsName }}
+				</view>
+				<textarea class="video_question_popup_content_textarea" v-model="answer" placeholder="请输入你的回答"
+					placeholder-style="font-weight: 400;font-size: 28rpx;color: #999999;" :auto-height="false"
+					maxlength="500" />
+			</view>
+			<view class="video_question_popup_footer">
+				<view class="video_question_popup_footer_confirm_btn" @click="handleSubmit">
+					<text class="video_question_popup_footer_confirm_btn_text">确定</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		onLoad,
+		onUnload
+	} from '@dcloudio/uni-app';
+	export default {
+		data() {
+			return {
+				question: null,
+				answer: ''
+			}
+		},
+		onLoad() {
+			const question = uni.getStorageSync('videoDetailSendQuestion');
+			this.question = question ? JSON.parse(question) : null;
+			this.answer = '';
+		},
+		methods: {
+			handleSubmit() {
+				if (!this.answer.trim()) {
+					uni.showToast({
+						title: '请输入答案!',
+						icon: 'none'
+					});
+					return;
+				}
+				// 将提交结果写入临时存储
+				uni.setStorageSync('videoDetailQuestionPopupSubmit', this.answer)
+				uni.navigateBack()
+			}
+		},
+		onUnload() {
+			// 兜底清理
+			uni.removeStorageSync('videoDetailSendQuestion')
+		}
+	}
+</script>
+
+<style>
+	.video_question_popup_mask {
+		flex: 1;
+		background-color: rgba(0, 0, 0, 0.5);
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.video_question_popup_wrapper {
+		width: 702rpx;
+		background-color: #ffffff;
+		border-radius: 16rpx;
+		overflow: hidden;
+	}
+
+	.video_question_popup_header {
+		width: 702rpx;
+		height: 96rpx;
+		background-color: #F5F7FA;
+		border-radius: 16px 16px 0px 0px;
+	}
+
+	.video_question_popup_title {
+		font-weight: 500;
+		font-size: 32rpx;
+		color: #303133;
+		margin-left: 40rpx;
+		line-height: 96rpx;
+	}
+
+	.video_question_popup_content {
+		padding: 40rpx;
+		height: 504rpx;
+	}
+
+	.video_question_popup_content_title {
+		display: flex;
+		font-weight: 400;
+		font-size: 32rpx;
+		color: #303133;
+		text-align: left;
+	}
+
+	.video_question_popup_content_textarea {
+		margin-top: 20rpx;
+		flex: 1;
+		height: 440rpx;
+		border: 2rpx solid #E9E9E9;
+		border-radius: 8rpx;
+		padding: 20rpx 24rpx;
+		font-size: 28rpx;
+		color: #303133;
+	}
+
+	.video_question_popup_footer {
+		display: flex;
+		flex-direction: row;
+		border-top: 2rpx solid #EBEEF5;
+		padding: 30rpx 40rpx;
+		justify-content: flex-end;
+	}
+
+	.video_question_popup_footer_confirm_btn {
+		background-color: #2E64FA;
+		border-radius: 8rpx;
+		flex: 1;
+		height: 72rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.video_question_popup_footer_confirm_btn_text {
+		font-weight: 500;
+		font-size: 28rpx;
+		color: #FFFFFF;
+	}
+</style>

+ 1 - 1
pages/teacherStudy/courseCenter/index.vue

@@ -212,7 +212,7 @@
 	//视频详情
 	const GoVideoDetails = (id) => {
 		uni.navigateTo({
-			url: `/pages/teacherStudy/videoDetails?id=${id}`
+			url: `/pages/teacherStudy/videoDetails/index?id=${id}`
 		});
 	}
 </script>

+ 1 - 1
pages/teacherStudy/myLearning/index.vue

@@ -244,7 +244,7 @@
 	//视频详情
 	const GoVideoDetails = (id) => {
 		uni.navigateTo({
-			url: `/pages/teacherStudy/videoDetails?id=${id}`
+			url: `/pages/teacherStudy/videoDetails/index?id=${id}`
 		});
 	}
 </script>

+ 26 - 3
pages/teacherStudy/videoDetails.vue → pages/teacherStudy/videoDetails/index.vue

@@ -5,12 +5,12 @@
 		<view class="page_content">
 			<view class="video_content">
 				<!-- duration:指定视频时长,单位为秒(s) initial-time:指定视频初始播放位置,单位为秒(s) -->
+				<!-- :duration="state?.videoInfo?.duration" -->
 				<video 
 					ref="myVideoRef"
 					id="myVideoRef"
 					:title="state?.videoInfo?.courseName || ''"
 					:initial-time="state?.videoInfo?.initialTime"
-					:duration="state?.videoInfo?.duration"
 					:show-mute-btn="true"
 					:poster="state?.videoInfo?.videoCoverUrl"
 					:src="state?.videoInfo?.attachmentUrl"
@@ -68,7 +68,8 @@
 	import { selectCourseDetail,addQuestionAnswerData,updateFollowCount,synTeachLearnData } from '@/reqApi/teacherStudy.js';
 	import {
 		onLoad,
-		onUnload
+		onUnload,
+		onShow
 	} from '@dcloudio/uni-app';
 	import {
 		reactive,
@@ -97,6 +98,16 @@
 		videoCtx.value = uni.createVideoContext('myVideoRef', instance.proxy);
 		GetCourseDetail();
 	})
+	onShow(() => {
+		// #ifdef APP-PLUS
+		const answer = uni.getStorageSync('videoDetailQuestionPopupSubmit');
+		if(answer){
+			state.questionsAnswer = answer?answer:'';
+			uni.removeStorageSync('videoDetailQuestionPopupSubmit');
+			DialogConfirm();
+		}
+		// #endif
+	})
 	//视频详情
 	const GetCourseDetail = () => {
 		selectCourseDetail(state.id).then(res => {
@@ -137,11 +148,23 @@
 			state.currentTime = formatSecondsToHms(currentTime);
 			const questionsList = state?.videoInfo?.questionsList || [];
 			const question = questionsList.find(item=>item.showTime == state.currentTime);//视频显示的时间
-			if(question && !question.isWriteAnswer){//未作答
+			const isSelf = state?.videoInfo?.courseType==1// 0任务学习 1 自主学习 自主学习不弹试题
+			if(question && !isSelf && !question.isWriteAnswer){//未作答
 				videoCtx?.value?.pause();//暂停播放
 				state.questionsAnswer = '';
 				state.question = question;//试题弹框信息
+				// #ifdef APP-PLUS
+				//打开nvue弹窗页面,把question对象编码传过去
+				uni.setStorageSync('videoDetailSendQuestion', JSON.stringify(question))
+				setTimeout(()=>{
+					uni.navigateTo({
+						url:'/pages/teacherStudy/videoDetails/subNVue/questionPopup'
+					})
+				},0)
+				// #endif
+				// #ifndef APP-PLUS
 				popupDialogRef.value.OpenDialog();
+				// #endif
 			}
 			state.lastValidTime = currentTime;//上一次播放进度
 			// 教师学习进度更新接口

+ 139 - 0
pages/teacherStudy/videoDetails/subNVue/questionPopup.nvue

@@ -0,0 +1,139 @@
+<template>
+	<view class="video_question_popup_mask" @touchmove.stop.prevent>
+		<view class="video_question_popup_wrapper">
+			<view class="video_question_popup_header">
+				<text class="video_question_popup_title">试题弹出</text>
+			</view>
+			<view class="video_question_popup_content">
+				<view class="video_question_popup_content_title">{{ question?.codeName }}:{{ question?.questionsName }}
+				</view>
+				<textarea class="video_question_popup_content_textarea" v-model="answer" placeholder="请输入你的回答"
+					placeholder-style="font-weight: 400;font-size: 28rpx;color: #999999;" :auto-height="false"
+					maxlength="500" />
+			</view>
+			<view class="video_question_popup_footer">
+				<view class="video_question_popup_footer_confirm_btn" @click="handleSubmit">
+					<text class="video_question_popup_footer_confirm_btn_text">确定</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		onLoad,
+		onUnload
+	} from '@dcloudio/uni-app';
+	export default {
+		data() {
+			return {
+				question: null,
+				answer: ''
+			}
+		},
+		onLoad() {
+			const question = uni.getStorageSync('videoDetailSendQuestion');
+			this.question = question ? JSON.parse(question) : null;
+			this.answer = '';
+		},
+		methods: {
+			handleSubmit() {
+				if (!this.answer.trim()) {
+					uni.showToast({
+						title: '请输入答案!',
+						icon: 'none'
+					});
+					return;
+				}
+				// 将提交结果写入临时存储
+				uni.setStorageSync('videoDetailQuestionPopupSubmit', this.answer)
+				uni.navigateBack()
+			}
+		},
+		onUnload() {
+			// 兜底清理
+			uni.removeStorageSync('videoDetailSendQuestion')
+		}
+	}
+</script>
+
+<style>
+	.video_question_popup_mask {
+		flex: 1;
+		background-color: rgba(0, 0, 0, 0.5);
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.video_question_popup_wrapper {
+		width: 702rpx;
+		background-color: #ffffff;
+		border-radius: 16rpx;
+		overflow: hidden;
+	}
+
+	.video_question_popup_header {
+		width: 702rpx;
+		height: 96rpx;
+		background-color: #F5F7FA;
+		border-radius: 16px 16px 0px 0px;
+	}
+
+	.video_question_popup_title {
+		font-weight: 500;
+		font-size: 32rpx;
+		color: #303133;
+		margin-left: 40rpx;
+		line-height: 96rpx;
+	}
+
+	.video_question_popup_content {
+		padding: 40rpx;
+		height: 504rpx;
+	}
+
+	.video_question_popup_content_title {
+		display: flex;
+		font-weight: 400;
+		font-size: 32rpx;
+		color: #303133;
+		text-align: left;
+	}
+
+	.video_question_popup_content_textarea {
+		margin-top: 20rpx;
+		flex: 1;
+		height: 440rpx;
+		border: 2rpx solid #E9E9E9;
+		border-radius: 8rpx;
+		padding: 20rpx 24rpx;
+		font-size: 28rpx;
+		color: #303133;
+	}
+
+	.video_question_popup_footer {
+		display: flex;
+		flex-direction: row;
+		border-top: 2rpx solid #EBEEF5;
+		padding: 30rpx 40rpx;
+		justify-content: flex-end;
+	}
+
+	.video_question_popup_footer_confirm_btn {
+		background-color: #2E64FA;
+		border-radius: 8rpx;
+		flex: 1;
+		height: 72rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.video_question_popup_footer_confirm_btn_text {
+		font-weight: 500;
+		font-size: 28rpx;
+		color: #FFFFFF;
+	}
+</style>