feat: 首页推荐逻辑-排除序言尾声,精选按点击量,小程序接入featuredSections

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
卡若
2026-02-21 20:59:22 +08:00
parent 7551840c86
commit e91a5d9f7a
3 changed files with 105 additions and 18 deletions

View File

@@ -145,15 +145,19 @@ Page({
this.setData({ latestSection: selected, latestLabel: '为你推荐' })
},
// 加载书籍数据
// 加载书籍数据(含精选推荐,按后端点击量排序)
async loadBookData() {
try {
const res = await app.request('/api/book/all-chapters')
if (res && res.data) {
this.setData({
const setData = {
bookData: res.data,
totalSections: res.totalSections || 62
})
totalSections: res.totalSections || res.data?.length || 62
}
if (res.featuredSections && res.featuredSections.length) {
setData.featuredSections = res.featuredSections
}
this.setData(setData)
}
} catch (e) {
console.error('加载书籍数据失败:', e)