hookehuyr

refactor(首页): 临坛十师/戒子/义工统一使用 category_sn 判断

- 将 viewMoreMasters/Students/Volunteers 合并为 viewMoreByCategory
- 使用 category_sn 替代中文字符串判断,避免名称变化导致的问题
- 保留 viewMoreCeremony 和 viewMoreThreeAltars 独立函数

待确认:实际的 category_sn 值(当前为推测值)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
......@@ -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="viewMoreMasters(item)">
<div class="more-button" @click="viewMoreByCategory(item)">
<span class="more-text">查看更多</span>
</div>
</div>
......@@ -499,30 +499,31 @@ const viewMoreThreeAltars = (item) => {
router.push({ name: 'NewsDetail', params: { id: item.articles[0]['id'] } })
}
// 临坛十师 - 外部链接或内部页面
const viewMoreMasters = (item) => {
// 临坛十师/戒子/义工 - 统一处理,使用 category_sn 判断类型
const viewMoreByCategory = (item) => {
// 优先使用外部链接
if (item?.category_link) {
location.href = item?.category_link
} else {
router.push(`/masters?pid=${item.id}`)
}
}
// 戒子 - 外部链接或内部页面
const viewMoreStudents = (item) => {
if (item?.category_link) {
location.href = location.origin + location.pathname + '#/' + item?.category_link
} else {
router.push(`/students?i=${item.id}`)
return
}
}
// 义工 - 外部链接或内部页面
const viewMoreVolunteers = (item) => {
if (item?.category_link) {
location.href = location.origin + location.pathname + '#/' + item?.category_link
} else {
router.push(`/volunteers?i=${item.id}`)
// 根据 category_sn 判断类型(避免中文名称变化)
const categorySN = item?.category_sn
// TODO: 确认实际的 category_sn 值,以下为推测值
switch (categorySN) {
case 'stdj_ssqz': // 临坛十师
router.push(`/masters?pid=${item.id}`)
break
case 'stdj_jz': // 戒子
router.push(`/students?i=${item.id}`)
break
case 'stdj_yg': // 义工
router.push(`/volunteers?i=${item.id}`)
break
default:
// 默认行为:临坛十师
router.push(`/masters?pid=${item.id}`)
}
}
......