修复再来一单问题

This commit is contained in:
2025-12-16 17:00:32 +08:00
parent 251490e3ab
commit 645122c182
9 changed files with 170 additions and 84 deletions

View File

@@ -100,17 +100,61 @@ function close() {
function save() {
show.value = false;
// 保存图片到相册
uni.saveImageToPhotosAlbum({
filePath: code.value,
success: function () {
uni.showToast({
title: "保存成功",
icon: 'none'
});
},
fail: function () {
uni.showToast({
title: "保存失败",
});
fail: function (err) {
console.log('保存失败原因:', err);
// 判断是否为授权拒绝(微信小程序授权拒绝的特征)
if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize fail')) {
// 弹出提示引导用户去设置页开启授权
uni.showModal({
title: '授权提示',
content: '保存图片需要授权访问相册,请前往设置开启授权',
showCancel: true,
cancelText: '取消',
confirmText: '去设置',
success: function (res) {
if (res.confirm) {
// 跳转到微信小程序的授权设置页
uni.openSetting({
success: function (settingRes) {
// 检查用户是否开启了相册授权
if (settingRes.authSetting['scope.writePhotosAlbum']) {
uni.showToast({
title: '授权成功,可重新保存',
icon: 'none'
});
} else {
uni.showToast({
title: '未开启授权,保存失败',
icon: 'none'
});
}
},
fail: function () {
uni.showToast({
title: '打开设置失败',
icon: 'none'
});
}
});
}
}
});
} else {
// 非授权问题的保存失败(如文件路径错误、系统问题等)
uni.showToast({
title: "保存失败",
icon: 'none'
});
}
},
});

View File

@@ -612,6 +612,9 @@ const showInviteCode = computed(() => {
) {
return true;
}
if( config.openType == "auto" ){
return true;
}
if (!state.distributionUser && config.openType == "manual") {
return true;
}