hookehuyr

fix(Home): 处理法会流程和三师七证链接不存在的情况

当法会流程没有跳转链接时显示提示信息,三师七证没有链接时跳转到默认页面
...@@ -157,6 +157,8 @@ import { ref, computed, nextTick, onMounted, watch } from 'vue' ...@@ -157,6 +157,8 @@ import { ref, computed, nextTick, onMounted, watch } from 'vue'
157 import VideoPlayer from '@/components/VideoPlayer.vue' 157 import VideoPlayer from '@/components/VideoPlayer.vue'
158 import { useTitle } from '@vueuse/core'; 158 import { useTitle } from '@vueuse/core';
159 import { useRouter } from 'vue-router' 159 import { useRouter } from 'vue-router'
160 +import { showToast } from 'vant'
161 +
160 162
161 // 导入接口 163 // 导入接口
162 import { homePageAPI } from '@/api/index.js' 164 import { homePageAPI } from '@/api/index.js'
...@@ -284,12 +286,17 @@ const viewMore = (type, item) => { ...@@ -284,12 +286,17 @@ const viewMore = (type, item) => {
284 switch (type) { 286 switch (type) {
285 case '法会流程': 287 case '法会流程':
286 // 跳转页面 288 // 跳转页面
287 - location.href = item.category_link; 289 + if (item?.category_link) {
290 + location.href = item?.category_link;
291 + } else {
292 + // 提示用户没有详情页
293 + showToast('该法会流程没有跳转链接')
294 + }
288 break 295 break
289 case '三师七证': 296 case '三师七证':
290 // 跳转到三师七证页面的逻辑 297 // 跳转到三师七证页面的逻辑
291 - if (item.category_link) { 298 + if (item?.category_link) {
292 - location.href = item.category_link; 299 + location.href = item?.category_link;
293 } else { 300 } else {
294 router.push(`/masters?pid=${item.id}`) 301 router.push(`/masters?pid=${item.id}`)
295 } 302 }
......