|
@@ -1,10 +1,12 @@
|
|
-import { ref } from "vue";
|
|
|
|
|
|
+import { ref, watch } from "vue";
|
|
import dayjs from "dayjs";
|
|
import dayjs from "dayjs";
|
|
import Api from '@/api/api';
|
|
import Api from '@/api/api';
|
|
import router from "@/router/"
|
|
import router from "@/router/"
|
|
import store from "@/store/"
|
|
import store from "@/store/"
|
|
|
|
|
|
export function useExamTest() {
|
|
export function useExamTest() {
|
|
|
|
+ let letter = ["A", "B", "C", "D", "E", "F"]
|
|
|
|
+ let correctAnswerVisible = ref(false)
|
|
let list = ref<selectTestQuestionInfo.row[]>([
|
|
let list = ref<selectTestQuestionInfo.row[]>([
|
|
{
|
|
{
|
|
createTime: '2021-11-05 10:25:51',
|
|
createTime: '2021-11-05 10:25:51',
|
|
@@ -432,6 +434,52 @@ export function useExamTest() {
|
|
let errorScore = ref(0)
|
|
let errorScore = ref(0)
|
|
let beforeSubmitVisible = ref(false)
|
|
let beforeSubmitVisible = ref(false)
|
|
let submitVisible = ref(false)
|
|
let submitVisible = ref(false)
|
|
|
|
+ let wrongQuestion = ref<selectTestQuestionInfo.row>({
|
|
|
|
+ createTime: "2021-11-05 10:25:51",
|
|
|
|
+ id: 20,
|
|
|
|
+ image: null,
|
|
|
|
+ imageYdt: null,
|
|
|
|
+ answer: "√",
|
|
|
|
+ answerkeyword: null,
|
|
|
|
+ explainGif: "https://t1-1305573081.file.myqcloud.com/qb/gif/20.gif",
|
|
|
|
+ explainJq: "题目中看到“追究”.答对;“不追究”.答错。",
|
|
|
|
+ explainJs:
|
|
|
|
+ "《道路交通安全法》第九十九条:未取得机动车驾驶证、机动车驾驶证被吊销或者机动车驾驶证被暂扣期间驾驶机动车的,由公安机关交通管理部门处二百元以上二千元以下罚款,可以并处十五日以下拘留。",
|
|
|
|
+ explainMp3:
|
|
|
|
+ "https://t1-1305573081.file.myqcloud.com/qb/mp3/explain20.mp3",
|
|
|
|
+ issue: "对未取得驾驶证驾驶机动车的,追究其法律责任。",
|
|
|
|
+ opts: "√-×",
|
|
|
|
+ optsArr: ["√", "×"],
|
|
|
|
+ skillkeyword: "追究-答对",
|
|
|
|
+ titlekeyword: "追究",
|
|
|
|
+ issuemp3:
|
|
|
|
+ "https://t1-1305573081.file.myqcloud.com/qb/issue/issue20.mp3",
|
|
|
|
+ answermp3:
|
|
|
|
+ "https://t1-1305573081.file.myqcloud.com/qb/answer/answer20.mp3",
|
|
|
|
+ explainjsmp3:
|
|
|
|
+ "https://t1-1305573081.file.myqcloud.com/qb/explainjs/explainJS20.mp3",
|
|
|
|
+ liceCar: "1",
|
|
|
|
+ liceBus: "1",
|
|
|
|
+ liceTruck: "1",
|
|
|
|
+ liceMoto: "0",
|
|
|
|
+ sequeIssue: "2",
|
|
|
|
+ classIssue: "32",
|
|
|
|
+ placeIssue: "0",
|
|
|
|
+ excellIssue: "1",
|
|
|
|
+ copyIssue: "0",
|
|
|
|
+ mockIssue: "0",
|
|
|
|
+ sequeIssueName: "练习二",
|
|
|
|
+ placeIssueName: null,
|
|
|
|
+ excellIssueName: "必学题一",
|
|
|
|
+ classIssueName: "刑法题",
|
|
|
|
+ questionType: 1,
|
|
|
|
+ subject: 1,
|
|
|
|
+ classSort: 16,
|
|
|
|
+ excellSort: 39,
|
|
|
|
+ sequeSort: 118,
|
|
|
|
+ placeSort: null,
|
|
|
|
+ userAnswer: "",
|
|
|
|
+ })
|
|
|
|
|
|
let submitScore = () => {
|
|
let submitScore = () => {
|
|
//重置为0,不然会有数据不准确的bug
|
|
//重置为0,不然会有数据不准确的bug
|
|
@@ -468,6 +516,81 @@ export function useExamTest() {
|
|
|
|
|
|
}
|
|
}
|
|
let listIndex = ref(0);
|
|
let listIndex = ref(0);
|
|
|
|
+ let wrongQuestionIndex = ref(0)
|
|
|
|
+ watch(listIndex, (newVal, oldVal) => {
|
|
|
|
+ if (newVal !== oldVal) {
|
|
|
|
+ if (list.value[oldVal].questionType == 3) {
|
|
|
|
+ let userAnswerLetter: any[] = [];
|
|
|
|
+ if (
|
|
|
|
+ list.value[oldVal].userAnswer &&
|
|
|
|
+ list.value[oldVal].userAnswer.sort().toString() !==
|
|
|
|
+ list.value[oldVal].answer.split("-").sort().toString()
|
|
|
|
+ ) {
|
|
|
|
+ // this.$set(this.list[oldVal], "isError", true);
|
|
|
|
+ list.value[oldVal].isError = true
|
|
|
|
+ list.value[oldVal].userAnswer.forEach((element: string) => {
|
|
|
|
+ userAnswerLetter.push(
|
|
|
|
+ letter[list.value[oldVal].optsArr.indexOf(element)]
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ list.value[oldVal].userAnswerLetter = userAnswerLetter.sort().join("")
|
|
|
|
+ // this.$set(
|
|
|
|
+ // this.list[oldVal],
|
|
|
|
+ // "userAnswerLetter",
|
|
|
|
+ // userAnswerLetter.sort().join("")
|
|
|
|
+ // );
|
|
|
|
+ correctAnswerVisible.value = true;
|
|
|
|
+ wrongQuestion.value = list.value[oldVal];
|
|
|
|
+ wrongQuestionIndex.value = oldVal;
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ list.value[oldVal].userAnswerLetter = userAnswerLetter.join("")
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ correctAnswerVisible.value = false;
|
|
|
|
+ }
|
|
|
|
+ } else if (list.value[oldVal].questionType < 3) {
|
|
|
|
+ let userAnswerLetter = [];
|
|
|
|
+ if (
|
|
|
|
+ list.value[oldVal].userAnswer &&
|
|
|
|
+ list.value[oldVal].userAnswer !== list.value[oldVal].answer
|
|
|
|
+ ) {
|
|
|
|
+
|
|
|
|
+ list.value[oldVal].userAnswerLetter = letter[
|
|
|
|
+ list.value[oldVal].optsArr.indexOf(list.value[oldVal].userAnswer)
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ list.value[oldVal].isError = true
|
|
|
|
+
|
|
|
|
+ correctAnswerVisible.value = true;
|
|
|
|
+ list.value[oldVal].userAnswerLetter = letter[
|
|
|
|
+ list.value[oldVal].optsArr.indexOf(list.value[oldVal].userAnswer)
|
|
|
|
+ ]
|
|
|
|
+ wrongQuestion.value = list.value[oldVal];
|
|
|
|
+ wrongQuestionIndex.value = oldVal;
|
|
|
|
+ } else {
|
|
|
|
+ correctAnswerVisible.value = false
|
|
|
|
+ list.value[oldVal].userAnswerLetter = letter[
|
|
|
|
+ list.value[oldVal].optsArr.indexOf(list.value[oldVal].userAnswer)
|
|
|
|
+ ]
|
|
|
|
+ // this.$set(
|
|
|
|
+ // this.list[oldVal],
|
|
|
|
+ // "userAnswerLetter",
|
|
|
|
+ // this.letter[
|
|
|
|
+ // this.list[oldVal].optsArr.indexOf(this.list[oldVal].userAnswer)
|
|
|
|
+ // ]
|
|
|
|
+ // );
|
|
|
|
+ // this.correctAnswer = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
|
|
let changeListIndex = (e: PointerEvent) => {
|
|
let changeListIndex = (e: PointerEvent) => {
|
|
if (e.target?.dataset?.key) {
|
|
if (e.target?.dataset?.key) {
|
|
@@ -553,7 +676,10 @@ export function useExamTest() {
|
|
correctScore,
|
|
correctScore,
|
|
errorScore,
|
|
errorScore,
|
|
beforeSubmitVisible,
|
|
beforeSubmitVisible,
|
|
- submitVisible
|
|
|
|
|
|
+ submitVisible,
|
|
|
|
+ wrongQuestion,
|
|
|
|
+ wrongQuestionIndex,
|
|
|
|
+ correctAnswerVisible,
|
|
|
|
|
|
|
|
|
|
|
|
|