优化阅读页跳转逻辑,优先传递章节中间ID(mid),以提升分享功能的一致性。更新相关页面以支持新逻辑,确保用户体验流畅。增加退款功能的相关处理,支持订单退款及退款原因的记录,增强订单管理的灵活性。

This commit is contained in:
Alex-larget
2026-02-28 10:19:46 +08:00
parent 9f77d1cfe2
commit 8af2d808f9
62 changed files with 1168 additions and 1798 deletions

View File

@@ -37,8 +37,16 @@ Page({
async loadHotChapters() {
try {
const res = await app.request('/api/miniprogram/book/hot')
if (res && res.success && res.chapters?.length > 0) {
this.setData({ hotChapters: res.chapters })
const list = (res && res.data) || (res && res.chapters) || []
if (list.length > 0) {
const hotChapters = list.map((c, i) => ({
id: c.id,
mid: c.mid ?? c.MID ?? 0,
title: c.section_title || c.sectionTitle || c.title || c.chapterTitle || '',
part: c.part_title || c.partTitle || c.part || '',
tag: ['免费', '热门', '推荐', '最新'][i % 4] || '热门'
}))
this.setData({ hotChapters })
}
} catch (e) {
console.log('加载热门章节失败,使用默认数据')
@@ -97,10 +105,12 @@ Page({
}
},
// 跳转阅读
// 跳转阅读(优先传 mid与分享逻辑一致
goToRead(e) {
const id = e.currentTarget.dataset.id
wx.navigateTo({ url: `/pages/read/read?id=${id}` })
const mid = e.currentTarget.dataset.mid || app.getSectionMid(id)
const q = mid ? `mid=${mid}` : `id=${id}`
wx.navigateTo({ url: `/pages/read/read?${q}` })
},
// 返回上一页