|
@@ -223,18 +223,24 @@
|
|
|
this.errorList = []
|
|
|
this.$refs.testPaper.$refs.exList.errorList = []
|
|
|
this.evaluationInfo.item = []
|
|
|
- let importList = await this.refreshImportItems(list)
|
|
|
- this.evaluationInfo.item = importList
|
|
|
- this.activeTab = 'preview'
|
|
|
- console.log(this.evaluationInfo)
|
|
|
- if (this.errorList.length) {
|
|
|
- this.$EventBus.$emit('importFinish', this.errorList)
|
|
|
+ try{
|
|
|
+ let importList = await this.refreshImportItems(list)
|
|
|
+ this.evaluationInfo.item = importList
|
|
|
+ this.activeTab = 'preview'
|
|
|
+ this.$Message.success(this.$t('evaluation.importFile.warningTips3'))
|
|
|
+ console.log(this.evaluationInfo)
|
|
|
+ if (this.errorList.length) {
|
|
|
+ this.$EventBus.$emit('importFinish', this.errorList)
|
|
|
+ }
|
|
|
+ }catch(e){
|
|
|
+ this.$Message.error(this.$t('evaluation.importFile.warningTips5'))
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/* 给导入的试题 补充最新的试卷学段年级以及科目信息 */
|
|
|
refreshImportItems(list) {
|
|
|
- return new Promise((r, j) => {
|
|
|
+ return new Promise((r, reject) => {
|
|
|
let objectiveTypes = ['single', 'multiple']
|
|
|
let code = this.isSchool ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
|
|
|
let gradeIds = this.isSchool ? this.evaluationInfo.paperGrade.length ? this.evaluationInfo.paperGrade : this.gradeList
|
|
@@ -270,9 +276,10 @@
|
|
|
})
|
|
|
}
|
|
|
// 如果导入的是客观题 则需要检测答案与选项是否为空
|
|
|
- if (objectiveTypes.includes(i.type) && (!i.question.replace(/\s*/g, "") || !i.option.length || !i.answer.length ||
|
|
|
- !i.option || !i.answer)) {
|
|
|
+ if (objectiveTypes.includes(i.type) && (!i.question.replace(/\s*/g, "") || !i.option || !i.answer ||
|
|
|
+ !i.option.length || !i.answer.length)) {
|
|
|
this.errorList.push(i)
|
|
|
+ reject(500)
|
|
|
}
|
|
|
}
|
|
|
r(list)
|