Browse Source

coding...

刘洋 1 năm trước cách đây
mục cha
commit
4eef175831

+ 6 - 2
src/api/apiConfig/index.js

@@ -1,6 +1,7 @@
 import axios from "axios";
 import router from "@/router";
 import { getAuthorization } from "./crypto";
+import { useUserStore } from "@/store";
 const env = import.meta.env;
 const axiosInstance = axios.create({
   baseURL: env.VITE_ENV === "dev" ? "" : env.VITE_API_HOST,
@@ -81,8 +82,11 @@ axiosInstance.interceptors.response.use(
           error.message = "请求参数错误(400)";
           break;
         case 401:
-          error.message = "请重新登录(401)";
-          router.replace({ name: "Login" });
+          // error.message = "请重新登录(401)";
+          // router.replace({ name: "Login" });
+          const userStore = useUserStore();
+          userStore.logout(true);
+          location.reload();
           break;
         case 403:
           error.message = "拒绝访问(403)";

BIN
src/assets/imgs/kcyd.png


BIN
src/assets/imgs/ksxz.png


+ 47 - 11
src/pages/admissionCard.vue

@@ -48,16 +48,55 @@
         </div>
       </div>
     </div>
+
+    <div class="link-box flex-h-between">
+      <van-cell-group inset class="cell-group">
+        <van-cell
+          is-link
+          @click="
+            router.push({ name: 'ExamNotice', params: { applyId: applyId } })
+          "
+        >
+          <template #title>
+            <img
+              src="../assets/imgs/ksxz.png"
+              style="height: 20px; margin-top: -4px; margin-right: 6px"
+            />
+            <span class="custom-title">考试须知</span>
+          </template>
+        </van-cell>
+      </van-cell-group>
+      <van-cell-group inset class="cell-group ml-16" v-if="info.examRoomId">
+        <van-cell
+          is-link
+          @click="
+            router.push({
+              name: 'ExamGuidance',
+              params: { examRoomId: info.examRoomId },
+            })
+          "
+        >
+          <template #title>
+            <img
+              src="../assets/imgs/kcyd.png"
+              style="height: 20px; margin-top: -4px; margin-right: 6px"
+            />
+            <span class="custom-title">考场引导</span>
+          </template>
+        </van-cell>
+      </van-cell-group>
+    </div>
   </div>
 </template>
 <script name="AdmissionCard" setup>
 import { ref } from "vue";
-import { useRoute } from "vue-router";
-import { getAdmissionInfo, getExamNotice, getRoomGuide } from "@/api/user";
+import { useRoute, useRouter } from "vue-router";
+import { getAdmissionInfo } from "@/api/user";
 import { useAppStore } from "@/store";
 
 const appStore = useAppStore();
 const route = useRoute();
+const router = useRouter();
 const applyId = route.params.applyId;
 const info = ref({
   applyId: "",
@@ -89,15 +128,6 @@ function _getAdmissionInfo() {
 }
 _getAdmissionInfo();
 
-//获取考试须知
-function _getExamNotice() {
-  getExamNotice({ applyTaskId: applyId }).then((res) => {});
-}
-//获取考场引导
-function _getRoomGuide() {
-  getRoomGuide({ examRoomId: info.value.examRoomId }).then((res) => {});
-}
-
 function getWeek(time) {
   if (!time) return "";
   const arr = ["日", "一", "二", "三", "四", "五", "六"];
@@ -106,6 +136,12 @@ function getWeek(time) {
 </script>
 <style lang="less" scoped>
 .admission-card {
+  .link-box {
+    margin-top: 16px;
+    .cell-group {
+      width: calc(50% - 10px);
+    }
+  }
   .card {
     border-radius: 8px;
     background-color: #fff;

+ 1 - 1
src/pages/applyResult.vue

@@ -37,7 +37,7 @@ const continueApply = () => {
   bus.emit("continueApply");
 };
 const seeOrders = () => {
-  router.push({ name: "MyHistory" });
+  router.push({ name: "MyHistory", replace: true });
 };
 </script>
 <style lang="less" scoped>

+ 27 - 0
src/pages/examGuidance.vue

@@ -0,0 +1,27 @@
+<template>
+  <div class="page exam-guidance">
+    <div class="title">考场引导</div>
+    <div class="content" v-html="ct"></div>
+  </div>
+</template>
+<script name="ExamGuidance" setup>
+import { ref } from "vue";
+import { useRoute } from "vue-router";
+import { getRoomGuide } from "@/api/user";
+
+const route = useRoute();
+const ct = ref("");
+
+//获取考场引导
+function _getRoomGuide() {
+  getRoomGuide({ examRoomId: route.params?.examRoomId }).then((res) => {
+    ct.value = res?.content || "";
+  });
+}
+_getRoomGuide();
+</script>
+<style lang="less" scoped>
+.exam-guidance {
+  background: #fff;
+}
+</style>

+ 36 - 0
src/pages/examNotice.vue

@@ -0,0 +1,36 @@
+<template>
+  <div class="page exam-notice">
+    <div class="title">考试须知</div>
+    <div class="content" v-html="ct"></div>
+  </div>
+</template>
+<script name="ExamNotice" setup>
+import { ref } from "vue";
+import { useRoute } from "vue-router";
+import { getExamNotice } from "@/api/user";
+
+const route = useRoute();
+const ct = ref("");
+
+//获取考试须知
+function _getExamNotice() {
+  getExamNotice({ applyTaskId: route.params?.applyId }).then((res) => {
+    ct.value = res?.content || "";
+  });
+}
+_getExamNotice();
+</script>
+<style lang="less" scoped>
+.exam-notice {
+  background: #fff;
+  .title {
+    font-weight: bold;
+    font-size: 18px;
+    text-align: center;
+    margin-top: 25px;
+  }
+  .content {
+    margin-top: 20px;
+  }
+}
+</style>

+ 1 - 1
src/pages/tab-pages/index.vue

@@ -9,7 +9,7 @@
         :key="item.applyId"
       ></ApplyItem>
     </template>
-    <div class="vh-100 text-center" v-else>
+    <div class="vh-100 text-center flex-h-center" v-else>
       <div>
         <NoData>
           <template #img>

+ 9 - 3
src/pages/tab-pages/reservation.vue

@@ -122,7 +122,7 @@
         </div>
       </div>
     </template>
-    <div class="vh-100 flex-h-center" v-else>
+    <div class="vh-100 flex-h-center text-center" v-else>
       <div>
         <NoData>
           <template #img>
@@ -141,7 +141,7 @@
   </div>
 </template>
 <script name="Reservation" setup>
-import { ref, reactive, computed, watch } from "vue";
+import { ref, reactive, computed, watch, onUnmounted } from "vue";
 import { isJson } from "@/utils";
 import filters from "@/filters";
 import {
@@ -294,7 +294,13 @@ function siteConfirm(obj) {
   params.examSiteId = { text: obj.examSiteName, value: obj.examSiteId };
   showSites.value = false;
 }
-bus.on("continueApply", _getReservationList);
+bus.on("continueApply", () => {
+  console.log("continueApply");
+  _getReservationList();
+});
+onUnmounted(() => {
+  bus.off("continueApply");
+});
 </script>
 <style lang="less" scoped>
 .reservation {

+ 1 - 0
src/pages/wxLogin.vue

@@ -30,5 +30,6 @@ async function _wxLogin() {
     router.replace("/login");
   }
 }
+code && _wxLogin();
 </script>
 <style lang="less" scoped></style>

+ 12 - 1
src/router/routes.js

@@ -63,7 +63,18 @@ const routes = [
     component: () => import("@/pages/myHistory.vue"),
     meta: { title: "预约订单" },
   },
-
+  {
+    path: "/examNotice/:applyId",
+    name: "ExamNotice",
+    component: () => import("@/pages/examNotice.vue"),
+    meta: { title: "考试须知" },
+  },
+  {
+    path: "/examGuidance/:examRoomId",
+    name: "ExamGuidance",
+    component: () => import("@/pages/examGuidance.vue"),
+    meta: { title: "考场引导" },
+  },
   {
     path: "/404",
     name: "NotFound",

+ 8 - 5
src/store/modules/user.js

@@ -30,11 +30,14 @@ const useUserStore = defineStore("user", {
         return false;
       }
     },
-    async logout() {
-      let res = await wxUnbind().catch(() => {});
-      logout().then(() => {
-        router.replace("/login");
-      });
+    async logout(bool) {
+      if (!bool) {
+        await wxUnbind().catch(() => {});
+        logout().then(() => {
+          router.replace("/login");
+        });
+      }
+      this.resetUser();
     },
     resetUser() {
       this.$reset();