Commit a7842ea0 by 宋珺琪

解决多选验证问题

parent f8fc024d
...@@ -517,10 +517,17 @@ export default { ...@@ -517,10 +517,17 @@ export default {
}) })
} else if (this.optionValue == "多选题") { } else if (this.optionValue == "多选题") {
//正确答案 //正确答案
const truwAnswer = this.reduceAnswer.rightAnswer.replace(/\s/g, "") const arr = this.reduceAnswer.rightAnswer.split(", ");
//选中的 //选中的
const result = this.checkList.map(number => String.fromCharCode(64 + parseInt(number, 10))).join(","); const letterArray = this.checkList.map(number => String.fromCharCode(64 + parseInt(number, 10)).toUpperCase());
if (result == truwAnswer) { console.log(arr)
console.log(letterArray)
// 对两个数组进行排序,并将其转换为字符串
const str1 = arr.sort().join("");
const str2 = letterArray.sort().join("");
console.log(str1)
console.log(str2)
if (str1 === str2) {
console.log("回答正确") console.log("回答正确")
finalScore = this.reduceAnswer.score finalScore = this.reduceAnswer.score
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment