刘洋 8 ay önce
ebeveyn
işleme
8afa5639c9

+ 1 - 1
.env.dev

@@ -9,7 +9,7 @@ VITE_BASE=""
 # -- 输出目录
 VITE_OUT_DIR="dist"
 
-
+VITE_NOT_NEED_WX_AUTH=true
 
 
 

+ 7 - 1
src/App.vue

@@ -11,7 +11,13 @@ const code = getUrlParam("code");
 let pattern =
   /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
 
-if (userStore.openId || code) {
+// if (pattern.test(location.hostname) && import.meta.env.VITE_NOT_NEED_WX_AUTH) {
+//   router.push({ name: "Login" });
+// } else if (userStore.openId || code) {
+//   router.push({ name: "WxLogin", query: { code } });
+// }
+
+if (code) {
   router.push({ name: "WxLogin", query: { code } });
 }
 </script>

+ 2 - 1
src/api/user.js

@@ -137,10 +137,11 @@ export function getSiteList(data) {
 }
 
 //获取可预约的日期列表
-export function getDateList() {
+export function getDateList(params) {
   return request({
     url: "/api/student/apply/date/list",
     method: "post",
+    params,
     loading: true,
   });
 }

+ 7 - 2
src/layouts/bottomTabBar.vue

@@ -6,12 +6,12 @@
         <img :src="props.active ? tab1Active : tab1" />
       </template>
     </van-tabbar-item>
-    <!-- <van-tabbar-item icon="clock-o" to="/reservation"
+    <van-tabbar-item icon="clock-o" to="/reservation" v-if="showMiddle"
       >预约考试
       <template #icon="props">
         <img :src="props.active ? tab2Active : tab2" />
       </template>
-    </van-tabbar-item> -->
+    </van-tabbar-item>
     <van-tabbar-item icon="manager-o" to="/mine"
       >个人中心
       <template #icon="props">
@@ -28,6 +28,11 @@ import tab2 from "../assets/imgs/tab2.png";
 import tab2Active from "../assets/imgs/tab2_active.png";
 import tab3 from "../assets/imgs/tab3.png";
 import tab3Active from "../assets/imgs/tab3_active.png";
+import { getStuInfo } from "@/api/user";
 const active = ref(0);
+const showMiddle = ref(false);
+getStuInfo().then((res) => {
+  showMiddle.value = res?.selfApplyEnable;
+});
 </script>
 <style lang="" scoped></style>

+ 9 - 0
src/pages/admissionCard.vue

@@ -44,6 +44,12 @@
         <div class="d-flex align-items-center">
           准考证号:{{ info.ticketNumber }}
         </div>
+        <div class="d-flex">
+          考试科目:
+          <div>
+            <div v-for="item in getSubjects(info?.courses)">{{ item }}</div>
+          </div>
+        </div>
       </div>
     </div>
 
@@ -134,6 +140,9 @@ function getWeek(time) {
   const arr = ["日", "一", "二", "三", "四", "五", "六"];
   return arr[new Date(time).getDay()];
 }
+const getSubjects = (c) => {
+  return (c || []).map((item) => item.courseName);
+};
 </script>
 <style lang="less" scoped>
 .admission-card {

+ 140 - 138
src/pages/tab-pages/reservation.vue

@@ -1,148 +1,148 @@
 <template>
   <div class="reservation tab-page position-relative p-16">
     <template v-if="dateLoading"></template>
-    <template v-else-if="dateStates.columns.length">
-      <van-cell-group inset>
-        <van-field
-          v-model="params.aaa.text"
-          name="城市"
-          label="城市"
-          placeholder=""
-          input-align="right"
-          is-link
-          readonly
-          :rules="[{ required: true, message: '请选择城市' }]"
-          @click="cityStates.show = true"
-        />
-        <van-field
-          v-model="params.bbb.text"
-          name="教学点"
-          label="教学点"
-          placeholder=""
-          input-align="right"
-          :is-link="!!params.aaa.value"
-          readonly
-          :rules="[{ required: true, message: '请选择教学点' }]"
-          @click="teachStates.show = true"
-          :disabled="!params.aaa.value"
-        />
-        <van-field
-          v-model="params.examSiteId.text"
-          name="考点"
-          label="考点"
-          placeholder=""
-          input-align="right"
-          :is-link="!!params.bbb.value"
-          readonly
-          :rules="[{ required: true, message: '请选择考点' }]"
-          @click="toChooseSite"
-          :disabled="!params.bbb.value"
-        />
-        <van-field
-          v-model="params.date.text"
-          name="日期"
-          label="日期"
-          placeholder=""
-          input-align="right"
-          is-link
-          readonly
-          :rules="[{ required: true, message: '请选择日期' }]"
-          @click="dateStates.show = true"
-        />
-      </van-cell-group>
+    <!-- <template v-else-if="dateStates.columns.length"> -->
+    <van-cell-group inset>
+      <van-field
+        v-model="params.aaa.text"
+        name="城市"
+        label="城市"
+        placeholder=""
+        input-align="right"
+        is-link
+        readonly
+        :rules="[{ required: true, message: '请选择城市' }]"
+        @click="cityStates.show = true"
+      />
+      <van-field
+        v-model="params.bbb.text"
+        name="教学点"
+        label="教学点"
+        placeholder=""
+        input-align="right"
+        :is-link="!!params.aaa.value"
+        readonly
+        :rules="[{ required: true, message: '请选择教学点' }]"
+        @click="teachStates.show = true"
+        :disabled="!params.aaa.value"
+      />
+      <van-field
+        v-model="params.examSiteId.text"
+        name="考点"
+        label="考点"
+        placeholder=""
+        input-align="right"
+        :is-link="!!params.bbb.value"
+        readonly
+        :rules="[{ required: true, message: '请选择考点' }]"
+        @click="toChooseSite"
+        :disabled="!params.bbb.value"
+      />
+      <van-field
+        v-model="params.date.text"
+        name="日期"
+        label="日期"
+        placeholder=""
+        input-align="right"
+        is-link
+        readonly
+        :rules="[{ required: true, message: '请选择日期' }]"
+        @click="dateStates.show = true"
+      />
+    </van-cell-group>
 
-      <van-popup
-        teleport="body"
-        v-model:show="cityStates.show"
-        round
-        position="bottom"
-      >
-        <van-picker
-          v-model="cityStates.value"
-          :columns="cityStates.columns"
-          @cancel="cityStates.show = false"
-          @confirm="cityStates.onConfirm"
-        />
-      </van-popup>
-      <van-popup
-        teleport="body"
-        v-model:show="teachStates.show"
-        round
-        position="bottom"
-      >
-        <van-picker
-          v-model="teachStates.value"
-          :columns="teachStates.columns"
-          @cancel="teachStates.show = false"
-          @confirm="teachStates.onConfirm"
-        />
-      </van-popup>
-      <van-popup
-        teleport="body"
-        v-model:show="dateStates.show"
-        round
-        position="bottom"
-      >
-        <van-picker
-          v-model="dateStates.value"
-          :columns="dateStates.columns"
-          @cancel="dateStates.show = false"
-          @confirm="dateStates.onConfirm"
-        />
-      </van-popup>
+    <van-popup
+      teleport="body"
+      v-model:show="cityStates.show"
+      round
+      position="bottom"
+    >
+      <van-picker
+        v-model="cityStates.value"
+        :columns="cityStates.columns"
+        @cancel="cityStates.show = false"
+        @confirm="cityStates.onConfirm"
+      />
+    </van-popup>
+    <van-popup
+      teleport="body"
+      v-model:show="teachStates.show"
+      round
+      position="bottom"
+    >
+      <van-picker
+        v-model="teachStates.value"
+        :columns="teachStates.columns"
+        @cancel="teachStates.show = false"
+        @confirm="teachStates.onConfirm"
+      />
+    </van-popup>
+    <van-popup
+      teleport="body"
+      v-model:show="dateStates.show"
+      round
+      position="bottom"
+    >
+      <van-picker
+        v-model="dateStates.value"
+        :columns="dateStates.columns"
+        @cancel="dateStates.show = false"
+        @confirm="dateStates.onConfirm"
+      />
+    </van-popup>
 
-      <van-popup
-        teleport="body"
-        v-model:show="showSites"
-        round
-        position="bottom"
-        safe-area-inset-bottom
-      >
-        <ChooseSite
-          :site-list="siteList"
-          @site-confirm="siteConfirm"
-        ></ChooseSite>
-      </van-popup>
+    <van-popup
+      teleport="body"
+      v-model:show="showSites"
+      round
+      position="bottom"
+      safe-area-inset-bottom
+    >
+      <ChooseSite
+        :site-list="siteList"
+        @site-confirm="siteConfirm"
+      ></ChooseSite>
+    </van-popup>
 
-      <div class="result-box" v-if="resultList.length">
-        <div class="tip">选择预约时段</div>
-        <div class="sub-tip">
-          <van-icon name="warning" color="#FF7D00" size="20" />
-          <span class="txt">我的剩余可约时段:{{ unApplyNumber }}</span>
-        </div>
-        <div class="list-box">
-          <div
-            v-for="item in resultList"
-            :key="item.timePeriodId"
-            class="flex-h-between list-item"
-          >
-            <div class="left d-flex align-items-center">
-              <span class="s1"
-                >{{ $filters.dateFormat(item.timePeriodStart, "HH:mm") }}-{{
-                  $filters.dateFormat(item.timePeriodEnd, "HH:mm")
-                }}</span
-              >
-              <span class="s2">|</span>
-              <span class="s3">剩余{{ item.availableCount }}</span>
-            </div>
-            <van-button
-              v-if="item.status === 'AVAILABLE'"
-              :type="!unApplyNumber ? 'default' : 'success'"
-              size="small"
-              @click="reservationHandle(item)"
-              :disabled="!unApplyNumber"
-              >预约</van-button
-            >
-            <span class="full" v-else-if="item.status === 'FULL'">约满</span>
-            <span class="finish" v-else-if="item.status === 'FINISHED'"
-              >已预约</span
+    <div class="result-box" v-if="resultList.length">
+      <div class="tip">选择预约时段</div>
+      <div class="sub-tip">
+        <van-icon name="warning" color="#FF7D00" size="20" />
+        <span class="txt">我的剩余可约时段:{{ unApplyNumber }}</span>
+      </div>
+      <div class="list-box">
+        <div
+          v-for="item in resultList"
+          :key="item.timePeriodId"
+          class="flex-h-between list-item"
+        >
+          <div class="left d-flex align-items-center">
+            <span class="s1"
+              >{{ $filters.dateFormat(item.timePeriodStart, "HH:mm") }}-{{
+                $filters.dateFormat(item.timePeriodEnd, "HH:mm")
+              }}</span
             >
-            <span class="stop" v-else>停止</span>
+            <span class="s2">|</span>
+            <span class="s3">剩余{{ item.availableCount }}</span>
           </div>
+          <van-button
+            v-if="item.status === 'AVAILABLE'"
+            :type="!unApplyNumber ? 'default' : 'success'"
+            size="small"
+            @click="reservationHandle(item)"
+            :disabled="!unApplyNumber"
+            >预约</van-button
+          >
+          <span class="full" v-else-if="item.status === 'FULL'">约满</span>
+          <span class="finish" v-else-if="item.status === 'FINISHED'"
+            >已预约</span
+          >
+          <span class="stop" v-else>停止</span>
         </div>
       </div>
-    </template>
-    <div class="vh-100 flex-h-center text-center" v-else>
+    </div>
+    <!-- </template> -->
+    <!-- <div class="vh-100 flex-h-center text-center" v-else>
       <div>
         <NoData>
           <template #img>
@@ -151,7 +151,7 @@
           当前无考试预约时段</NoData
         >
       </div>
-    </div>
+    </div> -->
 
     <router-view v-slot="{ Component }">
       <transition name="zoom-fade" mode="out-in" appear>
@@ -218,6 +218,7 @@ const teachStates = reactive({
     if (option.value != params.bbb.value) {
       params.bbb = { ...option };
       params.examSiteId = { value: "", text: "" };
+      params.date = { value: "", text: "" };
     }
     teachStates.show = false;
     _getSiteList();
@@ -273,7 +274,7 @@ _getCategoryList();
 const dateLoading = ref(false);
 function _getDateList() {
   dateLoading.value = true;
-  getDateList()
+  getDateList({ examSiteId: params.examSiteId.value })
     .then((res) => {
       dateStates.columns = (res || []).map((item) => ({
         value: item,
@@ -284,7 +285,7 @@ function _getDateList() {
       dateLoading.value = false;
     });
 }
-_getDateList();
+// _getDateList();
 
 const unApplyNumber = ref("");
 function _getReservationList() {
@@ -332,6 +333,7 @@ watch([() => params.examSiteId, () => params.date], ([examSiteId, date]) => {
 function siteConfirm(obj) {
   params.examSiteId = { text: obj.examSiteName, value: obj.examSiteId };
   showSites.value = false;
+  _getDateList();
 }
 bus.on("continueApply", () => {
   console.log("continueApply");

+ 5 - 4
src/router/index.js

@@ -29,10 +29,11 @@ router.beforeEach(async (to, from, next) => {
   if (
     !userStore.openId &&
     !code &&
-    !(
-      pattern.test(location.hostname) ||
-      location.hostname === "apply-test.qmth.com.cn"
-    )
+    !import.meta.env.VITE_NOT_NEED_WX_AUTH
+    // &&!(
+    //   pattern.test(location.hostname) ||
+    //   location.hostname === "apply-test.qmth.com.cn"
+    // )
   ) {
     LibForWeixin.auth();
     return;

+ 14 - 14
src/router/routes.js

@@ -13,20 +13,20 @@ const routes = [
         component: () => import("@/pages/tab-pages/index.vue"),
         meta: { title: "首页" },
       },
-      // {
-      //   path: "/reservation",
-      //   name: "Reservation",
-      //   component: () => import("@/pages/tab-pages/reservation.vue"),
-      //   meta: { title: "预约考试" },
-      //   children: [
-      //     {
-      //       path: "applyResult",
-      //       name: "ApplyResult",
-      //       component: () => import("@/pages/applyResult.vue"),
-      //       meta: { title: "预约结果" },
-      //     },
-      //   ],
-      // },
+      {
+        path: "/reservation",
+        name: "Reservation",
+        component: () => import("@/pages/tab-pages/reservation.vue"),
+        meta: { title: "预约考试" },
+        children: [
+          {
+            path: "applyResult",
+            name: "ApplyResult",
+            component: () => import("@/pages/applyResult.vue"),
+            meta: { title: "预约结果" },
+          },
+        ],
+      },
       {
         path: "/mine",
         name: "Mine",

+ 2 - 2
vite.config.js

@@ -26,8 +26,8 @@ export default defineConfig(({ mode }) => {
       cors: true,
       proxy: {
         "/api": {
-          // target: "http://192.168.10.41:8080",
-          target: "http://apply-test.qmth.com.cn",
+          target: "http://192.168.10.41:8080",
+          // target: "http://apply-test.qmth.com.cn",
           changeOrigin: true,
           // rewrite: (path) => path.replace(new RegExp(`^${envConfig.proxy}`), ''),
         },