Commit b84a5923 authored by Damon's avatar Damon

fix: 相册授权提示

parent 951fbef2
...@@ -72,17 +72,27 @@ ...@@ -72,17 +72,27 @@
return return
} }
let path = '' let path = ''
let pass = true
if(photo.tempPath.origin && photo?.waterSetting?.hasOrigin){ if(photo.tempPath.origin && photo?.waterSetting?.hasOrigin){
// 保存原图到本地 // 保存原图到本地
path = photo.tempPath.origin path = photo.tempPath.origin
this.saveLocal(path).then(res => { await this.saveLocal(path).then(res => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '已将照片原图保存到本地相册' title: '已将照片原图保存到本地相册'
}) })
}) }).catch(e => {
uni.showToast({
icon: 'none',
title: e
})
pass = false
that.$parent.goBack()
})
} }
// 如果用户不同意保存到相册
if(!pass) return
if(photo.tempPath.mixWater){ if(photo.tempPath.mixWater){
// 保存水印处理图片到本地 // 保存水印处理图片到本地
path = photo.tempPath.mixWater path = photo.tempPath.mixWater
...@@ -97,7 +107,7 @@ ...@@ -97,7 +107,7 @@
icon: 'none', icon: 'none',
title: e title: e
}) })
resolve() that.$parent.goBack()
}) })
} }
}) })
...@@ -110,7 +120,24 @@ ...@@ -110,7 +120,24 @@
resolve(true) resolve(true)
}, },
fail(e) { fail(e) {
reject('保存失败') uni.showModal({
content: '拒绝授权将无法保存图片到本地,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success(res) {
if (res.confirm) {
wx.openSetting({
success(res) {
resolve(true)
}
})
} else if(res.cancel) {
reject('保存失败')
}
},
fail() {
}
})
} }
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment