fix: 移除榜单失败toast,避免无数据时误导用户以为云端故障
日榜无数据是正常业务场景(用户当天未训练),弹toast会 让用户误解为系统故障。本地fallback已提供足够的降级体验。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -66,14 +66,11 @@ Page({
|
|||||||
if (cb) cb()
|
if (cb) cb()
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
// Cloud function not deployed or network error — fall back to
|
// Cloud function not deployed or network error — fall back to
|
||||||
// local data. Only show a toast if we have nothing to display
|
// local data silently. No toast here: empty day-leaderboard is
|
||||||
// yet (avoid confusing toast when a retry already has data).
|
// normal (user didn't train today), and a toast would mislead
|
||||||
|
// them into thinking the cloud is broken.
|
||||||
console.warn('[leaderboard] cloud function failed, using local fallback:', err)
|
console.warn('[leaderboard] cloud function failed, using local fallback:', err)
|
||||||
const hadData = this.data.rankedList && this.data.rankedList.length > 0
|
|
||||||
this._applyLocal()
|
this._applyLocal()
|
||||||
if (!hadData && (!this.data.rankedList || this.data.rankedList.length === 0)) {
|
|
||||||
wx.showToast({ title: '云端榜单暂不可用', icon: 'none', duration: 2000 })
|
|
||||||
}
|
|
||||||
if (cb) cb()
|
if (cb) cb()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user