From 58c9cd3b6e70e05952edb2e57f5215af77e1aa84 Mon Sep 17 00:00:00 2001 From: 346149741 <346149741@qq.com> Date: 星期三, 04 九月 2024 13:40:55 +0800 Subject: [PATCH] 长按保存二维码 --- qiye/qiyeIndex/qiyeIndex.vue | 61 +++++++++++++++++++++++------- 1 files changed, 46 insertions(+), 15 deletions(-) diff --git a/qiye/qiyeIndex/qiyeIndex.vue b/qiye/qiyeIndex/qiyeIndex.vue index 8c89017..91a48b8 100644 --- a/qiye/qiyeIndex/qiyeIndex.vue +++ b/qiye/qiyeIndex/qiyeIndex.vue @@ -171,22 +171,53 @@ success: val => { console.log(val) const tempFilePath = val.tempFilePath; - uni.saveImageToPhotosAlbum({ - filePath: tempFilePath, - success: () => { - uni.showToast({ - title: '鍥剧墖淇濆瓨鎴愬姛', - icon: 'success', - duration: 2000 - }); - }, - fail: () => { - uni.showToast({ - title: '鍥剧墖淇濆瓨澶辫触', - icon: 'none' - }); + uni.getSetting({ + success(res) { + if (!res.authSetting['scope.writePhotosAlbum']) { + uni.authorize({ + scope:'scope.writePhotosAlbum', + success() { + uni.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success: () => { + uni.showToast({ + title: '鍥剧墖淇濆瓨鎴愬姛', + icon: 'success', + duration: 2000 + }); + }, + fail: () => { + uni.showToast({ + title: '鍥剧墖淇濆瓨澶辫触', + icon: 'none' + }); + } + }); + }, + fail(err){ + console.log(err) + } + }) + }else{ + uni.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success: () => { + uni.showToast({ + title: '鍥剧墖淇濆瓨鎴愬姛', + icon: 'success', + duration: 2000 + }); + }, + fail: () => { + uni.showToast({ + title: '鍥剧墖淇濆瓨澶辫触', + icon: 'none' + }); + } + }); + } } - }); + }) }, fail: err => { uni.showToast({ -- Gitblit v1.9.1