fix(fe): 成长海报的「保存/分享」原来是个装饰按钮
报告页 → 分享卡片,弹层底部那个「保存 / 分享卡片」按钮绑的是 bindtap="close" —— 点了只是把弹层关掉,既不保存也不分享。按钮文案 承诺了两件事,一件也没做。 拆成两个真按钮: - 分享给朋友:走微信原生 open-type="share",转发标题带上宠物名 - 保存到相册:把海报画进离屏 canvas 再存相册 canvas 部分的几个坑: - 画布用 position:fixed 挪到屏幕外,不能 display:none —— 那样 selectorQuery 取不到节点 - 按 pixelRatio 放大再 scale,否则高分屏上导出的图是糊的 - 相册权限被拒过一次后 wx.authorize 不会再弹,必须 wx.openSetting 引导,否则这里会永远静默失败——正是这次要修的那类问题 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -198,7 +198,14 @@ module.exports.sel = function (map, key, index, def) {
|
||||
<view class="bold">健康状态:{{poster ? poster.headline : '稳定成长'}}</view>
|
||||
<view class="muted" style="font-size:24rpx;margin-top:20rpx">生成自:肉垫计划</view>
|
||||
</view>
|
||||
<button class="btn btn-primary btn-block" style="margin-top:28rpx" bindtap="close">保存 / 分享卡片</button>
|
||||
<view class="sheet-actions" style="margin-top:28rpx">
|
||||
<button class="btn btn-ghost" open-type="share">分享给朋友</button>
|
||||
<button class="btn btn-primary" bindtap="onSavePoster" disabled="{{posterSaving}}">
|
||||
{{posterSaving ? '生成中…' : '保存到相册'}}
|
||||
</button>
|
||||
</view>
|
||||
<!-- 离屏画布:海报要存成图片才能进相册。不能用 display:none,否则取不到节点 -->
|
||||
<canvas type="2d" id="posterCanvas" class="poster-canvas"></canvas>
|
||||
</block>
|
||||
|
||||
<!-- 报告详情 -->
|
||||
|
||||
Reference in New Issue
Block a user