|
@@ -6,7 +6,8 @@
|
|
|
<view class="video_content">
|
|
<view class="video_content">
|
|
|
<!-- duration:指定视频时长,单位为秒(s) initial-time:指定视频初始播放位置,单位为秒(s) -->
|
|
<!-- duration:指定视频时长,单位为秒(s) initial-time:指定视频初始播放位置,单位为秒(s) -->
|
|
|
<video
|
|
<video
|
|
|
- id="myVideo"
|
|
|
|
|
|
|
+ ref="myVideoRef"
|
|
|
|
|
+ id="myVideoRef"
|
|
|
:title="state?.videoInfo?.courseName || ''"
|
|
:title="state?.videoInfo?.courseName || ''"
|
|
|
:initial-time="state?.videoInfo?.initialTime"
|
|
:initial-time="state?.videoInfo?.initialTime"
|
|
|
:duration="state?.videoInfo?.duration"
|
|
:duration="state?.videoInfo?.duration"
|
|
@@ -38,26 +39,27 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 提示框 -->
|
|
<!-- 提示框 -->
|
|
|
- <popup-dialog ref="popupDialogRef" popType="custom" title="试题弹出" :showDialogClose="false" :showCloseBtn="false" :showFootBorder="true" dialogWidth="702" @DialogConfirm="DialogConfirm">
|
|
|
|
|
|
|
+ <custom-popup-dialog ref="popupDialogRef" title="试题弹出" dialogWidth="702" :showCloseBtn="false" @DialogConfirm="DialogConfirm">
|
|
|
<view class="dialog_questions_input">
|
|
<view class="dialog_questions_input">
|
|
|
<view class="questions_title">{{state?.question?.codeName}}:{{state?.question?.questionsName}}</view>
|
|
<view class="questions_title">{{state?.question?.codeName}}:{{state?.question?.questionsName}}</view>
|
|
|
- <uni-easyinput type="textarea" v-model="value" :style="state.easyinputStyle" placeholder="请输入你的回答" placeholderStyle="font-weight: 400;font-size: 28rpx;color: #999999;"></uni-easyinput>
|
|
|
|
|
|
|
+ <uni-easyinput type="textarea" v-model="state.questionsAnswer" :style="state.easyinputStyle" placeholder="请输入你的回答" placeholderStyle="font-weight: 400;font-size: 28rpx;color: #999999;"></uni-easyinput>
|
|
|
</view>
|
|
</view>
|
|
|
- </popup-dialog>
|
|
|
|
|
|
|
+ </custom-popup-dialog>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue';
|
|
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue';
|
|
|
import navBar from '@/components/nav-bar.vue';
|
|
import navBar from '@/components/nav-bar.vue';
|
|
|
- import popupDialog from '@/components/popup-dialog.vue';
|
|
|
|
|
- import { selectCourseDetail } from '@/reqApi/teacherStudy.js';
|
|
|
|
|
|
|
+ import customPopupDialog from '@/components/custom-popup-dialog.vue';
|
|
|
|
|
+ import { selectCourseDetail,addQuestionAnswerData } from '@/reqApi/teacherStudy.js';
|
|
|
import {
|
|
import {
|
|
|
onLoad,
|
|
onLoad,
|
|
|
onUnload
|
|
onUnload
|
|
|
} from '@dcloudio/uni-app';
|
|
} from '@dcloudio/uni-app';
|
|
|
import {
|
|
import {
|
|
|
reactive,
|
|
reactive,
|
|
|
- ref
|
|
|
|
|
|
|
+ ref,
|
|
|
|
|
+ getCurrentInstance
|
|
|
} from 'vue';
|
|
} from 'vue';
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
|
id: '', //视频id
|
|
id: '', //视频id
|
|
@@ -67,14 +69,17 @@
|
|
|
easyinputStyle:{
|
|
easyinputStyle:{
|
|
|
color: '#303133',
|
|
color: '#303133',
|
|
|
borderColor: '#E9E9E9'
|
|
borderColor: '#E9E9E9'
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ questionsAnswer:''
|
|
|
});
|
|
});
|
|
|
//提示框
|
|
//提示框
|
|
|
const popupDialogRef = ref(null);
|
|
const popupDialogRef = ref(null);
|
|
|
|
|
+ const myVideoRef = ref(null);
|
|
|
const videoCtx = ref(null);//播放器
|
|
const videoCtx = ref(null);//播放器
|
|
|
onLoad((option) => {
|
|
onLoad((option) => {
|
|
|
state.id = option.id;
|
|
state.id = option.id;
|
|
|
- videoCtx.value = uni.createVideoContext('myVideo')
|
|
|
|
|
|
|
+ const instance = getCurrentInstance();
|
|
|
|
|
+ videoCtx.value = uni.createVideoContext('myVideoRef', instance.proxy);
|
|
|
GetCourseDetail();
|
|
GetCourseDetail();
|
|
|
})
|
|
})
|
|
|
//视频详情
|
|
//视频详情
|
|
@@ -101,10 +106,37 @@
|
|
|
const question = questionsList.find(item=>item.showTime == state.currentTime);//视频显示的时间
|
|
const question = questionsList.find(item=>item.showTime == state.currentTime);//视频显示的时间
|
|
|
state.question = question;//试题弹框信息
|
|
state.question = question;//试题弹框信息
|
|
|
if(question){
|
|
if(question){
|
|
|
- videoCtx.value?.pause();//暂停播放
|
|
|
|
|
|
|
+ videoCtx?.value?.pause();//暂停播放
|
|
|
|
|
+ state.questionsAnswer = '';
|
|
|
popupDialogRef.value.OpenDialog();
|
|
popupDialogRef.value.OpenDialog();
|
|
|
}
|
|
}
|
|
|
- console.log(state.currentTime,323)
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ //提交试题
|
|
|
|
|
+ const DialogConfirm = () => {
|
|
|
|
|
+ if(state.questionsAnswer == ''){
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请输入答案!',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ addQuestionAnswerData({
|
|
|
|
|
+ teachCourseId: state.id,
|
|
|
|
|
+ teachQuestionsId: state?.question?.id || '',
|
|
|
|
|
+ teachQuestionsAnswer: state.questionsAnswer
|
|
|
|
|
+ }).then(res=>{
|
|
|
|
|
+ if(res.code == 200){
|
|
|
|
|
+ popupDialogRef.value.CloseDialog();//关闭弹框
|
|
|
|
|
+ console.log(videoCtx?.value)
|
|
|
|
|
+ videoCtx?.value?.play();//播放
|
|
|
|
|
+ }else{
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: res.msg || '请求异常',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
// 数字补零工具
|
|
// 数字补零工具
|
|
|
const addZero = (num) => {
|
|
const addZero = (num) => {
|
|
@@ -201,7 +233,6 @@
|
|
|
line-height: 44rpx;
|
|
line-height: 44rpx;
|
|
|
}
|
|
}
|
|
|
.dialog_questions_input{
|
|
.dialog_questions_input{
|
|
|
- padding: 40rpx 30rpx;
|
|
|
|
|
display: flex;
|
|
display: flex;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|