2025-03-04.md
3.62 KB
2025-03-04 今日任务
需求概述
-
法会流程跳转修改:从跳转链接改成读取
sn作为 id,跳转到新闻详情页 - 新增三坛大戒栏目:接口需要新增字段返回
- viewMore 函数拆分:拆成 4 个独立的跳转函数
✅ 任务 1:法会流程跳转修改(已完成)
修改内容
- 移除了
category_link判断逻辑 - 使用
item.parent_sn作为路由参数跳转到新闻详情页
实现代码
// src/views/Home.vue:472-475
const viewMoreCeremony = (item) => {
router.push({ name: 'NewsDetail', params: { id: item.parent_sn || item.id } })
}
模板更新
<!-- src/views/Home.vue:93 -->
<div class="more-button" @click="viewMoreCeremony(currentStep)">
✅ 任务 3:viewMore 函数拆分(已完成)
实现内容
将 viewMore 函数拆分为 4 个独立函数:
-
viewMoreCeremony- 法会流程 -
viewMoreMasters- 三师七证 -
viewMoreStudents- 戒子 -
viewMoreVolunteers- 义工 -
viewMoreByType- 辅助分发函数(根据 item.name 分发)
实现代码
// 法会流程 - 使用 parent_sn 跳转到新闻详情页
const viewMoreCeremony = (item) => {
router.push({ name: 'NewsDetail', params: { id: item.parent_sn || item.id } })
}
// 三师七证
const viewMoreMasters = (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}`)
}
}
// 义工
const viewMoreVolunteers = (item) => {
if (item?.category_link) {
location.href = location.origin + location.pathname + '#/' + item?.category_link
} else {
router.push(`/volunteers?i=${item.id}`)
}
}
// 辅助函数:根据 item.name 分发到对应的处理函数
const viewMoreByType = (item) => {
const typeMap = {
'三师七证': viewMoreMasters,
'戒子': viewMoreStudents,
'义工': viewMoreVolunteers,
}
const handler = typeMap[item.name]
if (handler) {
handler(item)
} else {
viewMoreMasters(item) // 默认行为
}
}
模板更新
<!-- 法会流程:直接调用 viewMoreCeremony -->
<div class="more-button" @click="viewMoreCeremony(currentStep)">
<!-- 其他分类:使用 viewMoreByType 分发 -->
<div class="vertical-more-btn" @click="viewMoreByType(item)">
<div class="more-button" @click="viewMoreByType(item)">
⏳ 任务 2:新增三坛大戒栏目(等待后端接口)
当前接口数据结构
// 接口返回:/srv/?a=home&f=stdj×tamp=xxx
{
STDJSSQZ: [...], // 三师七证
STDJFHLC: [...], // 法会流程
STDJXGXW: [...], // 相关新闻
}
需要新增
- 新增字段
STDJSTDJ(三坛大戒) - 包含栏目信息和文章列表
前端需要处理
- 更新
src/api/index.js的 API 文档注释 - 添加新的数据展示区块(类似法会流程的展示方式)
- 添加对应的查看更多跳转函数
依赖:后端接口开发
完成情况
| 任务 | 状态 | 说明 |
|---|---|---|
| 任务 1 | ✅ 已完成 | 法会流程跳转逻辑修改 |
| 任务 3 | ✅ 已完成 | viewMore 函数拆分(代码优化) |
| 任务 2 | ⏳ 等待后端 | 依赖后端接口新增字段 |
注意事项
- ✅ 法会流程使用
parent_sn作为路由参数 - ⏳ 新增三坛大戒栏目需要后端配合开发
- ✅ 拆分函数后模板调用已更新