hookehuyr

refactor(首页): 拆分 viewMore 函数为独立跳转函数

- 新增 5 个独立函数:viewMoreCeremony、viewMoreThreeAltars、viewMoreMasters、viewMoreStudents、viewMoreVolunteers
- 三坛大戒参考法会流程,跳转新闻详情页
- 移除 viewMore 分发函数,模板直接调用独立函数
- 提升代码可维护性和可读性

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
......@@ -90,7 +90,7 @@
<div class="decorative-line" :style="decorativeLineStyle"></div>
<!-- 查看更多按钮 -->
<div class="more-button" @click="viewMore('法会流程', currentStep)">
<div class="more-button" @click="viewMoreCeremony(currentStep)">
<span class="more-text">查看更多</span>
</div>
</div>
......@@ -113,7 +113,7 @@
<div class="vertical-overlay"></div>
<div class="vertical-text">
<h3 class="vertical-title">{{ item.name }}</h3>
<div class="vertical-more-btn" @click="viewMore(item.name, item)">
<div class="vertical-more-btn" @click="viewMoreThreeAltars(item)">
<span class="more-text">查看更多</span>
</div>
</div>
......@@ -137,7 +137,7 @@
<div class="column-overlay"></div>
<div class="column-text">
<h3 class="column-title">{{ item.name }}</h3>
<div class="more-button" @click="viewMore(item.name, item)">
<div class="more-button" @click="viewMoreMasters(item)">
<span class="more-text">查看更多</span>
</div>
</div>
......@@ -481,42 +481,49 @@ watch(currentStep, () => {
calculateLinePosition()
}, { deep: true })
// 查看更多按钮点击事件
const viewMore = (type, item) => {
switch (type) {
case '法会流程':
// 暂时使用 articles[0]['id'] 作为 id 跳转到新闻详情页
if (!item.articles.length) {
// 法会流程 - 跳转新闻详情页
const viewMoreCeremony = (item) => {
if (!item.articles?.length) {
showToast('暂无相关新闻')
return
}
router.push({ name: 'NewsDetail', params: { id: item.articles[0]['id'] } })
break
case '临坛十师':
// 跳转到临坛十师页面的逻辑
}
// 三坛大戒 - 参考法会流程,跳转新闻详情页
const viewMoreThreeAltars = (item) => {
if (!item.articles?.length) {
showToast('暂无相关新闻')
return
}
router.push({ name: 'NewsDetail', params: { id: item.articles[0]['id'] } })
}
// 临坛十师 - 外部链接或内部页面
const viewMoreMasters = (item) => {
if (item?.category_link) {
location.href = item?.category_link;
location.href = item?.category_link
} else {
router.push(`/masters?pid=${item.id}`)
}
break
case '戒子':
// 跳转到戒子页面的逻辑
}
// 戒子 - 外部链接或内部页面
const viewMoreStudents = (item) => {
if (item?.category_link) {
location.href = location.origin + location.pathname + '#/' + item?.category_link;
location.href = location.origin + location.pathname + '#/' + item?.category_link
} else {
router.push(`/students?i=${item.id}`)
}
break
case '义工':
// 跳转到义工页面的逻辑
}
// 义工 - 外部链接或内部页面
const viewMoreVolunteers = (item) => {
if (item?.category_link) {
location.href = location.origin + location.pathname + '#/' + item?.category_link;
location.href = location.origin + location.pathname + '#/' + item?.category_link
} else {
router.push(`/volunteers?i=${item.id}`)
}
break
}
}
// 新闻轮播相关逻辑
......