代码调整

This commit is contained in:
dong 2022-10-19 18:46:22 +08:00
parent 0d6f6dda1c
commit 2754e14bff

View File

@ -153,6 +153,43 @@ export default {
this.handlePreDataPaging(); this.handlePreDataPaging();
}, },
doSave() { 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; this.loading = true;
let selectNum = 0; let selectNum = 0;
let judgeNum = 0; let judgeNum = 0;
@ -178,7 +215,6 @@ export default {
break; break;
} }
}); });
// importQuestionBand(this.$store.state.race.preTheoryData, this.companyId).then(resp => {
importQuestion(this.$store.state.race.preTheoryData).then(resp => { importQuestion(this.$store.state.race.preTheoryData).then(resp => {
this.$store.dispatch('race/setPreTheoryData', []); this.$store.dispatch('race/setPreTheoryData', []);
// this.$message.success('!'); // this.$message.success('!');