From b32b3519a4915e4d98c1fe9330e0df457d57f586 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Wed, 4 Sep 2024 10:37:11 +0800
Subject: [PATCH] fix
---
src/api/index.js | 4 +-
src/pages/ques/detail/index.vue | 2 +-
src/pages/ques/list/index.vue | 80 ++++++++++++++++++++-------
src/pages/testPaper/detail/index.vue | 37 ++++++-------
src/pages/testPaper/preview/index.vue | 18 +++---
src/styles/common.scss | 29 ++++++++++
6 files changed, 118 insertions(+), 52 deletions(-)
diff --git a/src/api/index.js b/src/api/index.js
index 652bad8..643cdf2 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -63,7 +63,6 @@ export default {
findQuestion: `/exam/exam/questions/findById`,
listQuestion: `/exam/exam/questions/pagingQuery`,
updateQuestion: `/exam/exam/questions/updateQuestion`,
- batchImportQuestions: `${host}/exam/exam/questions/batchImportQuestions`,
checkQuestion: `/exam/exam/questions/checkQuestion`,
delQuestion: `/exam/exam/questions/batchDeletion`,
checkQuestionIsUse: `/exam/exam/questions/checkQuestionIsUse`,
@@ -73,4 +72,7 @@ export default {
findAllByQuestionBank: `/exam/exam/questions/findAllByQuestionBank`,
selectQuestionsByTypeAndDifficulty: `/exam/exam/questions/selectQuestionsByTypeAndDifficulty`,
removeQuestionKnowledge: `/exam/exam/questions/removeQuestionKnowledge`,
+ batchImportQuestions: `${host}/exam/exam/questions/batchImportQuestions`,
+ downloadQuesExcel: `${host}/exam/exam/questions/downloadExcel`,
+ batchImportQuesFailure: `${host}/exam/exam/questions/exportFailure`,
}
\ No newline at end of file
diff --git a/src/pages/ques/detail/index.vue b/src/pages/ques/detail/index.vue
index 390abbf..1062a95 100644
--- a/src/pages/ques/detail/index.vue
+++ b/src/pages/ques/detail/index.vue
@@ -85,7 +85,7 @@
选项{{
numToLetter(i)
}}
-
+ 部分数据导入失败,查看失败原因
+
+
@@ -209,6 +242,7 @@ import Breadcrumb from '@/components/breadcrumb'
import Detail from '../detail'
import Const from '@/const/ques'
import Qs from 'qs'
+import axios from 'axios'
export default {
components: { Breadcrumb, Detail },
data () {
@@ -600,8 +634,12 @@ export default {
this.uploadFaild = false
},
// 模板下载
- download () {
- location.href = this.api[this.info.completeCompetitionSetup.competitionType ? 'competionTeamTemplate' : 'competionPersonTemplate']
+ async download () {
+ const res = await axios.get(this.api.downloadQuesExcel, {
+ headers: this.headers,
+ responseType: 'blob'
+ })
+ Util.downloadFileDirect('批量导入试题模板.xlsx', new Blob([res.data]))
},
// 上传文件
handleExceed (files, fileList) {
@@ -611,31 +649,31 @@ export default {
},
// 下载失败文件
showFaild () {
- axios.get(`${this.api.TeamDataExportFailure}?exportCode=${this.exportCode}&platformId=2&type=${this.info.completeCompetitionSetup.competitionType ? 1 : 2}`, {
+ axios.get(`${this.api.batchImportQuesFailure}?exportCode=${this.exportCode}`, {
headers: this.headers,
responseType: 'blob'
}).then((res) => {
const name = res.headers['content-disposition']
- Util.downloadFileDirect(name ? decodeURI(name) : '批量导入报名人员失败数据导出.xlsx', new Blob([res.data]))
+ Util.downloadFileDirect(name ? decodeURI(name) : '批量导入题目管理失败数据导出.xlsx', new Blob([res.data]))
}).catch(res => { })
},
- uploadSuccess ({ data, status }) {
+ uploadSuccess ({ data, status, message }) {
this.uploading = false
this.uploadFaild = false
this.uploadTips = ''
if (status === 200) {
- this.init()
- const { tip } = data
+ // this.init()
+ // const { tip } = data
if (data.exportCode) {
this.exportCode = data.exportCode
this.uploadFaild = true
- this.uploadTips = tip
+ // this.uploadTips = tip
} else {
- Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000)
- this.importVisible = false
+ // Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000)
+ // this.importVisible = false
}
} else {
- Util.errorMsg(res.message || '上传失败,请检查数据', 3000)
+ Util.errorMsg(message || '上传失败,请检查数据', 3000)
}
},
uploadError (err, file, fileList) {
diff --git a/src/pages/testPaper/detail/index.vue b/src/pages/testPaper/detail/index.vue
index 1ce8048..f4bac76 100644
--- a/src/pages/testPaper/detail/index.vue
+++ b/src/pages/testPaper/detail/index.vue
@@ -236,7 +236,7 @@
第{{ arabicToChinese(i + 1) }}大题 |
{{ item.examQuestions.length }}/{{ item.questionNum }} |
- {{ item.examQuestions.reduce((e, j) => (e += +j.score), 0) || 0 }}/{{ item.targetScore }} |
+ {{ getQuesAlreadyScore(item) }}/{{ item.targetScore }} |
总计 |
@@ -428,6 +428,7 @@ export default {
})
}
})
+ console.log("🚀 ~ overview ~ alreadyScore:", alreadyScore, totalScore)
return {
questionCount,
alreadyQuesCount,
@@ -711,6 +712,14 @@ export default {
}
} catch (e) { }
},
+ getQuesAlreadyScore (item) {
+ let total = 0
+ item.examQuestions.forEach(e => {
+ total = Decimal(total).add(+e.score).toNumber()
+ })
+ item.curQuesTotalScore = total
+ return total
+ },
// 填空题分数输入回调
fillScoreChange (ques) {
let total = 0
@@ -955,11 +964,13 @@ export default {
invalid = 1
break
}
- } else if (+e.targetScore !== e.examQuestions.reduce((e, j) => (e += +j.score), 0)) {
- // 该大题里的小题总分需等于目标分值
- Util.warningMsg(`第${chineseNum}大题的小题总分跟目标分值不一致,请重新修改`)
- invalid = 1
- break
+ } else {
+ if (+e.targetScore !== e.curQuesTotalScore) {
+ // 该大题里的小题总分需等于目标分值
+ Util.warningMsg(`第${chineseNum}大题的小题总分跟目标分值不一致,请重新修改`)
+ invalid = 1
+ break
+ }
}
// 试题里存在被禁用或者被删除的,不予提交
@@ -1220,20 +1231,6 @@ export default {
border-radius: 2px;
}
- /deep/.html-parse {
- table {
- display: table;
- margin-bottom: 10px;
- border-collapse: collapse;
-
- th,
- td {
- padding: 5px 10px;
- border: 1px solid #DDD;
- }
- }
- }
-
.stem {
margin-bottom: 10px;
}
diff --git a/src/pages/testPaper/preview/index.vue b/src/pages/testPaper/preview/index.vue
index 572a55f..5f8e898 100644
--- a/src/pages/testPaper/preview/index.vue
+++ b/src/pages/testPaper/preview/index.vue
@@ -24,7 +24,7 @@
-
{{ arabicToChinese(i + 1) }}、{{ item.questionTypeName }}(本题共{{ item.questionNum }}小题,共{{
+ {{ arabicToChinese(i + 1) }}、{{ item.outlineName }}(本题共{{ item.questionNum }}小题,共{{
item.targetScore }}分)
@@ -51,7 +51,7 @@
-
- {{ arabicToChinese(i + 1) }}、{{ item.questionTypeName }}(本题共{{ item.questionNum }}小题,共{{
+ {{ arabicToChinese(i + 1) }}、{{ item.outlineName }}(本题共{{ item.questionNum }}小题,共{{
item.targetScore }}分)
@@ -63,7 +63,7 @@
{{ j + 1 }} / {{ item.questionNum }}
{{ item.questionTypeName }}
-
+
({{ ques.score }}分)
@@ -79,24 +79,24 @@
@change="singleChange(ques, j)">
{{ numToLetter(j) }}.
-
+
- {{ ques.stemAttachment
+ {{ ques.fileName
+ || ques.stemAttachment
}}
下载
essayAnswerReady(editor, ques)" />
-
-
-
+
+
上传文件
diff --git a/src/styles/common.scss b/src/styles/common.scss
index 59539bd..ba557cf 100644
--- a/src/styles/common.scss
+++ b/src/styles/common.scss
@@ -457,4 +457,33 @@
line-height: 28px;
}
}
+}
+.html-parse {
+ table {
+ display: table;
+ margin-bottom: 10px;
+ border-collapse: collapse;
+
+ th,
+ td {
+ padding: 5px 10px;
+ border: 1px solid #DDD;
+ }
+ }
+
+ ol {
+ padding-left: 30px;
+
+ li {
+ list-style-type: decimal;
+ }
+ }
+
+ ul {
+ padding-left: 30px;
+
+ li {
+ list-style-type: disc;
+ }
+ }
}
\ No newline at end of file