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] =?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('导入题库成功!');