From 99792cd58f4a0c7f78f7be41c6e8388a8c3f604f Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 17 Oct 2022 10:01:54 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=AD=94=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/questionBank.js | 14 +- .../competitionManage/bankList/index.vue | 19 +- .../bankList/previewAnswer.vue | 162 ++++++++++++++++++ 3 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 src/views/competitionManage/bankList/previewAnswer.vue diff --git a/src/api/questionBank.js b/src/api/questionBank.js index b922b07f0..663ff2a70 100644 --- a/src/api/questionBank.js +++ b/src/api/questionBank.js @@ -49,11 +49,12 @@ export function updateOption(data) { } // 获取题目信息 -export function getQuestionInfo(questionId) { +export function getQuestionInfo(questionId, params) { return request({ // url: `/api/questionBank/questions/${questionId}`, url: `/api/question/org/${questionId}`, - method: 'get' + method: 'get', + params }); } @@ -65,3 +66,12 @@ export function importQuestion(data) { data }); } + +// 预览答题 +export function testAnswer(questionId, data) { + return request({ + url: `/api/question/org/test/answer/${questionId}`, + method: 'post', + data + }); +} diff --git a/src/views/competitionManage/bankList/index.vue b/src/views/competitionManage/bankList/index.vue index 95ef2d922..0128b0ad5 100644 --- a/src/views/competitionManage/bankList/index.vue +++ b/src/views/competitionManage/bankList/index.vue @@ -2,6 +2,7 @@
+
@@ -9,17 +10,20 @@ // import { UrlConfig } from '@/scripts/ConstDic'; import { listQuestionPage, deleteQuestion, getLableList } from '@/api/questionBank.js'; import DialogDetail from './dialog-detail'; +import PreviewAnswer from './previewAnswer'; import { convertSheetToList } from '@/jmapNew/theme/parser/util.js'; // import { getCompanyList } from '@/api/company'; import XLSX from 'xlsx'; export default { components: { - DialogDetail + DialogDetail, + PreviewAnswer }, data() { return { // companyList: [], + questionId: '', companyMap: {}, pagerConfig: { pageSize: 'pageSize', @@ -114,9 +118,13 @@ export default { // showControl: (row) => { return row.createUserId == this.userId; }, type: 'danger' }, + // { + // name: '预 览', + // handleClick: this.doDetail + // }, { - name: '预 览', - handleClick: this.doDetail + name: '预览答题', + handleClick: this.previewAnswer } ] } @@ -186,6 +194,11 @@ export default { this.$refs.detail.doShow({index, row}); }, + previewAnswer(index, row) { + this.questionId = row.id; + this.$refs.previewAnswer.doShow(); + }, + lableTags(row) { return row.tags ? row.tags.split(',') : ''; }, diff --git a/src/views/competitionManage/bankList/previewAnswer.vue b/src/views/competitionManage/bankList/previewAnswer.vue new file mode 100644 index 000000000..cab30fbc3 --- /dev/null +++ b/src/views/competitionManage/bankList/previewAnswer.vue @@ -0,0 +1,162 @@ + + + + From fe9bf9b495671b6b0463cec83c7d148d384ada70 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 17 Oct 2022 14:04:56 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitionManage/bankList/index.vue | 5 +- .../bankList/previewAnswer.vue | 60 ++++++++++++++----- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/src/views/competitionManage/bankList/index.vue b/src/views/competitionManage/bankList/index.vue index 0128b0ad5..389f87a87 100644 --- a/src/views/competitionManage/bankList/index.vue +++ b/src/views/competitionManage/bankList/index.vue @@ -39,7 +39,7 @@ export default { type: 'select', label: '类 型', config: { - data: this.$ConstSelect.QuestionTypeList + data: this.$ConstSelect.QuestionTypeList.filter(item => { return !['fill', 'answer'].includes(item.value); }) } }, topic: { @@ -63,7 +63,8 @@ export default { columns: [ { title: '题 目', - prop: 'topic' + prop: 'topic', + type: 'html' }, { title: '标 签', diff --git a/src/views/competitionManage/bankList/previewAnswer.vue b/src/views/competitionManage/bankList/previewAnswer.vue index cab30fbc3..f2c43ccb4 100644 --- a/src/views/competitionManage/bankList/previewAnswer.vue +++ b/src/views/competitionManage/bankList/previewAnswer.vue @@ -1,13 +1,14 @@ @@ -47,9 +50,14 @@ +
+ {{ isCorrect ? '答案正确!' : '答案错误!' }} +
提交 关闭 @@ -71,6 +79,8 @@ export default { return { active: '', show: false, + showAnswer: false, + isCorrect: false, form: { type: '', optionList: [] @@ -86,10 +96,19 @@ export default { }, type() { return this.form.type; + }, + mapType() { + const obj = {}; + const list = this.$ConstSelect.QuestionTypeList; + list.forEach(item => { + obj[item.value] = item.label; + }); + return obj; } }, watch: { questionId(val) { + this.showAnswer = false; this.getQuestionInfo(); }, type(val) { @@ -131,13 +150,10 @@ export default { } testAnswer(this.questionId, data).then(res => { if (val) { - if (res.data) { - this.$message.success('答案正确!'); - } else { - this.$message.warning('答案错误!'); - } + this.showAnswer = true; + this.isCorrect = res.data; } - this.doClose(); + // this.doClose(); }).catch(err => { console.log(err, '===err===='); }); @@ -159,4 +175,16 @@ export default { color: #000; padding-left: 15px; } + .show-answer { + padding: 15px; + span { + font-size: 18px; + } + .correct { + color: green; + } + .error { + color: red; + } + } From 0b080e24661ca81ecfbfa21abf15d45e189ea933 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 17 Oct 2022 14:08:47 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/questionBank.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/questionBank.js b/src/api/questionBank.js index 663ff2a70..59f75097b 100644 --- a/src/api/questionBank.js +++ b/src/api/questionBank.js @@ -13,7 +13,7 @@ export function listQuestionPage(params) { // 标签列表 export function getLableList() { return request({ - url: `/api/question/org/lable`, + url: `/api/question/org/label`, method: 'get' }); } From 5e634f08f8cfdb3575b4dc9351747a37388c8615 Mon Sep 17 00:00:00 2001 From: Yuan Date: Mon, 17 Oct 2022 10:02:21 +0800 Subject: [PATCH 4/7] =?UTF-8?q?WIP:=20=E8=AF=95=E5=8D=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/management/exam.js | 251 ++++++--- src/router/index.js | 2 +- src/utils/baseUrl.js | 4 +- src/views/organization/examManage/index.vue | 505 +++++++++-------- src/views/publish/examRule/draft/editRule.vue | 320 +++++------ src/views/publish/examRule/draft/examFrom.vue | 342 +++++------ src/views/publish/examRule/draft/index.vue | 393 ++++++------- src/views/publish/examRule/draft/rule.vue | 533 +++++++----------- 8 files changed, 1134 insertions(+), 1216 deletions(-) diff --git a/src/api/management/exam.js b/src/api/management/exam.js index aa15746f0..8d16594e2 100644 --- a/src/api/management/exam.js +++ b/src/api/management/exam.js @@ -1,114 +1,233 @@ -import request from '@/utils/request'; +import request from '@/utils/request' /** 创建对应课程考题 */ export function createExam(data) { - return request({ - url: `/api/exam`, - method: 'post', - data: data - }); + return request({ + url: `/api/exam`, + method: 'post', + data: data, + }) } /** 获取试卷详情 */ export function getExamLessonDetail(examId) { - return request({ - url: `/api/exam/${examId}`, - method: 'get' - }); + return request({ + url: `/api/exam/${examId}`, + method: 'get', + }) } /** 获取试卷列表 */ export function getExamList(data) { - return request({ - url: '/api/exam/list', - method: 'get', - params: data - }); + return request({ + url: '/api/exam/list', + method: 'get', + params: data, + }) } /** 删除试卷 */ export function deleteExam(data) { - return request({ - url: `/api/exam/${data.id}`, - method: 'delete' - }); + return request({ + url: `/api/exam/${data.id}`, + method: 'delete', + }) } /** 设置试卷下架 */ export function setExamEfficacy(data) { - return request({ - url: `/api/exam/${data.id}/offLine`, - method: 'put' - }); + return request({ + url: `/api/exam/${data.id}/offLine`, + method: 'put', + }) } /** 设置试卷上架 */ export function setExamEffectivey(data) { - return request({ - url: `/api/exam/${data.id}/onLine`, - method: 'put' - }); + return request({ + url: `/api/exam/${data.id}/onLine`, + method: 'put', + }) } /** 更新考试规则*/ export function updateExamRules(data) { - return request({ - url: `/api/exam/${data.id}`, - method: 'put', - data: data - }); + return request({ + url: `/api/exam/${data.id}`, + method: 'put', + data: data, + }) } /** 查询本项目下的考试列表 */ export function getExamListProject(params) { - return request({ - url: `/api/exam/paged/loginProject`, - method: 'get', - params - }); + return request({ + url: `/api/exam/paged/loginProject`, + method: 'get', + params, + }) } /** 查询本项目下的考试列表不分页 */ export function getExamListProjectUnpage(params) { - return request({ - url: `/api/exam/list/loginProject`, - methods: 'get', - params - }); + return request({ + url: `/api/exam/list/loginProject`, + methods: 'get', + params, + }) } /** 查询班级关联的自己创建的试卷 */ export function getExamListSelfByClassId(params) { - return request({ - url: `/api/exam/list/org/self`, - method: 'get', - params - }); + return request({ + url: `/api/exam/list/org/self`, + method: 'get', + params, + }) } /** 根据地图ID和prdType查询试卷列表 */ export function getExamListByMapIdAndPrdType(mapId, prdType) { - return request({ - url: `/api/exam/list/${mapId}`, - method: 'get', - params: { prdType: prdType } - }); + return request({ + url: `/api/exam/list/${mapId}`, + method: 'get', + params: { prdType: prdType }, + }) } /** 更新试卷规则 */ export function updateExamRule(data) { - return request({ - url: `/api/exam/update/rules`, - method: 'put', - data:data - }); + return request({ + url: `/api/exam/update/rules`, + method: 'put', + data: data, + }) } /** 检查并更新【规则数据异常】状态 */ export function checkAndUpdateAbnormal(mapId) { - return request({ - url: `/api/exam/checkAndUpdateAbnormal/${mapId}`, - method: 'put' - }); + return request({ + url: `/api/exam/checkAndUpdateAbnormal/${mapId}`, + method: 'put', + }) } /** 重新生成考试规则 */ -export function regenerateRule (mapId) { - return request({ - url: `/api/exam/regenerateRules/${mapId}`, - method: 'put' - }); +export function regenerateRule(mapId) { + return request({ + url: `/api/exam/regenerateRules/${mapId}`, + method: 'put', + }) +} + +/** + * ============================================================================ + * ============================================================================ + * ============================= 以下为新版试卷的接口 ============================ + * ============================================================================ + * ============================================================================ + */ + +/** + * LIST - + * 根据试卷蓝图名称简介分页查找某个组织的试卷蓝图 + * @param {Number} orgId 组织ID + * @param {String} name 试卷蓝图名称 + * @param {String} profile 试卷蓝图简介 + * @param {Number} findState 状态: (All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过) + * @param {Number} orderBy 排序依据: (1--创建时间 2--更新时间 3--名称;默认值为1) + */ +export function getPapaerListOfOrg({ orgId, ...data }) { + return request({ + url: `/api/v2/paper/composition/find/page/for/${orgId}`, + method: 'POST', + data, + }) +} + +/** + * 创建试卷蓝图 + * @param {Number} data.orgId 组织ID + * @param {String} data.name 试卷蓝图名称 + * @param {String} data.profile 简介 + * @param {String} data.startTime 启用起始时间 + * @param {String} data.endTime 启用截止时间 + * @param {Number} data.validDuration 考试时长 + * @param {String} data.passScore 及格分 + * @param {String} data.fullScore 满分 + */ +export function createPaper(data) { + return request({ + url: `/api/v2/paper/composition/`, + method: 'POST', + data, + }) +} + +/** 修改试卷蓝图基本信息 + * @param {Number} data.id 试卷蓝图ID + * @param {Number} data.orgId 组织ID + * @param {String} data.name 试卷蓝图名称 + * @param {String} data.profile 简介 + * @param {String} data.startTime 启用起始时间 + * @param {String} data.endTime 启用截止时间 + * @param {Number} data.validDuration 考试时长 + * @param {String} data.passScore 及格分 + * @param {String} data.fullScore 满分 + */ +export function editPaperBasic(data) { + return request({ + url: `/api/v2/paper/composition/basic`, + method: 'PUT', + data, + }) +} + +/** 获取试卷完整的蓝图,包括规则 + * @param {Number} pcId 试卷蓝图ID + */ +export function getPaperDetail(pcId) { + return request({ + url: `/api/v2/paper/composition/${pcId}`, + method: 'GET', + }) +} + +/** 查询题库中各类型题的数量 + * @param {Number} params.orgId + * @param {Number} params.subtype + * @param {Array} params.tags + */ +export function getQuestionAmount(params) { + return request({ + url: ``, + method: 'GET', + params, + }) +} + +/** + * 试卷蓝图添加规则 + * @param {Number} pcId 试卷蓝图ID + * @param {Number} type 试题类型:(1-理论题,2-实训题) + * @param {Number} subtype 规则类型 (理论题(1-单选题,2-多选题,3-判断题);实训题(4-单操实训,5-场景实训)) + * @param {Number} score 每题分值 + * @param {Number} amount 题目数量 + */ +export function addPaperRule(data) { + return request({ + url: `/api/v2/paper/composition/rule`, + method: 'POST', + data, + }) +} + +/** + * 更新(保存)试卷蓝图的规则 + * @param {Number} id 规则ID + * @param {Number} pcId 试卷蓝图ID + * @param {Number} type 试题类型:(1-理论题,2-实训题) + * @param {Number} subtype 规则类型 (理论题(1-单选题,2-多选题,3-判断题);实训题(4-单操实训,5-场景实训)) + * @param {Number} score 每题分值 + * @param {Number} amount 题目数量 + */ +export function editPaperRule(data) { + return request({ + url: `/api/v2/paper/composition/rule`, + method: 'PUT', + data, + }) } diff --git a/src/router/index.js b/src/router/index.js index 0a331bb63..36a879106 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -687,7 +687,7 @@ export const publicAsyncRoute = [ hidden: true }, { - path: 'examRule/draft/:mode/:ruleId/:lessonId', + path: 'examRule/draft/:mode/:paperId', component: PublishExamRuleDraft, hidden: true }, diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 0929e8877..bdfb6abea 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -29,8 +29,8 @@ export function handlerUrl() { // BASE_API = 'http://114.116.51.125/jlcloud'; // BASE_API = 'http://192.168.3.90:9100'; // 周寅 // BASE_API = 'http://192.168.3.94:9000'; // 旭强 - BASE_API = 'http://192.168.3.15:9000'; // 张赛 - // BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 + // BASE_API = 'http://192.168.3.15:9000'; // 张赛 + BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 diff --git a/src/views/organization/examManage/index.vue b/src/views/organization/examManage/index.vue index ff494feba..3379fd228 100644 --- a/src/views/organization/examManage/index.vue +++ b/src/views/organization/examManage/index.vue @@ -1,249 +1,272 @@ - + diff --git a/src/views/publish/examRule/draft/editRule.vue b/src/views/publish/examRule/draft/editRule.vue index 234e283c2..76d0f05e0 100644 --- a/src/views/publish/examRule/draft/editRule.vue +++ b/src/views/publish/examRule/draft/editRule.vue @@ -1,175 +1,165 @@ diff --git a/src/views/publish/examRule/draft/examFrom.vue b/src/views/publish/examRule/draft/examFrom.vue index a1bd6cad4..144422714 100644 --- a/src/views/publish/examRule/draft/examFrom.vue +++ b/src/views/publish/examRule/draft/examFrom.vue @@ -1,214 +1,146 @@ diff --git a/src/views/publish/examRule/draft/index.vue b/src/views/publish/examRule/draft/index.vue index aa714fe02..f2ace1ceb 100644 --- a/src/views/publish/examRule/draft/index.vue +++ b/src/views/publish/examRule/draft/index.vue @@ -1,220 +1,203 @@ diff --git a/src/views/publish/examRule/draft/rule.vue b/src/views/publish/examRule/draft/rule.vue index d6941fc47..e8c0d7c60 100644 --- a/src/views/publish/examRule/draft/rule.vue +++ b/src/views/publish/examRule/draft/rule.vue @@ -1,342 +1,213 @@ From e6ae8750da365511a8daa7f26f2c99edf3a311d6 Mon Sep 17 00:00:00 2001 From: Yuan Date: Mon, 17 Oct 2022 14:29:21 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=80=83=E8=AF=95=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/management/exam.js | 67 +++++++------------ src/views/publish/examRule/draft/editRule.vue | 49 +++++++++++--- src/views/publish/examRule/draft/index.vue | 46 ++++++------- src/views/publish/examRule/draft/rule.vue | 12 +--- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/api/management/exam.js b/src/api/management/exam.js index 8d16594e2..a0a6b7e99 100644 --- a/src/api/management/exam.js +++ b/src/api/management/exam.js @@ -148,10 +148,18 @@ export function getPapaerListOfOrg({ orgId, ...data }) { * @param {Number} data.validDuration 考试时长 * @param {String} data.passScore 及格分 * @param {String} data.fullScore 满分 + * @param {Object} data.ruleList 规则列表 + * @param {Object} data.ruleList.id 规则id + * @param {Object} data.ruleList.pcId 试卷蓝图ID + * @param {Object} data.ruleList.type 试题类型 + * @param {Object} data.ruleList.subtype 规则类型 + * @param {Object} data.ruleList.tags 标签 + * @param {Object} data.ruleList.amount 数量 + * @param {Object} data.ruleList.score 每题分值 */ export function createPaper(data) { return request({ - url: `/api/v2/paper/composition/`, + url: `/api/v2/paper/composition/${data.orgId}`, method: 'POST', data, }) @@ -167,10 +175,18 @@ export function createPaper(data) { * @param {Number} data.validDuration 考试时长 * @param {String} data.passScore 及格分 * @param {String} data.fullScore 满分 + * @param {Object} data.ruleList 规则列表 + * @param {Object} data.ruleList.id 规则id + * @param {Object} data.ruleList.pcId 试卷蓝图ID + * @param {Object} data.ruleList.type 试题类型 + * @param {Object} data.ruleList.subtype 规则类型 + * @param {Object} data.ruleList.tags 标签 + * @param {Object} data.ruleList.amount 数量 + * @param {Object} data.ruleList.score 每题分值 */ -export function editPaperBasic(data) { +export function editPaper(data) { return request({ - url: `/api/v2/paper/composition/basic`, + url: `/api/v2/paper/composition`, method: 'PUT', data, }) @@ -186,48 +202,15 @@ export function getPaperDetail(pcId) { }) } -/** 查询题库中各类型题的数量 - * @param {Number} params.orgId - * @param {Number} params.subtype - * @param {Array} params.tags +/** 查询组织下各类型题的数量 + * @param {Number} data.orgId + * @param {Number} data.subtype + * @param {Array} data.tags */ -export function getQuestionAmount(params) { +export function getQuestionAmount(data) { return request({ - url: ``, - method: 'GET', - params, - }) -} - -/** - * 试卷蓝图添加规则 - * @param {Number} pcId 试卷蓝图ID - * @param {Number} type 试题类型:(1-理论题,2-实训题) - * @param {Number} subtype 规则类型 (理论题(1-单选题,2-多选题,3-判断题);实训题(4-单操实训,5-场景实训)) - * @param {Number} score 每题分值 - * @param {Number} amount 题目数量 - */ -export function addPaperRule(data) { - return request({ - url: `/api/v2/paper/composition/rule`, + url: `/api/v2/paper/${data.orgId}/question/count`, method: 'POST', data, }) } - -/** - * 更新(保存)试卷蓝图的规则 - * @param {Number} id 规则ID - * @param {Number} pcId 试卷蓝图ID - * @param {Number} type 试题类型:(1-理论题,2-实训题) - * @param {Number} subtype 规则类型 (理论题(1-单选题,2-多选题,3-判断题);实训题(4-单操实训,5-场景实训)) - * @param {Number} score 每题分值 - * @param {Number} amount 题目数量 - */ -export function editPaperRule(data) { - return request({ - url: `/api/v2/paper/composition/rule`, - method: 'PUT', - data, - }) -} diff --git a/src/views/publish/examRule/draft/editRule.vue b/src/views/publish/examRule/draft/editRule.vue index 76d0f05e0..1afb0aca4 100644 --- a/src/views/publish/examRule/draft/editRule.vue +++ b/src/views/publish/examRule/draft/editRule.vue @@ -8,7 +8,12 @@ > - + - + - + + + - {{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }} @@ -53,6 +64,7 @@