From d23eb7394824e9e16c3565f57bd3bffe0393a0b2 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Mon, 20 Feb 2023 10:37:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppExaminationManage/components/Add.vue | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/project/qujing/app/AppExaminationManage/components/Add.vue b/project/qujing/app/AppExaminationManage/components/Add.vue index 9959cf28..1b8503f5 100644 --- a/project/qujing/app/AppExaminationManage/components/Add.vue +++ b/project/qujing/app/AppExaminationManage/components/Add.vue @@ -207,7 +207,8 @@ ], tableData: [], isShow: false, - ids: [] + ids: [], + sort: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'] } }, @@ -236,7 +237,21 @@ getInfo (id) { this.instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res => { if (res.code === 0) { - this.form = res.data + this.form = { + ...res.data, + questions: res.data.questions.map(v => { + let answer = [] + v.items.forEach((e, index) => { + if (e.checked === '1') { + answer.push(this.sort[index]) + } + }) + return { + ...v, + answer: answer.join(',') + } + }) + } } }) }, @@ -252,7 +267,18 @@ this.instance.post(`/app/appquestionbank/queryDetailByIds`, this.ids).then(res => { if (res.code == 0) { - this.form.questions = res.data + this.form.questions = res.data.map(v => { + let answer = [] + v.items.forEach((e, index) => { + if (e.checked === '1') { + answer.push(this.sort[index]) + } + }) + return { + ...v, + answer: answer.join(',') + } + }) this.isShow = false } @@ -260,7 +286,6 @@ }, getList() { - console.log(this.search) this.instance.post(`/app/appquestionbank/list`, null, { params: { ...this.search @@ -296,9 +321,15 @@ this.instance.post(`/app/appquestionbank/randomChoose`, this.form.subjectConfigs).then(res => { if (res.code == 0) { this.form.questions = res.data.map(v => { + let answer = [] + v.items.forEach((e, index) => { + if (e.checked === '1') { + answer.push(this.sort[index]) + } + }) return { ...v, - answer: v.items.filter(v => v.checked === '1').map(v => v.content).join(',') + answer: answer.join(',') } }) }