Pārlūkot izejas kodu

模拟考试的修复

JXDS18FUJT 2 gadi atpakaļ
vecāks
revīzija
5ac3c8eb34

+ 1 - 1
src/api/modules/open.js

@@ -49,7 +49,7 @@ const open = {
     //批量取题
     questionInfoGetQuestionInfoByIds(params){
         return request({
-            url: "open-api/question/info/getQuestionInfoByIds",
+            url: "/question/info/getQuestionInfoByIds",
             params
         })
     },

+ 4 - 1
src/api/request.js

@@ -24,13 +24,16 @@ mock.init(service)
 
 // request拦截器
 service.interceptors.request.use(
+
 	async config => {
+		
 		// 是否需要设置 token
 		if (config.headers.isLogin) {
 			return config
 		}
 		if (await store.dispatch("getToken")) {
-			config.headers['Authorization'] = 'Bearer ' + await store.dispatch("getToken") // 让每个请求携带自定义token 请根据实际情况自行修改
+			console.log(store.state)
+			config.headers['Authorization'] = 'Bearer ' + store.state.user.tokenObj.token // 让每个请求携带自定义token 请根据实际情况自行修改
 		}
 		else {
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 291 - 659
src/components/m-do-topic/m-do-topic.vue


+ 2 - 2
src/otherPages/exercise/index.vue

@@ -6,8 +6,8 @@
     </view> -->
     <m-do-topic
       v-if="isGetQuery"
-      :bottomFunc="['previous', 'next', 'score', 'explain', 'selectCatalogue']"
-      :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer', 'skill']"
+      :bottomFunc="['previous', 'next', 'score', 'explain', 'skill']"
+      :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer']"
       :trueNum.sync="trueNum"
       :falseNum.sync="falseNum"
       :query="query"

+ 2 - 0
src/otherPages/exerciseCollect/index.vue

@@ -7,6 +7,8 @@
     <m-do-topic
       v-if="isGetQuery"
       type="collect"
+      :bottomFunc="['previous', 'next', 'score', 'explain', 'skill']"
+      :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer']"
       :trueNum.sync="trueNum"
       :falseNum.sync="falseNum"
       :query="query"

+ 1 - 1
src/otherPages/exerciseExam/index.vue

@@ -10,7 +10,7 @@
       :hiddenFunction="true"
       :hiddenAnswer="true"
       :hiddenMode="true"
-      :bottomFunc="['previous', 'next', 'selectCatalogue', 'submitExam']"
+      :bottomFunc="['previous', 'next', 'score']"
       :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer']"
       :trueNum.sync="trueNum"
       :falseNum.sync="falseNum"

+ 1 - 1
src/otherPages/exerciseMi/index.vue

@@ -8,7 +8,7 @@
     <m-do-topic
       v-if="isGetQuery"
       type="mi"
-      :bottomFunc="['previous', 'next', 'score', 'explain', 'selectCatalogue']"
+      :bottomFunc="['previous', 'next', 'score', 'explain', 'skill']"
       :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer', 'skill']"
       :trueNum.sync="trueNum"
       :falseNum.sync="falseNum"

+ 2 - 0
src/otherPages/exerciseWrong/index.vue

@@ -7,6 +7,8 @@
     <m-do-topic
       v-if="isGetQuery"
       type="wrong"
+      :bottomFunc="['previous', 'next', 'score', 'explain', 'skill']"
+      :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer']"
       :trueNum.sync="trueNum"
       :falseNum.sync="falseNum"
       :query="query"

+ 2 - 2
src/otherPages/mockExam/index.vue

@@ -3,8 +3,8 @@
     <nav-bar :title="navTitle"> </nav-bar>
     <m-do-topic
       type="exam"
-      :bottomFunc="['previous', 'next', 'submitExam', 'catalogue']"
-      :midFunc="['collect', 'readQuestion', 'readQuestionAndAnswer']"
+      :bottomFunc="['previous', 'next', 'score']"
+      :midFunc="['collect', 'readQuestion']"
       :hiddenMode="true"
       :hiddenAnswer="true"
       :trueNum.sync="trueNum"

+ 8 - 8
src/otherPages/mockExamEnd/index.vue

@@ -28,15 +28,15 @@
     </div>
     <div class="btn-box">
       <m-button
-        width="180rpx"
-        height="60rpx"
+        width="270rpx"
+        height="90rpx"
         @tap="goExerciseSpecify"
         class="btn1"
         text="错题重做"
       />
       <m-button
-        width="180rpx"
-        height="60rpx"
+        width="270rpx"
+        height="90rpx"
         @tap="refreshTest"
         class="btn2"
         text="重新测试"
@@ -51,8 +51,8 @@ import utils from "@/utils/index";
 export default {
   data() {
     return {
-      hege:"https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/mockExamEnd/hege.png",
-      buhege:"https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/mockExamEnd/buhege.png",
+      hege:"https://ct.zzxcx.net/ctjk/mp-wx/mockExamEnd/%E8%80%83%E8%AF%95%E5%90%88%E6%A0%BC.png",
+      buhege:"https://ct.zzxcx.net/ctjk/mp-wx/mockExamEnd/%E8%80%83%E8%AF%95%E4%B8%8D%E5%90%88%E6%A0%BC.png",
       score: 0,
       useTime: "",
       subject: 1,
@@ -178,8 +178,8 @@ export default {
   }
 }
 .btn-box {
-  margin: 45px auto;
-  width: 230px;
+  margin: 0 auto;
+  width: 600rpx;
   display: flex;
   justify-content: space-between;
   align-items: center;

+ 11 - 0
src/pages.json

@@ -452,11 +452,22 @@
     //模式配置,仅开发期间生效
     "current": 0, //当前激活的模式(list 的索引项)
     "list": [
+      {
+        "path": "otherPages/classifyChoose/index",
+        "name": "分类练习",
+        "query":"liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=精选考题&sort=3"
+
+      },
       {
         "path": "otherPages/userInfoAuth/index",
         "name": "用户信息授权填写" 
 
       },
+      {
+        "path":"otherPages/mockExam/index",
+        "name":"模拟考试",
+        "query":"liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=模拟考试&sort=3"
+      },
       {
         "name": "模拟考试开始", //模式名称
         "path": "pages/mockExam/begin", //启动页面,必选

+ 118 - 98
src/pages/carVideo/index.vue

@@ -494,109 +494,129 @@ export default {
       this.xcx_video_open = Number(res.data)
       this.$nextTick(() => {
         this.selectComponent("#tabs").resize() // 需要延迟
+
+        api.user.getInfo().then(res => {
+          uni.setStorageSync("userInfo", res.data);
+          this.$store.commit('SET_USERINFO', res.data)
+          // if (!res.data.nickName) {
+          //   uni.showModal({
+          //     title: "新用户更新信息",
+          //     confirmText: "去更新",
+          //     success: function (res) {
+          //       if (res.confirm) {
+          //        uni.navigateTo({
+          //         url:"/otherPages/userInfoAuth/index"
+          //        })
+          //       } else if (res.cancel) {
+
+          //       }
+          //     }
+          //   })
+        })
+
       })
-      console.log(this.xcx_video_open)
-    })
-    api.user.getInfo().then(res => {
-      uni.setStorageSync("userInfo", res.data);
-      this.$store.commit('SET_USERINFO', res.data)
-      // if (!res.data.nickName) {
-      //   uni.showModal({
-      //     title: "新用户更新信息",
-      //     confirmText: "去更新",
-      //     success: function (res) {
-      //       if (res.confirm) {
-      //        uni.navigateTo({
-      //         url:"/otherPages/userInfoAuth/index"
-      //        })
-      //       } else if (res.cancel) {
-             
-      //       }
-      //     }
-      //   })
-
-
-      // }
     })
-    // this.$nextTick(() => {
-    //   this.selectComponent("#tabs").resize();
-    // });
-  },
-  methods: {
-    clickCell(carVideoList) {
-      this.$utils.route.goPage(`/pages/carVideo/moreVideo?active=${this.active}`, null, {
-        carVideoList: carVideoList,
-        active: this.active
-      });
+    
+      // api.user.getInfo().then(res => {
+      //   uni.setStorageSync("userInfo", res.data);
+      //   this.$store.commit('SET_USERINFO', res.data)
+      //   // if (!res.data.nickName) {
+      //   //   uni.showModal({
+      //   //     title: "新用户更新信息",
+      //   //     confirmText: "去更新",
+      //   //     success: function (res) {
+      //   //       if (res.confirm) {
+      //   //        uni.navigateTo({
+      //   //         url:"/otherPages/userInfoAuth/index"
+      //   //        })
+      //   //       } else if (res.cancel) {
+
+      //   //       }
+      //   //     }
+      //   //   })
+
+
+      //   // }
+      // })
+      // this.$nextTick(() => {
+      //   this.selectComponent("#tabs").resize();
+      // });
     },
-    goPath(url, extraQuery = {}, needVip = false) {
+      methods: {
+      clickCell(carVideoList) {
+        this.$utils.route.goPage(`/pages/carVideo/moreVideo?active=${this.active}`, null, {
+          carVideoList: carVideoList,
+          active: this.active
+        });
+      },
+      goPath(url, extraQuery = {}, needVip = false) {
 
-      uni.navigateTo({
-        url:
-          url + "?" + utils.mapToUrlQuery({ ...this.tabQuery, ...extraQuery }),
-      });
-    },
-    scrollTabs(e) {
-      console.log(e);
-    },
-    changeVehicle(item) {
-      this.tabQuery.vehicle = item.typeName;
-      this.tabQuery.cert = item.title;
-      switch (item.typeName) {
-        case "轿车":
-          this.tabQuery.liceCar = 1;
-          this.tabQuery.liceTruck = "";
-          this.tabQuery.liceBus = "";
-          this.tabQuery.liceMoto = "";
-          this.tabQuery.gs = "xc";
-          break;
-        case "货车":
-          this.tabQuery.liceCar = "";
-          this.tabQuery.liceTruck = 1;
-          this.tabQuery.liceBus = "";
-          this.tabQuery.liceMoto = "";
-          this.tabQuery.gs = "hc";
-          break;
-        case "客车":
-          this.tabQuery.liceCar = "";
-          this.tabQuery.liceTruck = "";
-          this.tabQuery.liceBus = 1;
-          this.tabQuery.liceMoto = "";
-          this.tabQuery.gs = "kc";
-          break;
-        case "摩托车":
-          this.tabQuery.liceCar = "";
-          this.tabQuery.liceTruck = "";
-          this.tabQuery.liceBus = "";
-          this.tabQuery.liceMoto = 1;
-          this.tabQuery.gs = "mtc";
-          break;
-        default:
-          break;
-      }
-    },
-    changeSubject(e) {
-      this.tabQuery.subject = e.detail.title == '科目一' ? 1 : 4;
-      this.tabQuery.name = e.detail.title;
-    },
-    goLightMock(e) {
-      uni.navigateTo({
-        url: "/pages/lightMock/index",
-      });
-    },
-    goAprilExam() {
-      uni.navigateTo({
-        url: "/pages/extraWeb/index?src=https://mn.zzxcx.net/#/aprilExam/test",
-      });
-    },
-    async search(e) {
-      let { data } = await this.$api.carVideo.getSearchList(e.detail);
-      console.log(data);
-      this.$utils.route.goPage("/pages/carVideo/more", null, {
-        carVideoList: data,
-      });
+        uni.navigateTo({
+          url:
+            url + "?" + utils.mapToUrlQuery({ ...this.tabQuery, ...extraQuery }),
+        });
+      },
+      scrollTabs(e) {
+        console.log(e);
+      },
+      changeVehicle(item) {
+        this.tabQuery.vehicle = item.typeName;
+        this.tabQuery.cert = item.title;
+        switch (item.typeName) {
+          case "轿车":
+            this.tabQuery.liceCar = 1;
+            this.tabQuery.liceTruck = "";
+            this.tabQuery.liceBus = "";
+            this.tabQuery.liceMoto = "";
+            this.tabQuery.gs = "xc";
+            break;
+          case "货车":
+            this.tabQuery.liceCar = "";
+            this.tabQuery.liceTruck = 1;
+            this.tabQuery.liceBus = "";
+            this.tabQuery.liceMoto = "";
+            this.tabQuery.gs = "hc";
+            break;
+          case "客车":
+            this.tabQuery.liceCar = "";
+            this.tabQuery.liceTruck = "";
+            this.tabQuery.liceBus = 1;
+            this.tabQuery.liceMoto = "";
+            this.tabQuery.gs = "kc";
+            break;
+          case "摩托车":
+            this.tabQuery.liceCar = "";
+            this.tabQuery.liceTruck = "";
+            this.tabQuery.liceBus = "";
+            this.tabQuery.liceMoto = 1;
+            this.tabQuery.gs = "mtc";
+            break;
+          default:
+            break;
+        }
+      },
+      changeSubject(e) {
+        this.tabQuery.subject = e.detail.title == '科目一' ? 1 : 4;
+        this.tabQuery.name = e.detail.title;
+      },
+      goLightMock(e) {
+        uni.navigateTo({
+          url: "/pages/lightMock/index",
+        });
+      },
+      goAprilExam() {
+        uni.navigateTo({
+          url: "/pages/extraWeb/index?src=https://mn.zzxcx.net/#/aprilExam/test",
+        });
+      },
+      async search(e) {
+        let { data } = await this.$api.carVideo.getSearchList(e.detail);
+        console.log(data);
+        this.$utils.route.goPage("/pages/carVideo/more", null, {
+          carVideoList: data,
+        });
+      },
     },
-  },
 };
 </script>
 

+ 2 - 1
src/store/modules/user.js

@@ -67,6 +67,7 @@ const user = {
 				title: '登陆中...',
 			})
 			let res = await userApi.login()
+			console.log('调用了store的登陆')
 			if (res.data) {
 				store.commit('SET_TOKENOBJ', {
 					token: res.data.token,
@@ -84,7 +85,7 @@ const user = {
 		},
 		async getToken(store) {
 			let tokenObj = store.state.tokenObj
-			if (new Date().getTime() - tokenObj.date < 1000 * 60 * 28) {
+			if (tokenObj.token) {
 				return tokenObj.token
 			} else {
 				let res = await store.dispatch("Login")

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels