feat: production readiness — feature gaps + config hardening

Miniprogram:
- Add BLE reconnect button on home page when disconnected
- Add loading states to index, profile, subscribe-plans pages
- Add profile editing (avatar + nickname) with COS upload
- Enable pull-to-refresh on history page
- Fix auto-scan self.options → self.data inconsistency
- Add console.error to silent catch blocks
- Gate 'Simple Peripheral' BLE scan behind __DEV__ flag
- Add production config comment to env.js

Admin console:
- Add empty state '暂无数据' to all 5 list views
- Replace plain text plan input with select dropdown
- Add type="date" to record date filters
- Add production config comment

Server:
- CORS origin restricted in production (env CORS_ORIGIN)
- DB pool size configurable via DB_POOL_SIZE env var
- .env.example updated with WeChat Pay + production fields
这个提交包含在:
Guoguo
2026-05-15 09:07:41 -07:00
父节点 7e036576e3
当前提交 92416261ee
修改 23 个文件,包含 421 行新增33 行删除
@@ -8,7 +8,8 @@ Page({
selected: 'yearly',
purchasing: false,
subscription: null,
subRemaining: 0
subRemaining: 0,
loadingPlans: true
},
onBack: function () {
@@ -31,6 +32,7 @@ Page({
loadPlans: function () {
var self = this
self.setData({ loadingPlans: true })
api.getPlans().then(function (data) {
var serverPlans = data.plans || []
var monthlyPrice = 99
@@ -54,9 +56,11 @@ Page({
}
})
if (plans.length > 0) self.setData({ plans: plans })
self.setData({ loadingPlans: false })
self.checkTrialUsed()
}).catch(function () {
self.setData({
loadingPlans: false,
plans: [
{ key: 'trial', name: '试用', price: 0, priceLabel: '免费', desc: '7天免费体验', disabled: false },
{ key: 'monthly', name: '月卡', price: 99, priceLabel: '¥99', desc: '约3.3元/天' },
@@ -20,7 +20,12 @@
<view class="page-title">选择订阅套餐</view>
<view class="service-card">
<view class="loading-plans" wx:if="{{loadingPlans}}">
<view class="loading-spinner"></view>
<text class="loading-text">加载套餐中...</text>
</view>
<view class="service-card" wx:if="{{!loadingPlans}}">
<view class="service-icon">✨</view>
<view class="service-info">
<view class="service-name">智能模式</view>
@@ -28,7 +33,7 @@
</view>
</view>
<view class="plans">
<view class="plans" wx:if="{{!loadingPlans}}">
<view class="plan {{selected === item.key ? 'selected' : ''}} {{item.disabled ? 'plan-disabled' : ''}}" wx:for="{{plans}}" wx:key="key" bindtap="{{item.disabled ? '' : 'onSelect'}}" data-plan="{{item.key}}">
<view class="plan-tag {{item.disabled ? 'plan-tag-disabled' : (selected === item.key ? 'plan-tag-active' : '')}}" wx:if="{{item.tag}}">{{item.tag}}</view>
<view class="plan-price">{{item.priceLabel}}</view>
@@ -37,9 +42,11 @@
</view>
</view>
<button class="btn-primary btn-primary-gold" bindtap="onPurchase" disabled="{{purchasing}}" loading="{{purchasing}}">
{{subscription && subscription.status === 'active' && subRemaining > 0 ? '续费' : '确认支付'}}
</button>
<view class="agreement" bindtap="onAgreement">支付即表示同意《订阅协议》</view>
<block wx:if="{{!loadingPlans}}">
<button class="btn-primary btn-primary-gold" bindtap="onPurchase" disabled="{{purchasing}}" loading="{{purchasing}}">
{{subscription && subscription.status === 'active' && subRemaining > 0 ? '续费' : '确认支付'}}
</button>
<view class="agreement" bindtap="onAgreement">支付即表示同意《订阅协议》</view>
</block>
</view>
</view>
@@ -128,3 +128,30 @@
background: #ccc;
color: #fff;
}
.loading-plans {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 80rpx 0;
}
.loading-spinner {
width: 64rpx;
height: 64rpx;
border: 6rpx solid #f0f0f0;
border-top-color: #DCB982;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-text {
margin-top: 20rpx;
font-size: 28rpx;
color: #999;
}