feat(share): 启用全站系统分享 + 完善分享文案配置
- 各 Page 补齐 onShareAppMessage/onShareTimeline,修复右上角转发/朋友圈按钮灰色 - ui-btn 透传 open-type,完成弹窗接入分享按钮 - config.share 集中维护文案,动态标题用 titleTemplate 占位符 - leaderboard 的 myEntry.rank 缺失时回退静态标题,避免出现"排第 undefined" - 完成弹窗分享按钮高度对齐 88rpx,与同排按钮等高 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -120,5 +120,32 @@ Page({
|
||||
} else {
|
||||
this.setData({ loading: false, empty: true })
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 分享给朋友 — 排行榜页。把用户当前名次写进标题,有"攀比"属性,
|
||||
* 分享欲望会强一些。
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
const me = this.data.myEntry
|
||||
const s = config.share.leaderboard
|
||||
// myEntry.rank 依赖云函数返回,缺失时回退静态 title,避免出现"排第 undefined"
|
||||
if (me && me.rank) {
|
||||
const periodLabel = { day: '日', month: '月', year: '年' }[this.data.activePeriod] || ''
|
||||
return {
|
||||
title: s.titleTemplate.replace('{period}', periodLabel).replace('{rank}', me.rank),
|
||||
path: s.path
|
||||
}
|
||||
}
|
||||
return { title: s.title, path: s.path }
|
||||
},
|
||||
|
||||
/**
|
||||
* 分享到朋友圈。
|
||||
*/
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: config.share.timelineTitle
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user