优化海报保存逻辑,提升导出清晰度,兼容 iOS 设备。更新相关注释以反映画布尺寸和导出分辨率的变化。同时,调整小程序环境变量处理逻辑,确保生成的版本码正确,避免开发版过期问题。
This commit is contained in:
@@ -1210,14 +1210,15 @@ Page({
|
||||
this.setData({ showPosterModal: false })
|
||||
},
|
||||
|
||||
// 保存海报到相册(与海报绘制尺寸一致,必须传 destWidth/destHeight 否则部分机型导出失败)
|
||||
// 保存海报到相册:画布 300x450 兼容 iOS,导出 2 倍 600x900 提升清晰度(宽高比 2:3 不变)
|
||||
savePoster() {
|
||||
const width = 300
|
||||
const height = 450
|
||||
const exportScale = 2
|
||||
wx.canvasToTempFilePath({
|
||||
canvasId: 'posterCanvas',
|
||||
destWidth: width,
|
||||
destHeight: height,
|
||||
destWidth: width * exportScale,
|
||||
destHeight: height * exportScale,
|
||||
fileType: 'png',
|
||||
success: (res) => {
|
||||
if (!res.tempFilePath) {
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
<view class="modal-close" bindtap="closePosterModal">✕</view>
|
||||
</view>
|
||||
|
||||
<!-- 海报预览 -->
|
||||
<!-- 海报预览:画布 300x450 避免 iOS transform 裁切;保存时导出 2 倍分辨率 -->
|
||||
<view class="poster-preview">
|
||||
<canvas canvas-id="posterCanvas" class="poster-canvas" style="width: 300px; height: 450px;"></canvas>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user