This commit is contained in:
yanran200730
2023-02-20 10:37:04 +08:00
parent 403dfeb725
commit d23eb73948

View File

@@ -207,7 +207,8 @@
], ],
tableData: [], tableData: [],
isShow: false, isShow: false,
ids: [] ids: [],
sort: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
} }
}, },
@@ -236,7 +237,21 @@
getInfo (id) { getInfo (id) {
this.instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res => { this.instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) { 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 => { this.instance.post(`/app/appquestionbank/queryDetailByIds`, this.ids).then(res => {
if (res.code == 0) { 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 this.isShow = false
} }
@@ -260,7 +286,6 @@
}, },
getList() { getList() {
console.log(this.search)
this.instance.post(`/app/appquestionbank/list`, null, { this.instance.post(`/app/appquestionbank/list`, null, {
params: { params: {
...this.search ...this.search
@@ -296,9 +321,15 @@
this.instance.post(`/app/appquestionbank/randomChoose`, this.form.subjectConfigs).then(res => { this.instance.post(`/app/appquestionbank/randomChoose`, this.form.subjectConfigs).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.form.questions = res.data.map(v => { this.form.questions = res.data.map(v => {
let answer = []
v.items.forEach((e, index) => {
if (e.checked === '1') {
answer.push(this.sort[index])
}
})
return { return {
...v, ...v,
answer: v.items.filter(v => v.checked === '1').map(v => v.content).join(',') answer: answer.join(',')
} }
}) })
} }