修改顶部ui前备份

This commit is contained in:
lym
2026-03-23 18:13:09 +08:00
parent 14eee2489c
commit d5f2104fbb
4 changed files with 117 additions and 13 deletions

View File

@@ -158,13 +158,13 @@ Page( {
})
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.canvasToTempFilePath({
canvasId: "myCanvas"+(that.data.selindex==0?"":(that.data.selindex==1?"0":"1")),
destWidth: 405,
destHeight: 720,
canvas: (that.data.selindex==0?mCanvas:(that.data.selindex==1?mCanvas0:mCanvas1)),
success: function(res0) {
// 获取图片路径
const tempFilePath = res0.tempFilePath;
wx.saveImageToPhotosAlbum({
@@ -187,17 +187,48 @@ Page( {
})
}
})
},
fail: function(err) {
console.log('saveImageToPhotosAlbum fail:', err);
if (err.errMsg.indexOf('auth deny') > -1 || err.errMsg.indexOf('authorize') > -1) {
wx.showModal({
title: '提示',
content: '需要授权保存到相册权限',
confirmText: '去授权',
success: function (res) {
if (res.confirm) {
wx.openSetting({
success: function(settingRes) {
if (settingRes.authSetting['scope.writePhotosAlbum']) {
that.onsavepic(e);
}
}
})
}
}
})
} else {
wx.showToast({
title: '保存失败:' + err.errMsg,
icon: "none",
duration: 3000
})
}
that.setData({
savetitle:"保存二维码到相册"
})
}
})
},
fail: function(err) {
console.log('canvasToTempFilePath fail:', err);
wx.showToast({
title: err,
title: '生成图片失败:' + err.errMsg,
icon: "none",
duration: 10000
duration: 3000
})
that.setData({
savetitle:"保存二维码到相册"
})
}
})