瀏覽代碼

配置项bug修复和侧边栏bug修复

JXDS18FUJT 1 年之前
父節點
當前提交
3406e059bd

+ 15 - 2
package-lock.json

@@ -4093,8 +4093,7 @@
     "deepmerge": {
       "version": "4.3.1",
       "resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-4.3.1.tgz",
-      "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
-      "dev": true
+      "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="
     },
     "default-gateway": {
       "version": "6.0.3",
@@ -8445,6 +8444,11 @@
       "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
       "dev": true
     },
+    "shvl": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmmirror.com/shvl/-/shvl-2.0.3.tgz",
+      "integrity": "sha512-V7C6S9Hlol6SzOJPnQ7qzOVEWUQImt3BNmmzh40wObhla3XOYMe4gGiYzLrJd5TFa+cI2f9LKIRJTTKZSTbWgw=="
+    },
     "side-channel": {
       "version": "1.0.4",
       "resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz",
@@ -9576,6 +9580,15 @@
         "@vue/devtools-api": "^6.0.0-beta.11"
       }
     },
+    "vuex-persistedstate": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmmirror.com/vuex-persistedstate/-/vuex-persistedstate-4.1.0.tgz",
+      "integrity": "sha512-3SkEj4NqwM69ikJdFVw6gObeB0NHyspRYMYkR/EbhR0hbvAKyR5gksVhtAfY1UYuWUOCCA0QNGwv9pOwdj+XUQ==",
+      "requires": {
+        "deepmerge": "^4.2.2",
+        "shvl": "^2.0.3"
+      }
+    },
     "warning": {
       "version": "4.0.3",
       "resolved": "https://registry.npmmirror.com/warning/-/warning-4.0.3.tgz",

+ 2 - 1
package.json

@@ -18,7 +18,8 @@
     "moment": "^2.29.4",
     "vue": "^3.2.13",
     "vue-router": "^4.0.3",
-    "vuex": "^4.0.0"
+    "vuex": "^4.0.0",
+    "vuex-persistedstate": "^4.1.0"
   },
   "devDependencies": {
     "@types/howler": "^2.2.7",

+ 4 - 4
src/api/question/question.ts

@@ -5,10 +5,10 @@ export default {
     questionInfoSelectFlQuestionInfo(params: {
         excellIssueName?: string
         excellSort?: number
-        liceBus?: '1' | '2'
-        liceCar?: '1' | '2'
-        liceMoto?: '1' | '2'
-        liceTruck?: '1' | '2'
+        liceBus?: string
+        liceCar?: string
+        liceMoto?: string
+        liceTruck?: string
         subject: number
     }): Promise<questionApi.selectSxQuestionInfo> {
         return request({

+ 4 - 1
src/components/mProblemDialog/index.vue

@@ -3,7 +3,7 @@
     class="fixed mask-bg-black items-center justify-center top0 h100vh left0 w100vw flex"
     v-show="visible"
   >
-    <div class="w450 bg-white pr30 pl30 pt30 pb30">
+    <div class="w450 bg-white pr30 pl30 pt30 pb30 round5">
       <div class="flex items-center">
         <img class="w30 h24" src="@/assets/img/driverExam/analy_icon.png" />
         <span class="font16 font-bold text-black ml10">{{ title }}</span>
@@ -69,4 +69,7 @@ export default defineComponent({
 .w100vw {
   width: 100vw;
 }
+.h100vh{
+  height: 100vh;
+}
 </style>

+ 16 - 3
src/hooks/exam/driverExam.ts

@@ -702,6 +702,16 @@ export const useDriverExam = (requestFn: Promise<openApi.selectFreeQuestionInfoR
     }
     return select;
   };
+  const issueAutoRead = () => {
+    let redIssue = list.value[listIndex.value].issue
+    if (store.state.sysConfig.autoRed) {
+      redIssue = redIssue.replace(list.value[listIndex.value].titlekeyword, '<span class="text-red-500">' + list.value[listIndex.value].titlekeyword + '</span>')
+
+    }
+    return redIssue
+
+
+  }
 
   watch(listIndex, (newVal, oldVal) => {
     if (config.autoAnswer) {
@@ -761,7 +771,7 @@ export const useDriverExam = (requestFn: Promise<openApi.selectFreeQuestionInfoR
       }
 
     }
-    if(store.state.sysConfig.autoRead){
+    if (store.state.sysConfig.autoRead) {
       playIssueAudio()
     }
 
@@ -781,7 +791,7 @@ export const useDriverExam = (requestFn: Promise<openApi.selectFreeQuestionInfoR
   }
 
   onMounted(() => {
-    message.loading('题目加载中',0)
+    message.loading('题目加载中', 0)
     requestFn.then(res => {
       res.rows.forEach((element) => {
         element.optsArr = element.opts.split("-");
@@ -793,6 +803,8 @@ export const useDriverExam = (requestFn: Promise<openApi.selectFreeQuestionInfoR
       });
       list.value = res.rows;
       message.destroy()
+    }).catch(err => {
+      message.destroy()
     })
     timerId = window.setInterval(() => {
       if (examTimeMillSeconds === 0) {
@@ -830,7 +842,8 @@ export const useDriverExam = (requestFn: Promise<openApi.selectFreeQuestionInfoR
     switchAnswerBySelect,
     switchIndexBySelect,
     setPageNumToListIndex,
-    playIssueAudio
+    playIssueAudio,
+    issueAutoRead
 
   }
 

+ 3 - 0
src/router/index.ts

@@ -56,6 +56,9 @@ const routes: Array<RouteRecordRaw> = [
     {
       path: 'selectExamSubject',
       component: () => import('../views/home/selectExamSubject/index.vue')
+    }, {
+      path: 'logOut',
+      component: () => import('../views/home/logOut/index.vue')
     }],
     // route level code-splitting
     // this generates a separate chunk (about.[hash].js) for this route

+ 9 - 8
src/store/index.ts

@@ -1,25 +1,26 @@
 import { createStore } from 'vuex'
-
+import createPersistedState from "vuex-persistedstate";
 export default createStore({
+  plugins: [createPersistedState()],
   state: {
-    sysConfig: {
-      autoNext: true,
-      autoRead: false,
-      autoRed: false
+    sysConfig: JSON.parse(window.localStorage.getItem('vuex_sysConfig') || '{"autoNext":true,"autoRead":false,"autoRed":false}') as {
+      autoNext: boolean,
+      autoRead: boolean,
+      autoRed: boolean
 
     }
   },
   getters: {
   },
   mutations: {
-    SET_SYSCONFIG(store, sysConfig: {
+    SET_SYSCONFIG(state, sysConfig: {
       autoNext: boolean,
       autoRead: boolean,
       autoRed: boolean
 
     }) {
-      store.sysConfig = sysConfig
-      return store
+      state.sysConfig = sysConfig
+      return state
 
 
     }

+ 25 - 10
src/views/driverExam/index.vue

@@ -31,7 +31,7 @@
           </div>
           <div class="text-left pr20 pl20 pt20">
             <span class="font-bold"
-              >{{ listIndex + 1 }}、{{ list[listIndex].issue }}</span
+              >{{ listIndex + 1 }}、{{list[listIndex].issue}}</span
             >
           </div>
           <div v-if="list[listIndex].questionType !== 1" class="mt30">
@@ -124,7 +124,7 @@
           <div class="font-bold flex">
             <div class="inline-block">
               <div>剩余时间</div>
-              <div class="pl20">{{countDown}}</div>
+              <div class="pl20">{{ countDown }}</div>
             </div>
 
             <div
@@ -146,7 +146,7 @@
         <div class="flex cursor-pointer mt20">
           <!-- 答案列表 -->
           <div
-            @click="list[listIndex].isComplete?'':setUserAnswer(_item)"
+            @click="list[listIndex].isComplete ? '' : setUserAnswer(_item)"
             v-for="(_item, _index) in list[listIndex].optsArr"
             :key="_index"
             class="w46 lh46 h46 answer-select font20 font-bold mr15 flex-grow-0"
@@ -176,7 +176,16 @@
           <div @click="nextProblem()" class="w120 lh46 bottom-button">
             下一题
           </div>
-          <div class="w120 lh46 bottom-button">交卷</div>
+          <div
+            @click="
+              () => {
+                dialogVisible = true;
+              }
+            "
+            class="w120 lh46 bottom-button"
+          >
+            交卷
+          </div>
         </div>
       </div>
     </div>
@@ -195,7 +204,11 @@
       title="开启"
       content="禁止重复"
     ></mProblemAlert>
-    <mProblemDialog v-model:visible="dialogVisible"></mProblemDialog>
+    <mProblemDialog
+      v-model:visible="dialogVisible"
+      title="提示"
+      content="是否真的要交卷(按确定键交卷,按取消键继续答题)"
+    ></mProblemDialog>
   </div>
 </template>
 
@@ -210,14 +223,16 @@ import { useRoute } from "vue-router";
 export default defineComponent({
   name: "driverExam",
   setup() {
-    const route = useRoute()
+    const route = useRoute();
     return {
       alertVisible: ref(false),
       dialogVisible: ref(false),
-      ...useDriverExam(api.open.questionInfoSelectTestK14QuestionInfoList({
-        subject:Number(route.query.subject),
-        gs:route.query.gs as string
-      }))
+      ...useDriverExam(
+        api.open.questionInfoSelectTestK14QuestionInfoList({
+          subject: Number(route.query.subject),
+          gs: route.query.gs as string,
+        })
+      ),
     };
   },
 

+ 17 - 1
src/views/examInstructions/index.vue

@@ -31,11 +31,14 @@
             <div class="w-full mt30">
               <div
                 class="bg-primary-yellow pl25 pr25 lh40 font24 font-bold flex-grow-0 inline-block mb20 round4 cursor-pointer"
+                @click="goDriverExam"
               >
                 确定
               </div>
             </div>
-             <div class="text-left text-red-500 font20 font-bold">点击"确定"按钮开始考试!</div>
+            <div class="text-left text-red-500 font20 font-bold">
+              点击"确定"按钮开始考试!
+            </div>
           </div>
         </div>
       </div>
@@ -45,10 +48,23 @@
 
 <script lang="ts">
 import { defineComponent } from "vue";
+import { useRoute, useRouter } from "vue-router";
 
 export default defineComponent({
+  name:'examInstructions',
   setup() {
+    const route = useRoute();
+    const router = useRouter();
+    const goDriverExam = () => {
+      router.push({
+        path:'/driverExam',
+        query:{
+          ...route.query
+        }
+      })
+    };
     return {
+      goDriverExam,
       intro: [
         "1、遵守考场纪律服从监考人员指挥",
         "2、进入考场,手机、拷机关机。禁止抽烟禁止吃零食。",

+ 12 - 3
src/views/home/components/leftTab/index.vue

@@ -66,6 +66,7 @@ import xcIcon from "@/assets/img/home/xc_icon.png";
 import mtcIcon from "@/assets/img/home/mtc_icon.png";
 import markIcon from "@/assets/img/home/mark_icon.png";
 import sanliIcon from "@/assets/img/home/sanli_icon.png";
+import outIcon from "@/assets/img/home/out_icon.png";
 export default defineComponent({
   setup() {
     const state = reactive({
@@ -224,6 +225,14 @@ export default defineComponent({
           isSelect: false,
           path: "/home/markLine",
         },
+        {
+          text: "安全退出",
+          icon: outIcon,
+          children: [],
+          isOpen: false,
+          isSelect: false,
+          path: "/home/logOut",
+        },
       ],
       tabValue: [-1, -1],
     });
@@ -241,9 +250,9 @@ export default defineComponent({
       },
       selectIndex: number
     ) {
-      this.tabValue[0] == -1
-        ? (this.tabValue[0] = selectIndex)
-        : (this.tabValue[0] = -1);
+      this.tabValue[0] == selectIndex
+        ? (this.tabValue[0] = -1)
+        : (this.tabValue[0] = selectIndex);
       this.tabValue[1] = -1;
       item.isSelect = !item.isSelect;
       item.isOpen = !item.isOpen;

+ 24 - 0
src/views/home/logOut/index.vue

@@ -0,0 +1,24 @@
+<template>
+    <div class="W-full pr30 pl30 pt30">
+        <div class="w-full bg-white h720">
+            <span></span>
+        </div>
+
+    </div>
+</template>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+
+export default defineComponent({
+    setup () {
+        
+
+        return {}
+    }
+})
+</script>
+
+<style scoped>
+
+</style>

+ 6 - 0
src/views/home/practiseSelect/index.vue

@@ -71,6 +71,12 @@ export default defineComponent({
     api.question
       .questionInfoSelectFlQuestionInfo({
         subject: Number(route.query.subject),
+        liceBus:route.query.liceBus as string,
+        liceCar:route.query.liceCar as string,
+        liceMoto:route.query.liceMoto as string,
+        liceTruck:route.query.liceTruck as string
+
+
       })
       .then((res) => {
         res.data.shift();

+ 1 - 1
src/views/home/selectExamSubject/index.vue

@@ -50,7 +50,7 @@ export default defineComponent({
   methods: {
     goDriveExam(gs:string) {
       this.$router.push({
-        path:'/driverExam',
+        path:'/examInstructions',
         query:{
           gs:gs,
           ...this.$route.query

+ 13 - 8
src/views/home/sysconfig/index.vue

@@ -6,8 +6,7 @@
         <div class="w90 justify-between flex">
           <label>
             <input
-          
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               v-model="sysConfig.autoNext"
               :value="true"
               class="yello-radio"
@@ -19,7 +18,7 @@
           <label>
             <input
               v-model="sysConfig.autoNext"
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               :value="false"
               class="yello-radio"
               name="autoNext"
@@ -36,7 +35,7 @@
           <label>
             <input
               v-model="sysConfig.autoRed"
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               :value="true"
               class="yello-radio"
               name="autoRed"
@@ -47,7 +46,7 @@
           <label>
             <input
               v-model="sysConfig.autoRed"
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               :value="false"
               class="yello-radio"
               name="autoRed"
@@ -63,7 +62,7 @@
           <label>
             <input
               class="yello-radio"
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               :value="true"
               v-model="sysConfig.autoRead"
               name="autoRead"
@@ -74,7 +73,7 @@
           <label>
             <input
               class="yello-radio"
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               :value="false"
               v-model="sysConfig.autoRead"
               name="autoRead"
@@ -85,7 +84,7 @@
         </div>
       </div>
       <div class="save">
-        <div class="save-button">保存</div>
+        <div @click="saveSysConfig" class="save-button">保存</div>
       </div>
     </div>
   </div>
@@ -94,6 +93,7 @@
 <script>
 import { reactive, ref, toRefs, defineComponent } from "vue";
 import { useStore } from "vuex";
+import { message, Modal } from 'ant-design-vue';
 export default defineComponent({
   name: "sysconfig",
   setup() {
@@ -106,9 +106,14 @@ export default defineComponent({
     const changeSysConfig = (event) => {
       store.commit("SET_SYSCONFIG", sysConfig.value);
     };
+    const saveSysConfig = () => {
+      store.commit("SET_SYSCONFIG", sysConfig.value);
+      message.success("保存成功");
+    };
     return {
       sysConfig,
       changeSysConfig,
+      saveSysConfig,
     };
   },
 });

+ 1 - 1
src/views/markLine/index.vue

@@ -26,7 +26,7 @@
           <div class="w100 h100 margin-center">
             <preImage :src="item.signUrl">
               <div class="font-bold font24">向左转弯</div>
-              <div class="font24 w-full">{{ index }}/{{ list.length }}</div>
+              <div class="font24 w-full">{{ index+1 }}/{{ list.length }}</div>
             </preImage>
           </div>
 

+ 40 - 15
src/views/studySkill/index.vue

@@ -1,9 +1,11 @@
 <template>
   <div class="bg-gray w-full min-h-screen">
-    <div class="pt30 pr30 pl30 pb30">
-      <div class="w-full gray-border">
-        <div class="pt30 pl30 text-left font26 pb50 bg-white">
-          <span>{{ listIndex + 1 }}.{{ list[listIndex].issue }}</span>
+    <div class="pt30 pr30 pl30 pb30 w-full">
+      <div class="w-full gray-border flex flex-wrap">
+        <div class="pt30 pl30 text-left font26 pb50 bg-white flex-1">
+          <span
+            >{{ listIndex + 1 }}.<span v-html="issueAutoRead()"></span
+          ></span>
           <div v-if="list[listIndex].questionType === 1">
             <div v-for="(item, index) in list[listIndex].optsArr" :key="index">
               {{ switchIndexBySelect(index) }}.{{
@@ -72,26 +74,30 @@
             </div>
           </div>
           <div v-if="list[listIndex].questionType === 1" class="flex mt15">
-            <button
+            <div
               @click="setUserAnswerAndRes(item)"
               v-for="(item, index) in list[listIndex].optsArr"
               :key="index"
               class="w57 lh46 bottom-button mr15"
             >
               {{ item }}
-            </button>
+            </div>
           </div>
           <div v-if="list[listIndex].questionType !== 1" class="flex mt15">
-            <button
+            <div
               @click="setUserAnswerAndRes(item)"
               v-for="(item, index) in list[listIndex].optsArr"
               :key="index"
               class="w57 lh46 bottom-button mr15"
             >
               {{ switchIndexBySelect(index) }}
-            </button>
+            </div>
           </div>
         </div>
+        <div class="w430 pr30 flex items-center bg-white">
+          <img class="w400" v-if="list[listIndex].image" :src="list[listIndex].image">
+
+        </div>
       </div>
       <div class="w-full pt30">
         <div class="w1200 flex justify-between mr-auto ml-auto">
@@ -123,7 +129,16 @@
             语音播报
           </div>
           <div class="w120 lh46 bottom-button lh46">不设为错题</div>
-          <div class="w120 lh46 bottom-button lh46">交卷</div>
+          <div
+            @click="
+              () => {
+                dialogVisible = true;
+              }
+            "
+            class="w120 lh46 bottom-button lh46"
+          >
+            交卷
+          </div>
         </div>
       </div>
       <div class="w-full mt20">
@@ -147,7 +162,7 @@
             <input
               v-model="sysConfig.autoNext"
               class=""
-              @input="changeSysConfig"
+              @change="changeSysConfig"
               type="checkbox"
             />
             <span>答对自动跳转到下一题</span>
@@ -165,7 +180,9 @@
           <div class=""><span class="text-black font16">正确率100%</span></div>
           <div class="">
             <span class="text-black font16"
-              >进度{{ fixedNumber(((trueNum + falseNum) * 100) / list.length,2) }}%</span
+              >进度{{
+                fixedNumber(((trueNum + falseNum) * 100) / list.length, 2)
+              }}%</span
             >
           </div>
           <div class="flex items-center content-center">
@@ -174,7 +191,7 @@
                 class=""
                 v-model="sysConfig.autoRead"
                 type="checkbox"
-                @input="changeSysConfig"
+                @change="changeSysConfig"
               />
               <span>自动播放</span>
             </div>
@@ -183,7 +200,7 @@
                 class=""
                 v-model="sysConfig.autoRed"
                 type="checkbox"
-                @input="changeSysConfig"
+                @change="changeSysConfig"
               />
               <span>提示红字</span>
             </div>
@@ -196,17 +213,23 @@
       :content="list[listIndex].explainJs"
       title="题目解析"
     ></mProblemAlert>
+    <mProblemDialog
+      v-model:visible="dialogVisible"
+      title="提示"
+      content="是否真的要交卷(按确定键交卷,按取消键继续答题)"
+    ></mProblemDialog>
   </div>
 </template>
 
 <script lang="ts">
 import { defineComponent, ref } from "vue";
 import api from "@/api";
-import { openApi } from "@/api/open/type";
 import { useRoute } from "vue-router";
 import { useDriverExam } from "@/hooks/exam/driverExam";
 import mProblemAlert from "@/components/mProblemAlert/index.vue";
+import mProblemDialog from "@/components/mProblemDialog/index.vue";
 import { useStore } from "vuex";
+import { message } from "ant-design-vue";
 export default defineComponent({
   name: "studySkill",
   setup() {
@@ -218,11 +241,13 @@ export default defineComponent({
       autoNext: store.state.sysConfig.autoNext,
     });
     const changeSysConfig = (event: any) => {
+      console.log(sysConfig.value)
       store.commit("SET_SYSCONFIG", sysConfig.value);
     };
     const fixedNumber = (decimal: number, digit: number) => {
       return decimal.toFixed(digit);
     };
+ 
     return {
       sysConfig,
       alertVisible: ref(false),
@@ -237,7 +262,6 @@ export default defineComponent({
         {
           autoAnswer: false,
           countDown: false,
-   
         }
       ),
       changeSysConfig,
@@ -246,6 +270,7 @@ export default defineComponent({
   },
   components: {
     mProblemAlert,
+    mProblemDialog
   },
 });
 </script>

+ 10 - 0
vue.config.js

@@ -1,6 +1,8 @@
 const { defineConfig } = require('@vue/cli-service')
+const HtmlWebpackPlugin = require('html-webpack-plugin')
 module.exports = defineConfig({
   transpileDependencies: true,
+
   css: {
     loaderOptions: {
       less: {
@@ -10,6 +12,14 @@ module.exports = defineConfig({
         }
       },
     },
+  },
+  chainWebpack: config => {
+    config
+      .plugin('html')
+      .tap(args => {
+        args[0].title = '模拟机'
+        return args
+      })
   }