feat: 首页推荐逻辑-排除序言尾声,精选按点击量,小程序接入featuredSections
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user