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:
liucheng
2026-07-25 11:03:02 +08:00
parent 3e1d3bd05e
commit e712741425
9 changed files with 190 additions and 3 deletions
+24 -1
View File
@@ -470,5 +470,28 @@ Page({
// No-op handler for catchtouchmove. Swallows move events that would
// otherwise bubble to underlying timer page controls (causing missed
// taps on the completion modal).
onNoop() { /* swallow */ }
onNoop() { /* swallow */ },
/**
* 分享给朋友。训练完成弹窗里的分享按钮会走到这里,标题里拼上用户
* 刚才撑了多久,转化率更高;右上角"···"菜单也共用同一份文案。
*/
onShareAppMessage() {
const elapsed = this.data.completionElapsed || this.data.duration
const s = config.share.timer
return {
title: s.titleTemplate.replace('{elapsed}', elapsed),
path: s.path
}
},
/**
* 分享到朋友圈,同样带上刚完成的时长晒成绩。
*/
onShareTimeline() {
const elapsed = this.data.completionElapsed || this.data.duration
return {
title: config.share.timer.timelineTitleTemplate.replace('{elapsed}', elapsed)
}
}
})
+10
View File
@@ -164,6 +164,16 @@
<view class="completion-btn" bindtap="onViewRecords">
<text>查看记录</text>
</view>
<!-- openType="share" 会触发 Page.onShareAppMessage(已实现),
没有这个属性 + onShareAppMessage 时分享按钮就是灰色的。
ui-btn 透传 openType 到内部原生 button。 -->
<ui-btn
variant="ghost"
size="md"
customStyle="flex:1; height:88rpx;"
text="分享"
openType="share"
></ui-btn>
</view>
<view class="completion-btn completion-btn--text" bindtap="onCloseCompletion">
<text>回到首页</text>