Parcourir la source

voluntary - simulate logic

abpcoder il y a 4 jours
Parent
commit
547baad6f8

+ 9 - 1
src/common/routes.ts

@@ -62,7 +62,15 @@ export const routes = {
   /*
   * 志愿表
   * */
-  voluntaryList: '/pagesOther/pages/voluntary/list/list'
+  voluntaryList: '/pagesOther/pages/voluntary/list/list',
+  /*
+  * 学习备考首页
+  * */
+  studyIndex: '/pagesStudy/pages/index/index',
+  /*
+  * 学习备考首页
+  * */
+  studySimulate: '/pagesStudy/pages/simulation-entry/simulation-entry'
 } as const;
 
 export type Routes = keyof typeof routes;

+ 23 - 2
src/pagesOther/pages/voluntary/index/components/voluntary-form-simulate.vue

@@ -1,7 +1,8 @@
 <template>
-    <view class="mt-40 p-24 rounded-xl flex justify-between items-center bg-gradient-to-r from-primary-100 to-primary-50">
+    <view v-if="userStore.hasTestAndRecord" class="mt-40 p-24 rounded-xl flex justify-between items-center
+    bg-gradient-to-r from-primary-100 to-primary-50">
         <view class="text-24 text-fore-title">没有模考成绩/估分不确定?</view>
-        <view class="text-28 text-primary font-bold flex items-center">
+        <view class="text-28 text-primary font-bold flex items-center" @click="goSimulate">
             <text class="mr-6">去模拟测试</text>
             <uv-icon name="arrow-right" color="primary"/>
         </view>
@@ -9,6 +10,26 @@
 </template>
 
 <script lang="ts" setup>
+
+import {useUserStore} from "@/store/userStore";
+import {useTransferPage} from "@/hooks/useTransferPage";
+import {routes} from "@/common/routes";
+
+const userStore = useUserStore()
+const {transferTo} = useTransferPage()
+const goSimulate = () => {
+    const list = userStore.directedSchoolList || []
+    const first = list[0] || {}
+    if (!list.length || first.notice) {
+        transferTo(routes.studyIndex)
+    } else {
+        transferTo(routes.studySimulate, {
+            data: first
+        });
+    }
+}
+
+onMounted(() => userStore.getDirectedSchoolList())
 </script>
 
 <style scoped>

+ 2 - 1
src/pagesStudy/pages/index/compoentns/index-test.vue

@@ -42,6 +42,7 @@ import { useTransferPage } from '@/hooks/useTransferPage';
 import { DirectedSchool, SelectedUniversityMajor, SimulationTestInfo, SimulationTestOptions } from '@/types/study';
 import { getSimulationInfo } from '@/api/modules/study';
 import { useUserStore } from '@/store/userStore';
+import {routes} from "@/common/routes";
 
 const userStore = useUserStore();
 const { hasDirectedSchool, directedSchoolList } = toRefs(userStore);
@@ -76,7 +77,7 @@ const handleStartTest = async () => {
       confirmText: '知道了'
     });
   } else {
-    transferTo('/pagesStudy/pages/simulation-entry/simulation-entry', {
+    transferTo(routes.studySimulate, {
       data: props.directedSchool
     });
   }

+ 1 - 2
src/pagesStudy/pages/index/index.vue

@@ -80,10 +80,9 @@ const { transferTo } = useTransferPage();
 const userStore = useUserStore();
 const { hasPermission } = useAuth();
 
-const hasTestAndRecord = computed(() => userStore.getExamType !== EnumExamType.VHS);
 // 通过 ref 获取 ie-page 组件实例
 const iePageRef = ref<InstanceType<typeof IePage>>();
-const { hasDirectedSchool, directedSchoolList } = toRefs(userStore);
+const { hasDirectedSchool, directedSchoolList, hasTestAndRecord } = toRefs(userStore);
 const firstDirectedSchool = computed(() => directedSchoolList.value[0] || {});
 
 const handlePracticeAll = () => {

+ 5 - 1
src/store/userStore.ts

@@ -11,7 +11,7 @@ import defaultAvatar from '@/static/personal/avatar_default.png'
 
 // @ts-ignore
 // import { useUserStore as useOldUserStore } from '@/hooks/useUserStore';
-import { CardType, EnumReviewMode, EnumUserType } from '@/common/enum';
+import {CardType, EnumExamType, EnumReviewMode, EnumUserType} from '@/common/enum';
 import { OPEN_VIP_POPUP } from '@/types/injectionSymbols';
 import { getDirectedSchool, saveDirectedSchool } from '@/api/modules/study';
 // const oldUserStore = useOldUserStore()
@@ -102,6 +102,10 @@ export const useUserStore = defineStore('ie-user', {
     hasDirectedSchool(): boolean {
       return this.directedSchoolList.length > 0;
     },
+    hasTestAndRecord(): boolean {
+      // 职高对口升学 目前不支持测评
+      return this.getExamType != EnumExamType.VHS;
+    },
     /**
      * 需要完成信息完善的用户类型
      * @returns