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
+25
View File
@@ -3,6 +3,7 @@ const planMod = require('../../utils/plan')
const util = require('../../utils/util')
const themeMod = require('../../utils/theme')
const iconsMod = require('../../utils/icons')
const config = require('../../config')
const MAX_CUSTOM_DURATION = 3600 // 1 hour max
@@ -190,5 +191,29 @@ Page({
}
this.setData({ showPicker: false })
wx.navigateTo({ url: `/pages/timer/timer?free=${dur}` })
},
/**
* 分享给朋友。微信在用户点击右上角"···"菜单里的"转发给朋友"、
* 或者页面内任何 `<button open-type="share">` / `<button open-type="share">`
* 时,都会调用这个钩子,返回值即分享卡片的内容。
* 没声明这个方法时分享按钮就是灰色的,见上轮分析。
*/
onShareAppMessage() {
const s = config.share.default
return {
title: s.title,
path: s.path
}
},
/**
* 分享到朋友圈。基础库 2.11.3+ 可用。同样不实现就让"分享到朋友圈"按钮
* 灰掉。各页统一用 config.share.timelineTitle 作为朋友圈文案。
*/
onShareTimeline() {
return {
title: config.share.timelineTitle
}
}
})