Enhance mini program environment configuration and chapter loading logic

- Introduced a debugging environment configuration in app.js, allowing for dynamic API endpoint selection based on the environment.
- Implemented lazy loading for chapter parts in chapters.js, improving performance by only fetching necessary data.
- Updated UI elements in chapters.wxml to reflect changes in chapter loading and added loading indicators.
- Enhanced error handling and data management for chapter retrieval, ensuring a smoother user experience.
- Added functionality for switching API environments in settings.js, visible only in development mode.
This commit is contained in:
Alex-larget
2026-03-14 18:04:05 +08:00
parent 1edceda4db
commit d82ef6d8e4
22 changed files with 1184 additions and 899 deletions

View File

@@ -73,13 +73,20 @@ Page({
contactWechat: '',
contactSaving: false,
pendingWithdraw: false,
// 设置入口:开发版、体验版显示
showSettingsEntry: false,
},
onLoad() {
wx.showShareMenu({ withShareTimeline: true })
const accountInfo = wx.getAccountInfoSync ? wx.getAccountInfoSync() : null
const envVersion = accountInfo?.miniProgram?.envVersion || ''
const showSettingsEntry = envVersion === 'develop' || envVersion === 'trial'
this.setData({
statusBarHeight: app.globalData.statusBarHeight,
navBarHeight: app.globalData.navBarHeight
navBarHeight: app.globalData.navBarHeight,
showSettingsEntry
})
this.loadFeatureConfig()
this.initUserStatus()

View File

@@ -154,7 +154,7 @@
</view>
<text class="menu-arrow"></text>
</view>
<view class="menu-item" wx:if="{{false}}" bindtap="handleMenuTap" data-id="settings">
<view class="menu-item" wx:if="{{showSettingsEntry}}" bindtap="handleMenuTap" data-id="settings">
<view class="menu-left">
<view class="menu-icon-wrap icon-gray"><image class="menu-icon-img" src="/assets/icons/settings-gray.svg" mode="aspectFit"/></view>
<text class="menu-text">设置</text>