From 0d6f6dda1c765d89304106a80c32f6da7947c8f1 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 19 Oct 2022 18:15:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=90=86=E8=AE=BA=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=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 | 142 ++++++++++++------ static/theoryTemplate/理论试题导入模板.xlsx | Bin 12305 -> 12316 bytes 2 files changed, 95 insertions(+), 47 deletions(-) diff --git a/src/views/competitionManage/bankList/index.vue b/src/views/competitionManage/bankList/index.vue index 1fd525785..9a31a89f0 100644 --- a/src/views/competitionManage/bankList/index.vue +++ b/src/views/competitionManage/bankList/index.vue @@ -135,7 +135,7 @@ export default { { text: '添 加', handler: this.doCreate }, { text: '导 入', fileType: 'file', handler: this.importQuestionBank }, // { text: '试卷规则管理', handler: this.questionsRuleManage}, - // { text: '导出', handler: this.exportTemplate} + // { text: '导出', handler: this.exportTemplate}, { text: '导出模板', handler: this.downloadTemplate} ] } @@ -249,11 +249,12 @@ export default { }; if (file) { try { - setTimeout(() => { - const that = this; - const reader = new FileReader(); - if (reader) { - reader.onload = function (e) { + // setTimeout(() => { + const that = this; + const reader = new FileReader(); + if (reader) { + reader.onload = function (e) { + try { let wb; const data = e.target.result; if (that.rABS) { @@ -269,46 +270,46 @@ export default { if (wb && wb.Sheets) { for (const index in wb.Sheets) { const dataList = convertSheetToList(wb.Sheets[index], true); - let questionTypeIndex; - let topicIndex; - let tagsIndex; - let option1Index; - let option2Index; - let option3Index; - let option4Index; - let option5Index; - let option6Index; - let answerIndex; + const objHeader = { + questionTypeIndex: '题型(必填)', + topicIndex: '题干(必填)', + tagsIndex: '标签', + option1Index: '选项A(必填)', + option2Index: '选项B(必填)', + option3Index: '选项C', + option4Index: '选项D', + option5Index: '选项E', + option6Index: '选项F', + answerIndex: '正确答案(必填)' + }; + const indexHeader = JSON.parse(JSON.stringify(objHeader)); dataList.forEach((item, ii) => { - if (!item[0] && !item[1] && item[2] === '题型(必填)') { - questionTypeIndex = ii; - } else if (!item[0] && !item[1] && item[2] === '题干(必填)') { - topicIndex = ii; - } else if (!item[0] && !item[1] && item[2] === '标签') { - tagsIndex = ii; - } else if (!item[0] && !item[1] && item[2] === '选项A(必填)') { - option1Index = ii; - } else if (!item[0] && !item[1] && item[2] === '选项B(必填)') { - option2Index = ii; - } else if (!item[0] && !item[1] && item[2] === '选项C') { - option3Index = ii; - } else if (!item[0] && !item[1] && item[2] === '选项D') { - option4Index = ii; - } else if (!item[0] && !item[1] && item[2] === '选项E') { - option5Index = ii; - } else if (!item[0] && !item[1] && item[2] === '选项F') { - option6Index = ii; - } else if (!item[0] && !item[1] && item[2] === '正确答案(必填)') { - answerIndex = ii; + Object.keys(objHeader).forEach(key => { + if (!item[0] && !item[1] && item[2] === objHeader[key]) { + indexHeader[key] = ii; + } + }); + }); + const errHeader = []; + Object.keys(objHeader).forEach(key => { + if (typeof indexHeader[key] != 'number') { + errHeader.push(objHeader[key]); } }); + let errInfo = errHeader.join(';'); + if (errInfo) { + const error = `以下列:${errInfo},无法找到`; + throw error; + } + const errRow = []; + const {questionTypeIndex, topicIndex, tagsIndex, option1Index, option2Index, option3Index, option4Index, option5Index, option6Index, answerIndex } = indexHeader; if (questionTypeIndex || questionTypeIndex === 0) { dataList[questionTypeIndex].forEach((item, index) => { - if (item && item !== '题型(必填)') { + if (item && item !== '题型(必填)' && index > 2) { const param = { type: questionTypeMap[item], topic: dataList[topicIndex][index], - tags: dataList[tagsIndex][index], + tags: dataList[tagsIndex][index] ? dataList[tagsIndex][index].replace(/\s+/g, ',') : '', optionList: [] }; if (param.type === 'fill') { @@ -335,11 +336,51 @@ export default { param.optionList.push({content:dataList[option6Index][index], correct: dataList[answerIndex][index].includes('F')}); } } - param.id = questionList.length; + // param.id = questionList.length; questionList.push(param); + + if (!param.type || !param.topic || !dataList[option1Index][index] || !dataList[option2Index][index] || !dataList[answerIndex][index]) { + errRow.push(index + 1); + } + if (param.type === 'judge') { + const arr = ['√', '正确', '×', '错误']; + const asJudge = ['A', 'B']; + if (!arr.includes(dataList[option1Index][index]) || !arr.includes(dataList[option2Index][index]) || !asJudge.includes(dataList[answerIndex][index])) { + if (!errRow.includes(index + 1)) { + errRow.push(index + 1); + } + } + } + const asList = ['A', 'B', 'C', 'D', 'E', 'F']; + if (param.type === 'select') { + if (!asList.includes(dataList[answerIndex][index])) { + if (!errRow.includes(index + 1)) { + errRow.push(index + 1); + } + } + } + if (param.type === 'multi') { + if (dataList[answerIndex][index]) { + const list = dataList[answerIndex][index].split(''); + const sortNew = list.sort(function(a, b) { + return a.localeCompare(b); + }); + const fArr = sortNew.filter((item, ii) => { + return !asList.includes(item) || item == sortNew[ii + 1]; + }); + if (!errRow.includes(index + 1) && fArr.length) { + errRow.push(index + 1); + } + } + } } }); } + errInfo = errRow.join(','); + if (errInfo) { + const error = `第${errInfo}行,数据错误,请检查!`; + throw error; + } } that.$store.dispatch('race/setPreTheoryData', questionList).then(() => { that.$router.push({ path: `/teaching/preTheoryImport`}); @@ -347,14 +388,21 @@ export default { that.$message.error('导入题库失败!'); }); } - }; - if (that.rABS) { - reader.readAsArrayBuffer(file); - } else { - reader.readAsBinaryString(file); + } catch (e) { + that.$message.warning('导入错误!' + e); + throw e; } + }; + reader.onerror = function (e) { + throw e; + }; + if (that.rABS) { + reader.readAsArrayBuffer(file); + } else { + reader.readAsBinaryString(file); } - }, 200); + } + // }, 200); } catch (e) { this.$message.error('请根据下载模板导入题目!'); } @@ -386,7 +434,7 @@ export default { exportTemplate() { const wb = XLSX.utils.book_new(); const data1 = [{A: '理论试题导入模板', B: '', C:'', D:'', E:'', F: '', G: '', H: '', I: '', J: '', K: ''}]; - const data2 = [{A: '说明:1、本表表头(第一行到第三行)内容不能修改删除;\n 2、支持批量导入的题型:单选题,多选题,判断题,题型不能自定义,只能按照表格提供的进行录入;\n 3、【判断题】在选项A中可填写√ 或正确,选项B中填写× 或错误,答案填写A或B\n 4、【分类】多个分类项使用空格隔开', B: '', C:'', D:'', E:'', F: '', G: '', H: '', I: '', J: '', K: ''}]; + const data2 = [{A: '说明:1、本表表头(第一行到第三行)内容不能修改删除;\n 2、支持批量导入的题型:单选题,多选题,判断题,题型不能自定义,只能按照表格提供的进行录入;\n 3、【判断题】在选项A中可填写√ 或正确,选项B中填写× 或错误,答案填写A或B\n 4、【标签】多个标签项使用空格隔开', B: '', C:'', D:'', E:'', F: '', G: '', H: '', I: '', J: '', K: ''}]; const data3 = [{A: '序号', B: '题干(必填)', C:'题型(必填)', D:'选项A(必填)', E:'选项B(必填)', F: '选项C', G: '选项D', H: '选项E', I: '选项F', J: '正确答案(必填)', K: '标签'}]; const data = [...data1, ...data2, ...data3]; const mapType = { @@ -421,7 +469,7 @@ export default { H: item.optionList[4] ? item.optionList[4].content : '', I: item.optionList[5] ? item.optionList[5].content : '', J: as, - K: item.tags + K: item.tags ? item.tags.replace(',', ' ') : '' }; data.push(obj); }); diff --git a/static/theoryTemplate/理论试题导入模板.xlsx b/static/theoryTemplate/理论试题导入模板.xlsx index 340b78411a074008b7b9e6fdebbc2b7c3fad250a..242cf9c627342e6ea37ec6c37cd2e6c5b3ca0f3b 100644 GIT binary patch delta 7234 zcmbVRbySqyw+2CJ5ClP5x&{ysBo(AVO1irQ=@wq4bBF;636YZSlFoslyFpMGx<)|y z4&wLye(T=0s7BM8C97!@VgooGZ9M@ErQT6d> zU;3o-;Ym4uw;tM_n^~}Jo?<&ihg-a{jkiK)H1=fAo|#;?sFrn5SwZ9V&!2n|h5vn| zvA*$Z9gx%Lw*ONXhf{W6j^UAVeennxt-oq2PneZPh0?r>t( zcaz_Fz`;F__F9;5B$W7_#4JJHz4zbAh^@KXeu(rP)C#;GyBhKr7j&_GgwH?7*DY#= z<44SVve?%&#IkdD73O5;7Pw~^DR2kFQlX*h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2V-7_n z1NM&;RXSwRZL*LObp~E3N4?zl5K7h|@E|r2=#ji)M~eXrh=PfP?F7Yo+d^KsXgN}B zhr?dTqVMXIbh+8@`O>w{LcXRHe;;wdFCyrqw(>&iPUq(YA{i>9+eF>NLooY62uz8n z6nWFHL7htkYSRxJ6+fZDYp_2_Ci0@wV3KDOF&?0Qp=vjxbH`%C|K3o0lnWkE%J@h+ zRK(rrwcXMfUXR*Gky>)fGS&AG?eX`sdv?y2Oryv2q|<1O%?J_mbCIxrXy9wbjQwU)KzQS~ z;$1I++VJt8BT&&Ma@DfBnkL8J-k;_!F_w9cJoEMA37r?2lodepo|Aj|64-=n2eC4XD$uEXjUv_9mrNORey=|A*%uL<6#zizD^H)(ml2}i! zZ(53bM~ff&QS4G&_9XZOZULZ|^UPRJP^k!83btK$FE=o%OYCw(M1HhsR8JzzXd>3l-P^2s7LJv0bSA<B*GB zulzXjkjr+Uj3cHmI>Tj(P;mP!)@!;rwq9Pc*E(#t)XBw}|310Mda%l`b3^g_v4^$4 zRxc;ALaqf@DFG?|1_{uHU%;b=_xa=jD$6-Y@c`6!6?x5lRp zX9^Z^GCkGd&(OE3kcMhjbDbKIF)k zm=~H;ztU1CKQcfWTM9dVP2M2=*-}jGS2W<HfG)i3RshfAbI35x?*J zRxkYZyv-F?jSFKFDxxujm0b$43*yMmi})Lo%??4iyNrVfaKI38AvYWXNP;X7Q1PY5K4lZpJ#zdK9>gd|-A1gtv{{<+8BL0UOQ i5Tzj(oC1h;kf&Tyh*l5}F4Mm^RpVUJ502RGqW=%-Jr!~Q From 2754e14bfffcf470aab5f74afc6083c21886d680 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 19 Oct 2022 18:46:22 +0800 Subject: [PATCH 2/3] =?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/preImport.vue | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/views/competitionManage/bankList/preImport.vue b/src/views/competitionManage/bankList/preImport.vue index 679fdec12..5485412e5 100644 --- a/src/views/competitionManage/bankList/preImport.vue +++ b/src/views/competitionManage/bankList/preImport.vue @@ -153,6 +153,43 @@ export default { this.handlePreDataPaging(); }, doSave() { + const nameList = []; + const repetList = []; + const mapType = { + select: '单选题', + multi: '多选题', + judge: '判断题', + fill: '填空题', + answer: '问答题' + }; + this.$store.state.race.preTheoryData.forEach(item => { + const strName = `【${mapType[item.type]}】${item.topic}`; + if (nameList.includes(strName)) { + repetList.push(strName); + } else { + nameList.push(strName); + } + }); + if (repetList.length) { + const test = `以下题目重复,是否继续提交?`; + const messageData = [test]; + const h = this.$createElement; + repetList.forEach(item => { + messageData.push(h('p', null, item)); + }); + this.$confirm('有题目重复,是否继续提交?', '提 示', { + message: h('div', null, messageData), + confirmButtonText: '确 定', + cancelButtonText: '取 消', + type: 'warning' + }).then(() => { + this.submitData(); + }).catch( () => {}); + } else { + this.submitData(); + } + }, + submitData() { this.loading = true; let selectNum = 0; let judgeNum = 0; @@ -178,7 +215,6 @@ export default { break; } }); - // importQuestionBand(this.$store.state.race.preTheoryData, this.companyId).then(resp => { importQuestion(this.$store.state.race.preTheoryData).then(resp => { this.$store.dispatch('race/setPreTheoryData', []); // this.$message.success('导入题库成功!'); From b06248a366f14de98409436a26f9dd8078232669 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Thu, 20 Oct 2022 10:17:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=90=86=E8=AE=BA=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B8=85=E7=A9=BA=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/questionBank.js | 8 ++++++++ .../competitionManage/bankList/index.vue | 20 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/api/questionBank.js b/src/api/questionBank.js index c5de0f8cf..096484cbc 100644 --- a/src/api/questionBank.js +++ b/src/api/questionBank.js @@ -83,3 +83,11 @@ export function testAnswer(questionId, data) { data }); } + +// 清空题库 +export function clearBank() { + return request({ + url: `/api/question/org/clear`, + method: 'get' + }); +} diff --git a/src/views/competitionManage/bankList/index.vue b/src/views/competitionManage/bankList/index.vue index 9a31a89f0..ea695eb14 100644 --- a/src/views/competitionManage/bankList/index.vue +++ b/src/views/competitionManage/bankList/index.vue @@ -8,7 +8,7 @@