| | |
| | | " |
| | | >完成考试 {{ time }}</el-button |
| | | > --> |
| | | <el-button |
| | | type="success" |
| | | @click="submitExam" |
| | | :disabled="subjectIndex != 60" |
| | | >完成考试 {{ time }}</el-button |
| | | > |
| | | <el-button type="success" @click="submitExam" |
| | | >完成考试 {{ time }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | v-for="(value, index) in subjectIds" |
| | | :style="{ background: value.color, color: value.fontColor }" |
| | | :key="index" |
| | | @click="toSubject(value.everyID, value.type, index)" |
| | | > {{ index + 1 }} </el-button |
| | | > |
| | | <!-- @click="toSubject(value.everyID, value.type, index)" --> |
| | | </el-row> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | messageSuccess, |
| | | messageFail, |
| | | messageWarn, |
| | | isNotEmpty, |
| | | isNotEmpty |
| | | } from "@/util/util"; |
| | | import Tinymce from "@/components/Tinymce"; |
| | | import Choices from "@/components/Subjects/Choices"; |
| | |
| | | Choices, |
| | | MultipleChoices, |
| | | PracticalOperation, |
| | | Judgement, |
| | | Judgement |
| | | // ShortAnswer, |
| | | }, |
| | | data() { |
| | |
| | | examRecordId: undefined, |
| | | subjectId: undefined, |
| | | userId: undefined, |
| | | type: 0, |
| | | type: 0 |
| | | }, |
| | | subject: {}, |
| | | answer: "", |
| | |
| | | |
| | | remark: "全国计算机统考练习题10道", |
| | | |
| | | newRecord: false, |
| | | newRecord: false |
| | | }, |
| | | firstFlag: true, |
| | | times: ["30", "00"], |
| | |
| | | timeOTiv: null, |
| | | timesIT: true, |
| | | timesITValue: 0, |
| | | first: true, |
| | | first: true |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapState({ |
| | | userInfo: (state) => state.user.userInfo, |
| | | scoreId: (state) => |
| | | userInfo: state => state.user.userInfo, |
| | | scoreId: state => |
| | | state.exam.scoreId |
| | | ? state.exam.scoreId |
| | | : window.localStorage.getItem("scoreId"), |
| | | : window.localStorage.getItem("scoreId") |
| | | }), |
| | | time() { |
| | | var d = [+this.times[0], +this.times[1]]; |
| | | }, |
| | | } |
| | | }, |
| | | created() { |
| | | var useInfo = this.$store.state.exam.examUserData; |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | countDownS_cb: function () { |
| | | countDownS_cb: function() { |
| | | // console.log(12456); |
| | | messageSuccess(this, "考试开始"); |
| | | this.startTime = this.getCurrentTimes(); |
| | | }, |
| | | countDownE_cb: function () { |
| | | countDownE_cb: function() { |
| | | messageWarn(this, "考试结束"); |
| | | // this.disableSubmit = true; |
| | | // this.submitExam("over"); |
| | |
| | | bottonControl(time) { |
| | | //倒计时循环 |
| | | let times = time * 60; |
| | | var setTime = function (time) { |
| | | var setTime = function(time) { |
| | | let a, b, d; |
| | | a = parseInt(time / 60); |
| | | b = time - a * 60; |
| | |
| | | return d; |
| | | }; |
| | | if (this.timeOTiv == null) { |
| | | this.timeOTiv = setInterval((res) => { |
| | | this.timeOTiv = setInterval(res => { |
| | | times--; |
| | | this.timesITValue = setTime(times); |
| | | }, 1000); |
| | | } else { |
| | | clearTimeout(this.timeOTiv); |
| | | this.timeOTiv = null; |
| | | this.timeOTiv = setInterval((res) => { |
| | | this.timeOTiv = setInterval(res => { |
| | | times--; |
| | | this.timesITValue = setTime(times); |
| | | }, 1000); |
| | | } |
| | | //倒计时定时 |
| | | if (this.timeOut == null) { |
| | | this.timeOut = setTimeout((res) => { |
| | | this.timeOut = setTimeout(res => { |
| | | this.timesIT = false; |
| | | this.timesITValue--; |
| | | }, time * 3600); |
| | | } else { |
| | | clearTimeout(this.timeOut); |
| | | this.timeOut = null; |
| | | this.timeOut = setTimeout((res) => { |
| | | this.timeOut = setTimeout(res => { |
| | | this.timesIT = false; |
| | | }, time * 3600); |
| | | } |
| | | }, |
| | | validateExamTime() { |
| | | getCurrentTime() |
| | | .then((response) => { |
| | | .then(response => { |
| | | // console.log(response, 7777); |
| | | const currentTime = moment(response.data.data); |
| | | if (currentTime.isAfter(this.exam.endTime)) { |
| | |
| | | // this.endTime = current + 60 * 60 * 1000; |
| | | // } |
| | | if (!this.first) { |
| | | getSubjectRefresh(scoreId).then((obj) => { |
| | | getSubjectRefresh(scoreId).then(obj => { |
| | | const objs = obj.data.data; |
| | | // console.log(objs, "objobjobjobjobjobj"); |
| | | const subjectData = objs.examSubjectChoicesVOSList; |
| | |
| | | score: subjectData[i].score, |
| | | color: "#fff", |
| | | fontColor: "#000", |
| | | title: subjectData[i].subjectName, |
| | | title: subjectData[i].subjectName |
| | | }); |
| | | } |
| | | |
| | |
| | | for (var k = 0; k < ans.length; k++) { |
| | | anw.push({ |
| | | key: k + 1, |
| | | value: ans[k], |
| | | value: ans[k] |
| | | }); |
| | | } |
| | | this.subjectIds[i].answer = anw; |
| | |
| | | //适应时间 |
| | | const datyTime = objs.examScore.examTime; |
| | | // console.log(objs, "datyTimedatyTimedatyTime"); |
| | | var duibiTime = function (newTime, oldTime) { |
| | | var duibiTime = function(newTime, oldTime) { |
| | | var newYear = newTime.split(" ")[0], |
| | | newDat = newTime.split(" ")[1], |
| | | oldYear = oldTime.split(" ")[0], |
| | |
| | | let newD = { |
| | | s: +newDat.split(":")[0], |
| | | f: +newDat.split(":")[1], |
| | | m: +newDat.split(":")[2], |
| | | m: +newDat.split(":")[2] |
| | | }; |
| | | let oldD = { |
| | | s: +oldDat.split(":")[0], |
| | | f: +oldDat.split(":")[1], |
| | | m: +oldDat.split(":")[2], |
| | | m: +oldDat.split(":")[2] |
| | | }; |
| | | if (newD.s - oldD.s > 1) { |
| | | return false; |
| | |
| | | // 获取题目ID列表 |
| | | // console.log("subjectResponsesubjectResponsesubjectResponse"); |
| | | getSubjectIds(scoreId) |
| | | .then((subjectResponse) => { |
| | | .then(subjectResponse => { |
| | | const subjectData = subjectResponse.data.data; |
| | | // console.log( |
| | | // subjectResponse, |
| | |
| | | answer: "", |
| | | score: subjectData[i].score, |
| | | color: "#fff", |
| | | fontColor: "#000", |
| | | fontColor: "#000" |
| | | }); |
| | | } |
| | | |
| | |
| | | this.updateSubjectIndex(); |
| | | // 获取当前题目信息 |
| | | getSubjectResultInfo({ |
| | | id: this.subjectIds[0].everyID, |
| | | id: this.subjectIds[0].everyID |
| | | }) |
| | | .then((response) => { |
| | | .then(response => { |
| | | if (isNotEmpty(response.data.data)) { |
| | | response.data.data.answer = ""; |
| | | this.setSubjectInfo(response.data.data); |
| | |
| | | if (this.getAnswer() == "") { |
| | | this.$message({ |
| | | message: "请选择答案", |
| | | type: "warning", |
| | | type: "warning" |
| | | }); |
| | | return; |
| | | } |
| | |
| | | if (!goShiCao) { |
| | | this.$message({ |
| | | message: "实操题目请选择完整顺序!", |
| | | type: "warning", |
| | | type: "warning" |
| | | }); |
| | | return; |
| | | } |
| | |
| | | var str = ""; |
| | | |
| | | if (Array.isArray(answerData)) { |
| | | answerData.forEach((item) => { |
| | | answerData.forEach(item => { |
| | | str += item.value + ","; |
| | | }); |
| | | |
| | |
| | | id: nextSubjectId, |
| | | preSubJectId: this.query.subjectId, |
| | | preResult: answerData, |
| | | scoreId: this.scoreId, |
| | | scoreId: this.scoreId |
| | | }; |
| | | getSubjectResultInfo(data) |
| | | .then((response) => { |
| | | .then(response => { |
| | | if (response.data.data !== null) { |
| | | // 保存成功后更新答题卡状态 |
| | | const subject = response.data.data; |
| | |
| | | } |
| | | |
| | | this.setSubjectInfo(subject); |
| | | // console.log(subject); |
| | | console.log(subject); |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | |
| | | // store.dispatch('SetSubjectInfo', subject).then(() => { }) |
| | | } |
| | | // 更新时间 |
| | | getCurrentTime().then((response) => { |
| | | getCurrentTime().then(response => { |
| | | this.subjectStartTime = moment(response.data.data); |
| | | }); |
| | | this.endLoading(nextType); |
| | | }) |
| | | .catch((error) => { |
| | | .catch(error => { |
| | | console.log(error); |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | messageFail(this, "获取题目失败"); |
| | | this.endLoading(nextType); |
| | | }); |
| | |
| | | this.startLoading(nextType); |
| | | |
| | | var data = { |
| | | id: nextSubjectId, |
| | | id: nextSubjectId |
| | | }; |
| | | getSubjectResultInfo(data) |
| | | .then((response) => { |
| | | .then(response => { |
| | | if (response.data.data !== null) { |
| | | // 保存成功后更新答题卡状态 |
| | | const subject = response.data.data; |
| | |
| | | // store.dispatch('SetSubjectInfo', subject).then(() => { }) |
| | | } |
| | | // 更新时间 |
| | | getCurrentTime().then((response) => { |
| | | getCurrentTime().then(response => { |
| | | this.subjectStartTime = moment(response.data.data); |
| | | }); |
| | | this.endLoading(nextType); |
| | | }) |
| | | .catch((error) => { |
| | | .catch(error => { |
| | | console.log(error); |
| | | messageFail(this, "获取题目失败"); |
| | | this.endLoading(nextType); |
| | |
| | | this.$confirm("确定要提交吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | this.disableSubmit = true; |
| | |
| | | examTime: this.startTime, |
| | | papersId: this.$route.query.id, |
| | | examEndTime: this.getCurrentTimes(), |
| | | examResultVOS: null, |
| | | examResultVOS: null |
| | | }; |
| | | var arr = []; |
| | | console.log(this.subjectIds); |
| | |
| | | if (item.answer.length > 0) { |
| | | //如果是数组 |
| | | if (item.answer instanceof Array) { |
| | | item.answer.forEach((it) => { |
| | | item.answer.forEach(it => { |
| | | if (it.value != "") { |
| | | str += it.value + ","; |
| | | } |
| | |
| | | arr.push({ |
| | | subjectChoicesId: item.everyID, |
| | | value: a, |
| | | grade: item.score, |
| | | grade: item.score |
| | | }); |
| | | } else { |
| | | arr.push({ |
| | | subjectChoicesId: item.everyID, |
| | | value: item.answer, |
| | | grade: item.score, |
| | | grade: item.score |
| | | }); |
| | | } |
| | | } |
| | |
| | | arr.push({ |
| | | subjectChoicesId: item.everyID, |
| | | value: item.answer, |
| | | grade: item.score, |
| | | grade: item.score |
| | | }); |
| | | } |
| | | } |
| | |
| | | // console.log(obj.examResultVOS, 789); |
| | | |
| | | saveAndNext(obj) |
| | | .then((response) => { |
| | | .then(response => { |
| | | messageSuccess(this, "提交成功"); |
| | | if (response) { |
| | | this.$store.commit("DEL_TAG", this.$store.state.tags.tag); |
| | | var obj = { |
| | | userId: this.userInfo.user_id, |
| | | examId: this.$route.query.id, |
| | | examId: this.$route.query.id |
| | | }; |
| | | this.$router.push({ |
| | | path: `/singleperformance/index`, |
| | | query: obj, |
| | | query: obj |
| | | }); |
| | | } |
| | | }) |
| | |
| | | console.error(error); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |