feat: 定合并的稳定版本

This commit is contained in:
Alex-larget
2026-03-17 13:17:49 +08:00
parent fcc05b6420
commit 2f35520670
44 changed files with 2754 additions and 859 deletions

View File

@@ -44,7 +44,10 @@ Page({
dailyChapters: [],
// book/parts 加载中
partsLoading: true
partsLoading: true,
// 功能配置(搜索开关)
searchEnabled: true
},
onLoad() {
@@ -57,6 +60,24 @@ Page({
this.loadVipStatus()
this.loadParts()
this.loadDailyChapters()
this.loadFeatureConfig()
},
async loadFeatureConfig() {
try {
if (app.globalData.features && typeof app.globalData.features.searchEnabled === 'boolean') {
this.setData({ searchEnabled: app.globalData.features.searchEnabled })
return
}
const res = await app.request({ url: '/api/miniprogram/config', silent: true })
const features = (res && res.features) || {}
const searchEnabled = features.searchEnabled !== false
if (!app.globalData.features) app.globalData.features = {}
app.globalData.features.searchEnabled = searchEnabled
this.setData({ searchEnabled })
} catch (e) {
this.setData({ searchEnabled: true })
}
},
// 懒加载:仅拉取篇章列表 + totalSections + fixedSections
@@ -280,6 +301,7 @@ Page({
// 跳转到搜索页
goToSearch() {
if (!this.data.searchEnabled) return
trackClick('chapters', 'nav_click', '搜索')
wx.navigateTo({ url: '/pages/search/search' })
},

View File

@@ -5,7 +5,7 @@
<view class="nav-bar" style="padding-top: {{statusBarHeight}}px;">
<view class="nav-content">
<view class="nav-left">
<view class="search-btn" bindtap="goToSearch">
<view class="search-btn" wx:if="{{searchEnabled}}" bindtap="goToSearch">
<text class="search-icon">🔍</text>
</view>
</view>