Commit 1bf1bedf authored by 黄媛媛's avatar 黄媛媛

修改没授权的时候不能保存图片

parent 7e3b1ece
...@@ -126,12 +126,43 @@ export default { ...@@ -126,12 +126,43 @@ export default {
title: "保存成功" title: "保存成功"
}); });
}, },
fail: function(e) { fail: function(err) {
that.$refs.uTips.show({ if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
title: "保存失败,请稍后重试", uni.authorize({
type: "error", scope:'scope.writePhotosAlbum',
duration: "2300" success: (res) => {
}); console.log('11111');
},
fail: (res) => {
uni.showModal({
content:'检测到您没打开保存到相册权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
if(res.authSetting['scope.writePhotosAlbum']){
that.saveImage()
}
}
})
}else{
console.log('取消');
}
}
})
}
})
}else{
that.$refs.uTips.show({
title: "保存失败,请稍后重试",
type: "error",
duration: "2300"
});
}
}, },
complete: function() { complete: function() {
uni.hideLoading(); uni.hideLoading();
......
...@@ -132,12 +132,42 @@ export default { ...@@ -132,12 +132,42 @@ export default {
title: "保存成功", title: "保存成功",
}); });
}, },
fail: function (e) { fail: function (err) {
that.$refs.uTips.show({ if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
title: "保存失败,请稍后重试", uni.authorize({
type: "error", scope:'scope.writePhotosAlbum',
duration: "2300", success: (res) => {
}); console.log('11111');
},
fail: (res) => {
uni.showModal({
content:'检测到您没打开保存到相册权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
if(res.authSetting['scope.writePhotosAlbum']){
that.saveImage()
}
}
})
}else{
console.log('取消');
}
}
})
}
})
}else{
that.$refs.uTips.show({
title: "保存失败,请稍后重试",
type: "error",
duration: "2300"
});
}
}, },
complete: function () { complete: function () {
uni.hideLoading(); uni.hideLoading();
......
...@@ -132,12 +132,42 @@ export default { ...@@ -132,12 +132,42 @@ export default {
title: "保存成功", title: "保存成功",
}); });
}, },
fail: function (e) { fail: function (err) {
that.$refs.uTips.show({ if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
title: "保存失败,请稍后重试", uni.authorize({
type: "error", scope:'scope.writePhotosAlbum',
duration: "2300", success: (res) => {
}); console.log('11111');
},
fail: (res) => {
uni.showModal({
content:'检测到您没打开保存到相册权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
if(res.authSetting['scope.writePhotosAlbum']){
that.saveImage()
}
}
})
}else{
console.log('取消');
}
}
})
}
})
}else{
that.$refs.uTips.show({
title: "保存失败,请稍后重试",
type: "error",
duration: "2300"
});
}
}, },
complete: function () { complete: function () {
uni.hideLoading(); uni.hideLoading();
......
...@@ -132,12 +132,42 @@ export default { ...@@ -132,12 +132,42 @@ export default {
title: "保存成功", title: "保存成功",
}); });
}, },
fail: function (e) { fail: function (err) {
that.$refs.uTips.show({ if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
title: "保存失败,请稍后重试", uni.authorize({
type: "error", scope:'scope.writePhotosAlbum',
duration: "2300", success: (res) => {
}); console.log('11111');
},
fail: (res) => {
uni.showModal({
content:'检测到您没打开保存到相册权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
if(res.authSetting['scope.writePhotosAlbum']){
that.saveImage()
}
}
})
}else{
console.log('取消');
}
}
})
}
})
}else{
that.$refs.uTips.show({
title: "保存失败,请稍后重试",
type: "error",
duration: "2300"
});
}
}, },
complete: function () { complete: function () {
uni.hideLoading(); uni.hideLoading();
......
...@@ -216,13 +216,44 @@ ...@@ -216,13 +216,44 @@
title: "保存成功", title: "保存成功",
}); });
}, },
fail: function (e) { fail: function (err) {
that.$refs.uTips.show({ if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
title: "保存失败,请稍后重试", uni.authorize({
type: "error", scope:'scope.writePhotosAlbum',
duration: "2300", success: (res) => {
}); console.log('11111');
}, },
fail: (res) => {
uni.showModal({
content:'检测到您没打开保存到相册权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
if(res.authSetting['scope.writePhotosAlbum']){
that.preservation()
}
}
})
}else{
console.log('取消');
}
}
})
}
})
}else{
that.$refs.uTips.show({
title: "保存失败,请稍后重试",
type: "error",
duration: "2300",
});
}
},
complete: function () { complete: function () {
uni.hideLoading(); uni.hideLoading();
}, },
......
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