From c9b10a477d5f6c956db81bf7220fea7da330781d Mon Sep 17 00:00:00 2001 From: 18571350067 Date: Thu, 23 Dec 2021 14:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E9=A2=84=E8=A7=88=EF=BC=8C?= =?UTF-8?q?=E8=AF=BE=E4=B8=AD=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course/question/requiredQuestion.js | 12 +- src/views/course/CoursewareList.vue | 2 +- src/views/course/CoursewarePreview.vue | 171 +++++++++++++++++--- 3 files changed, 157 insertions(+), 28 deletions(-) diff --git a/src/api/course/question/requiredQuestion.js b/src/api/course/question/requiredQuestion.js index d191bab..e8d0dc8 100644 --- a/src/api/course/question/requiredQuestion.js +++ b/src/api/course/question/requiredQuestion.js @@ -2,9 +2,9 @@ import request from '@/utils/request' const requiredQuesitonApi = { list: 'courseManagement/requiredQuestion/listPage', - addOrUpdate: '/courseManagement/requiredQuestion/addOrUpdate', + addOrUpdate: 'courseManagement/requiredQuestion/addOrUpdate', requiredQuestionId:'courseManagement/requiredQuestion/requiredQuestionId', - // questionList:'/courseManagement/course/questionList', + testing:'/courseManagement/requiredQuestion/testing', } @@ -35,6 +35,14 @@ export function requiredQuestionId(params) { }) } +//必选题题目内容 +export function testing(params) { + return request({ + url: requiredQuesitonApi.testing, + method: 'get', + params: params + }) +} // export function menuGet (params) { // return request({ diff --git a/src/views/course/CoursewareList.vue b/src/views/course/CoursewareList.vue index da31fec..c50a330 100644 --- a/src/views/course/CoursewareList.vue +++ b/src/views/course/CoursewareList.vue @@ -90,7 +90,7 @@ export default { detail(record){ this.$router.push({ path: '/course/CoursewarePreview', - query: { coursewareId: record.id} + query: { coursewareId: record.id, courseId: this.$route.query.id} }) } diff --git a/src/views/course/CoursewarePreview.vue b/src/views/course/CoursewarePreview.vue index 9f5a207..086f685 100644 --- a/src/views/course/CoursewarePreview.vue +++ b/src/views/course/CoursewarePreview.vue @@ -6,19 +6,62 @@
- + - - - +
+ +
+
+ + + +
+

{{item.name}}

+
+
+
+ +
+

+ {{index+1}}.({{ item.questionTypeName }}){{ item.questionName }} +

+ + +
+
A. {{ item.answerA }}
+
B. {{ item.answerB }}
+
C. {{ item.answerC }}
+
D. {{ item.answerD }}
+
E. {{ item.answerE }}
+
F. {{ item.answerF }}
+
+ + +
+
正确答案:    {{ item.rightAnswers }}
+
+ + +
+
+ 正确答案{{ ind + 1 }}:    {{ item1 }} +
+
+ +
+
解析
+
+ {{ item.asnwerParse }} +
+
+ +
+
+
+
@@ -30,48 +73,126 @@ import 'video.js/dist/video-js.css' import 'vue-video-player/src/custom-theme.css' import { videoPlayer } from 'vue-video-player' import { coursewareDeatil } from '@/api/course/courseware' +import { testing } from '@/api/course/question/requiredQuestion' export default { components: { videoPlayer }, data() { return { - queryParam: { id: this.$route.query.coursewareId }, + type: 1, + isactive: 0, + queryParam: { coursewareId: this.$route.query.coursewareId }, courseware: [], //课件详情 + question: [], //课中检测 + value: 'a', playerOptions: { // width: 800, - height: '360', - fluid: true, + height: '650', + fluid: false, autoplay: true, muted: true, language: 'en', - playbackRates: [0.7, 1.0, 1.5, 2.0], + playbackRates: [0.7, 1.0, 1.5, 2.0], //设置倍速 + autoplay: false, //进入时是否开始自动播放 sources: [ - { - type: 'video/mp4', - src: 'http://vjs.zencdn.net/v/oceans.mp4' - } + //类型: Array 一组对象,它们反映了本机元素具有一系列子元素的能力。这应该是带有src和type属性的对象数组 + // { + // type: 'video/mp4', + // src: this.videoPath, + // }, ], - poster: 'https://surmon-china.github.io/vue-quill-editor/static/images/surmon-1.jpg' - } + poster: 'https://pica.zhimg.com/v2-c79ec963f532b2ad2749d5c71353c0d0_1440w.jpg?source=172ae18b', //封面图片 + }, } }, created() { let parameter = {} - coursewareDeatil(Object.assign(parameter, this.queryParam)).then(res => { - console.log(res) - this.courseware = res + coursewareDeatil(Object.assign(parameter, this.queryParam)).then((res) => { + //课件内容 + this.courseware = res.data + + if (this.courseware.videoList.length > 1) this.play(this.courseware.videoList[0].path, 0) + + //课中检测必选题 + testing(Object.assign(parameter, this.queryParam)).then((res1) => { + this.question = res1.data + console.log('question-------', this.question) + }) }) }, methods: { //返回 goback() { - this.$router.push({ path: '/course/CourseList', query: {} }) - } - } + this.$router.push({ path: '/course/CoursewareList', query: { id: this.$route.query.courseId } }) + }, + + //选择播放的文件 + play(path, index) { + this.isactive = index + + // 加载视频 + this.playerOptions.sources = [] + this.playerOptions.sources.push({ type: 'video/mp4', src: path }) + }, + + //控制显示视频还是课中检测 + callback(key) { + console.log(key) + }, + onChange(e) { + console.log(`checked = ${e.target.value}`) + }, + }, }