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: [],
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(',')
}
})
}