diff --git a/package-lock.json b/package-lock.json index e8056be..575dea3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3885,6 +3885,11 @@ "randomfill": "^1.0.3" } }, + "crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, "css": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", @@ -9561,6 +9566,11 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "jsencrypt": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/jsencrypt/-/jsencrypt-3.3.2.tgz", + "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==" + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", diff --git a/package.json b/package.json index 7ba9c5b..9c38cce 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "ali-oss": "^6.20.0", "axios": "^0.18.0", "babel-polyfill": "^6.26.0", + "crypto-js": "^4.2.0", "dayjs": "^1.11.12", "decimal.js": "^10.4.3", "echarts": "^4.8.0", @@ -19,6 +20,7 @@ "element-ui": "^2.13.0", "image-conversion": "^2.1.1", "js-cookie": "^2.2.1", + "jsencrypt": "^3.3.2", "lodash": "^4.17.21", "mavon-editor": "^2.6.17", "postcss-px2rem": "^0.3.0", diff --git a/public/index.html b/public/index.html index 33f4e2a..3b643d2 100644 --- a/public/index.html +++ b/public/index.html @@ -13,9 +13,13 @@
- + + + + + diff --git a/src/api/index.js b/src/api/index.js index 419284d..27aff70 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -2,6 +2,7 @@ import Setting from '@/setting' const { apiBaseURL: host } = Setting export default { + encrypt: `/nakadai/data/encrypt`, queryProfessional: `/exam/exam/professional/queryProfessional`, categoriesDel: `/exam/question/bank/categories/batchDeletion`, diff --git a/src/components/upload/config.js b/src/components/upload/config.js index 503fd7c..04818ef 100644 --- a/src/components/upload/config.js +++ b/src/components/upload/config.js @@ -1,15 +1,41 @@ /** * 阿里云oss配置 * */ +import { get } from '@/plugins/requests/index.js' +import api from '@/api' +import CryptoJS from 'crypto-js' +import JSEncrypt from 'jsencrypt' -export default { - // oss账号信息 - config: { - region: 'oss-cn-shenzhen', - accessKeyId: 'LTAI4FzqQHnk4rozqLZ8jCNj', - accessKeySecret: 'mveW7B1OyFoKUkHm8WsxmrjHmkJWHq', - bucket: 'huoran' - }, - // 上传成功url前置部分(成功回调没有返回url) - preUrl: 'https://huoran.oss-cn-shenzhen.aliyuncs.com/' +const A = (key, encryptedData) => { + const keyHex = CryptoJS.enc.Base64.parse(key) + const decrypted = CryptoJS.AES.decrypt(encryptedData, keyHex, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }) + return decrypted.toString(CryptoJS.enc.Utf8) +} + +const R = (encryptedKey, privateKey) => { + const decrypt = new JSEncrypt() + decrypt.setPrivateKey(privateKey) + const decryptedKey = decrypt.decrypt(encryptedKey) + return decryptedKey +} + +export default async function () { + try { + const res = await get(api.encrypt) + const RE = A(R(res.encryptedKey, res.privateKey), res.encryptedData).split('/') + return { + // oss账号信息 + config: { + region: 'oss-cn-shenzhen', + accessKeyId: RE[0], + accessKeySecret: RE[1], + bucket: 'huoran' + }, + // 上传成功url前置部分(成功回调没有返回url) + preUrl: 'https://huoran.oss-cn-shenzhen.aliyuncs.com/' + } + } catch (e) { } } \ No newline at end of file diff --git a/src/components/upload/index.vue b/src/components/upload/index.vue index 6308e1f..dd7087d 100644 --- a/src/components/upload/index.vue +++ b/src/components/upload/index.vue @@ -1,5 +1,5 @@
-
【正确答案】:A
+
+ 【{{ ques.questionType === 'essay' ? '参考答案' : '正确答案' }}】: +
+
排序 @@ -312,6 +315,12 @@ export default { }) const r = res.examPaper const paper = r.paperOutline + paper.map(e => { + e.examQuestions.map(n => { + Object.assign(n, n.question) + }) + + }) if (r.particularYear) r.particularYear = r.particularYear + '' this.form = r // this.answerAnalysis = opts[0].answerAnalysis @@ -395,7 +404,7 @@ export default { data.avgValueList.map((e, i) => { // scores里有-1则不用循环 e.scores.includes(-1) || e.scores.map((n, j) => { - paper[i].examQuestions[j].score = n + this.$set(paper[i].examQuestions[j], 'score', n) }) }) @@ -405,6 +414,17 @@ export default { showAuto () { this.autoVisible = true }, + // 处理正确答案的显示 + getCorrectAnswer (e) { + if (e.questionType === 'fill_blank') { // 填空题 + // return e.questionAnswerVersionsList.filter(e => e.answerIsCorrect) + } else if (e.questionType === 'essay') { // 问答题取参考答案 + return e.questionAnswerVersionsList[0].referenceAnswer + } else { + const correct = e.questionAnswerVersionsList.filter(e => e.answerIsCorrect) + return correct ? (e.questionType === 'judgement' ? correct[0].optionText : correct.map(e => Util.numToLetter(e.optionNumber - 1)).join('')) : '' + } + }, // 添加题目 showManualDia (item, i, ques) { this.curType = item @@ -497,6 +517,7 @@ export default { break } } + debugger if (invalid) return false this.submiting = true @@ -516,7 +537,6 @@ export default { } }) }) - debugger if (typeof form.classificationId === 'object') form.classificationId = form.classificationId[form.classificationId.length - 1] form.questionType = [...new Set(paper.map(e => e.questionType))].join('、') form.createSource = 1 @@ -638,6 +658,7 @@ export default { } .correct { + display: flex; font-size: 13px; color: #333; } diff --git a/src/pages/testPaper/detail/manual.vue b/src/pages/testPaper/detail/manual.vue index 83d6963..f3c0f39 100644 --- a/src/pages/testPaper/detail/manual.vue +++ b/src/pages/testPaper/detail/manual.vue @@ -159,6 +159,7 @@ export default { const { list } = await this.$post(this.api.questionBankStructureLevel, { keyword: this.quesBankKeyword, createSource: 1, + status: 1, }) this.quesBanks = list } catch (e) { } @@ -309,7 +310,6 @@ export default { this.$set(e, 'score', '') this.$set(e, 'questionVersionId', e.questionId) }) - // debugger if (curQues) { // curQues即是小题,有则说明是更换试题,需要把该小题去掉,再添加进选中的试题 diff --git a/src/pages/testPaperLibrary/index.vue b/src/pages/testPaperLibrary/index.vue index bf5e46d..d909efd 100644 --- a/src/pages/testPaperLibrary/index.vue +++ b/src/pages/testPaperLibrary/index.vue @@ -26,7 +26,7 @@
筛选
- +
  • @@ -104,10 +104,10 @@