index-map.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="mx-30 mt-32 bg-white shadow-card overflow-hidden rounded-15 relative">
  3. <view class="w-full h-150 bg-[#F7FEE7] absolute" />
  4. <view class="flex justify-between z-1 relative">
  5. <view class="py-14 pl-40 pr-80 bg-white"
  6. style="clip-path: polygon(0 0, calc(100% - 40rpx) 0, 100% 80rpx, 100% 100%, 0 100%);">
  7. <ie-image src="/map-title.png" is-oss custom-class="w-182 h-57" />
  8. </view>
  9. <view class="flex-1 flex justify-center items-center text-24 text-fore-title">
  10. 分步拆解,指引升学每一步
  11. </view>
  12. </view>
  13. <view class="bg-white rounded-tr-15 z-1 relative px-12 py-20 grid grid-cols-4 gap-x-12 gap-y-20">
  14. <view v-for="(m, i) in maps" :key="i" class="flex flex-col items-center" @click="handleMap(m)">
  15. <view class="px-24 leading-36 text-20 text-fore-title font-bold bg-[#CEF57B] rounded-full z-1"
  16. style="margin-bottom: -18rpx">
  17. 第{{ i + 1 }}步
  18. </view>
  19. <view class="w-full bg-back-light rounded-10 flex flex-col items-center pt-36 pb-22"
  20. style="box-shadow: 1px 2px 0px 0px #DCF8BC;">
  21. <view>
  22. <view class="text-24 text-fore-title flex items-center gap-12">
  23. <view class="font-bold">{{ m.title }}</view>
  24. <view class="bg-black rounded-full p-4">
  25. <uv-icon name="arrow-right" color="white" size="6" />
  26. </view>
  27. </view>
  28. <view class="mt-3 text-22 text-fore-tip">{{ m.desc }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script setup lang="ts">
  36. import { routes } from "@/common/routes";
  37. import { useTransferPage } from "@/hooks/useTransferPage";
  38. import { useUserStore } from "@/store/userStore";
  39. import { getVoluntaryRule } from "@/api/modules/voluntary";
  40. interface SiteMap {
  41. title: string;
  42. desc: string;
  43. pagePath: string;
  44. handler?: () => void
  45. }
  46. const userStore = useUserStore()
  47. const { transferTo } = useTransferPage()
  48. const ruleRefId = ref('');
  49. const goSimulate = async () => {
  50. const isLogin = await userStore.checkLogin();
  51. if (isLogin) {
  52. const list = userStore.directedSchoolList || []
  53. const first = list[0] || {}
  54. if (!list.length || first.notice) {
  55. transferTo(routes.studyIndex)
  56. } else {
  57. transferTo(routes.studySimulate, {
  58. data: first
  59. });
  60. }
  61. }
  62. }
  63. const maps = computed<SiteMap[]>(() => [{
  64. title: '本省规则',
  65. desc: '填志愿不踩坑',
  66. pagePath: ruleRefId.value ? routes.newsDetail + '?id=' + ruleRefId.value : ''
  67. }, {
  68. title: '自我评价',
  69. desc: '了解自身优势',
  70. pagePath: routes.pageTestCenter
  71. }, {
  72. title: '职业规划',
  73. desc: '锁定职业方向',
  74. pagePath: routes.careerIndex
  75. }, {
  76. title: '了解专业',
  77. desc: '选择对口专业',
  78. pagePath: routes.majorIndex
  79. }, {
  80. title: '锁定院校',
  81. desc: '了解院校实力',
  82. pagePath: routes.universityIndex
  83. }, {
  84. title: '定向刷题',
  85. desc: '根据考纲练习',
  86. pagePath: routes.studyIndex
  87. }, {
  88. title: '模拟测试',
  89. desc: '全真模拟',
  90. pagePath: '',
  91. handler: goSimulate
  92. }, {
  93. title: userStore.isVHS ? '测技能分' : '测录取率',
  94. desc: userStore.isVHS ? '精准定位' : '录取风险评估',
  95. pagePath: userStore.isVHS ? routes.skillIndex : routes.voluntaryIndex
  96. }])
  97. const location = computed(() => userStore.getLocation);
  98. const handleMap = (m: SiteMap) => {
  99. if (m.handler) return m.handler()
  100. if (!m.pagePath) return
  101. transferTo(m.pagePath)
  102. }
  103. const loadData = () => {
  104. getVoluntaryRule().then(res => {
  105. if (res.rows.length) {
  106. ruleRefId.value = res.rows[0].refIds;
  107. } else {
  108. ruleRefId.value = '';
  109. }
  110. });
  111. }
  112. onLoad(() => {
  113. loadData();
  114. });
  115. watch(location, () => {
  116. if (location.value) {
  117. loadData();
  118. }
  119. });
  120. </script>
  121. <style scoped></style>