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 @@ ...@@ -137,7 +137,7 @@
137 <div class="column-overlay"></div> 137 <div class="column-overlay"></div>
138 <div class="column-text"> 138 <div class="column-text">
139 <h3 class="column-title">{{ item.name }}</h3> 139 <h3 class="column-title">{{ item.name }}</h3>
140 - <div class="more-button" @click="viewMoreMasters(item)"> 140 + <div class="more-button" @click="viewMoreByCategory(item)">
141 <span class="more-text">查看更多</span> 141 <span class="more-text">查看更多</span>
142 </div> 142 </div>
143 </div> 143 </div>
...@@ -499,30 +499,31 @@ const viewMoreThreeAltars = (item) => { ...@@ -499,30 +499,31 @@ const viewMoreThreeAltars = (item) => {
499 router.push({ name: 'NewsDetail', params: { id: item.articles[0]['id'] } }) 499 router.push({ name: 'NewsDetail', params: { id: item.articles[0]['id'] } })
500 } 500 }
501 501
502 -// 临坛十师 - 外部链接或内部页面 502 +// 临坛十师/戒子/义工 - 统一处理,使用 category_sn 判断类型
503 -const viewMoreMasters = (item) => { 503 +const viewMoreByCategory = (item) => {
504 + // 优先使用外部链接
504 if (item?.category_link) { 505 if (item?.category_link) {
505 location.href = item?.category_link 506 location.href = item?.category_link
506 - } else { 507 + return
507 - router.push(`/masters?pid=${item.id}`)
508 - }
509 -}
510 -
511 -// 戒子 - 外部链接或内部页面
512 -const viewMoreStudents = (item) => {
513 - if (item?.category_link) {
514 - location.href = location.origin + location.pathname + '#/' + item?.category_link
515 - } else {
516 - router.push(`/students?i=${item.id}`)
517 } 508 }
518 -}
519 509
520 -// 义工 - 外部链接或内部页面 510 + // 根据 category_sn 判断类型(避免中文名称变化)
521 -const viewMoreVolunteers = (item) => { 511 + const categorySN = item?.category_sn
522 - if (item?.category_link) { 512 +
523 - location.href = location.origin + location.pathname + '#/' + item?.category_link 513 + // TODO: 确认实际的 category_sn 值,以下为推测值
524 - } else { 514 + switch (categorySN) {
525 - router.push(`/volunteers?i=${item.id}`) 515 + case 'stdj_ssqz': // 临坛十师
516 + router.push(`/masters?pid=${item.id}`)
517 + break
518 + case 'stdj_jz': // 戒子
519 + router.push(`/students?i=${item.id}`)
520 + break
521 + case 'stdj_yg': // 义工
522 + router.push(`/volunteers?i=${item.id}`)
523 + break
524 + default:
525 + // 默认行为:临坛十师
526 + router.push(`/masters?pid=${item.id}`)
526 } 527 }
527 } 528 }
528 529
......