智慧保安考试系统
shuishen
2023-11-07 b6862540422a853ddca486de30382b34ad667b7f
src/views/startexam/index.vue
@@ -548,7 +548,7 @@
        last () {
            for (let i = 0; i < this.subjectIds.length; i++) {
                if (this.subjectIds[i].everyID == this.query.subjectId) {
                    this.subjectIds[i].answer = this.judgeAnswerIfNull(this.subjectIds[i].answer)
                    this.subjectIds[i].answer = this.getAnswer()
                    this.markAnswered(this.subjectIds[i].answer, i)
@@ -575,8 +575,32 @@
        next () {
            for (let i = 0; i < this.subjectIds.length; i++) {
                if (this.subjectIds[i].everyID == this.query.subjectId) {
                    //  if (this.getAnswer() == "") {
                    //   this.$message({
                    //     message: "请选择答案",
                    //     type: "warning",
                    //   });
                    //   return;
                    // }
                    // console.log(this.getAnswer(), this.query.type);
                    if (this.query.type == 3) {
                        let goShiCao = true
                        const answer = this.getAnswer()
                        for (let k in answer) {
                            if (answer[k].value == "") {
                                goShiCao = false
                            }
                        }
                        if (!goShiCao) {
                            this.$message({
                                message: "实操题目请选择完整顺序!",
                                type: "warning"
                            })
                            return
                        }
                    }
                    this.subjectIds[i].answer = this.judgeAnswerIfNull(this.subjectIds[i].answer)
                    this.subjectIds[i].answer = this.getAnswer()
                    this.markAnswered(this.subjectIds[i].answer, i)
@@ -601,7 +625,10 @@
        },
        // 保存当前题目,同时根据序号加载下一题
        saveCurrentSubjectAndGetNextSubject (nextType, nextSubjectId, subjectIds) {
            var answerData = this.judgeAnswerIfNull(subjectIds.answer)
            // console.log(nextType, nextSubjectId, subjectIds, '2222222')
            this.startLoading(nextType)
            var answerData = this.getAnswer()
            var str = ""
@@ -737,7 +764,7 @@
                ind = this.subjectIndex - 1
            }
            this.subjectIds[ind].answer = this.judgeAnswerIfNull(this.subjectIds[ind].answer)
            this.subjectIds[ind].answer = this.getAnswer()
            this.markAnswered(this.subjectIds[ind].answer, ind)
@@ -767,7 +794,7 @@
                ind = this.subjectIndex - 1
            }
            this.subjectIds[ind].answer = this.judgeAnswerIfNull(this.subjectIds[ind].answer)
            this.subjectIds[ind].answer = this.getAnswer()
            this.markAnswered(this.subjectIds[ind].answer, ind)
@@ -874,16 +901,6 @@
        toggleOption (answer) {
            this.answer = answer
        },
        // 根据答案是否为空决定使用哪个答案
        judgeAnswerIfNull (val) {
            if (this.getAnswer() == '') {
                return val
            } else {
                return this.getAnswer()
            }
        },
        // 根据题目类型返回填写的答案
        getAnswer () {
            const ref = this.getSubjectRef()