From 91176ee51874406aef4d422fd76f9b5aafd50f7a Mon Sep 17 00:00:00 2001 From: daihh Date: Tue, 20 Dec 2022 22:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/paper.js | 4 +- src/components/Course/weikeContent.vue | 128 +++++++++++++++++++------ src/views/study/coursenew.vue | 2 +- 3 files changed, 104 insertions(+), 30 deletions(-) diff --git a/src/api/modules/paper.js b/src/api/modules/paper.js index 8dc08937..5ed38974 100644 --- a/src/api/modules/paper.js +++ b/src/api/modules/paper.js @@ -32,8 +32,8 @@ const update = function(data) { } /* 编辑详情 */ const detail = function(id) { - return ajax.get('/xboe/m/exam/paper/query?id=' + id); - } + return ajax.get('/xboe/m/exam/paper/query?id=' + id); +} /* 试卷批量导入计算 * num 数目 diff --git a/src/components/Course/weikeContent.vue b/src/components/Course/weikeContent.vue index 2b2f640c..8b1df390 100644 --- a/src/components/Course/weikeContent.vue +++ b/src/components/Course/weikeContent.vue @@ -277,8 +277,8 @@
- 自定义考试 - + 自定义考试 + 选择已有考试
@@ -289,37 +289,39 @@
--> -
-
-
搜索已有考试
+
+
查询
+
返回
-
- - - +
+ + + + + - - - - - - +
+ +
-
自定义考试
+
{{exam.paperType==1? '自定义考试':'使用独立考试试卷'}}
只显示试题 保 存 @@ -401,9 +403,12 @@
-
+
+
+
试卷: {{usePaper.paperName}}
+
@@ -541,6 +546,7 @@ import pdfPreview from "@/components/PdfPreview/index.vue"; import apiCourse from '../../api/modules/course.js'; import apiCourseFile from '../../api/modules/courseFile.js'; + import apiExamPaper from '../../api/modules/paper.js'; import audioPlayer from '@/components/AudioPlayer/index.vue'; import {getType} from '../../utils/tools.js'; import { deepClone } from "../../utils"; @@ -685,6 +691,16 @@ } }, + usePaper:{ //使用考试试卷 + pageIndex:1, + pageSize:10, + total:0, + list:[], + keyword:'', + paperId:'',//选择的试卷的id + paperName:'',//选择的试卷的名称 + paperJson:{items:[]}, + }, exam:{ show:1, content:{id:'',contentType:61,sortIndex:3}, @@ -711,7 +727,6 @@ paperId:'',//试卷的id,只有paperType为2的时间才会有值 info:'',//考试说明 paperContent:'',//试题的json字符串 - } }, assess:{ @@ -1242,15 +1257,74 @@ changeHomeworkShow(idx){ this.homework.show=idx; }, - changeExamShow(idx){ - - this.exam.show=idx; - }, assessmentHandle(){ this.assess.show=2; + }, + changeExamShow(idx){ + this.exam.show=idx; + }, + openCusExam(){ //自定义考试 + this.exam.show=3; + this.exam.paperType=1; + this.exam.paperId=''; + this.usePaper.pageIndex=1; + this.usePaper.keyword=""; + }, + openChoosePaper(){ + this.exam.show=2; + this.exam.paperType=3; + this.exam.paperId=''; + }, + findExamPapers(){ //查询已有的考试试卷 + this.usePaper.pageIndex=1; + this.loadExamPapers(); + }, + loadExamPapers(){ + let pars={ + pageIndex:this.usePaper.pageIndex, + pageSize:this.usePaper.pageSize, + keyword:this.usePaper.keyword } + apiExamPaper.querylist(pars).then(rs=>{ + if(rs.status==200){ + this.usePaper.list=rs.result.list; + this.usePaper.total=rs.result.count; + }else{ + this.$message.error('查询可用试卷失败'); + } + }) + }, + changePaperPage(pindex){ + this.usePaper.pageIndex=pindex; + this.loadExamPapers(); + }, + chooseExamPaper(epaper){ //选择试卷后 + if(epaper.counts==0){ + this.$message.error('此试卷无试题内容,请重新选择'); + return; + } + this.exam.info.paperType=2;// 选择已有试卷 + this.exam.info.paperId=epaper.id;// 选择已有试卷 + this.usePaper.paperId=epaper.id; + this.usePaper.paperName=epaper.testName; + //this.usePaper.paperJson= epaper.paperContent; + this.loadExamPaper(); + this.changeExamShow(3); + }, + loadExamPaper(){ + if(this.exam.info.paperType!=2){ + return; + } + apiExamPaper.detail(this.exam.info.paperId).then(rs=>{ + if(rs.status==200){ + this.usePaper.paperId=rs.result.id; + this.usePaper.paperName=rs.result.testName; + //this.usePaper.paperJson= rs.result.paperContent; + } + }) } } +}