From e460b5b7be596a54e4ff8062baf105f6b246c596 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Mon, 4 Nov 2024 16:01:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=98=85=E7=A0=81=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pageNotification/index.vue | 67 -------------------------------------- pages/shopSetUp/index.vue | 2 +- 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/pageNotification/index.vue b/pageNotification/index.vue index f4214fe..a2ce120 100644 --- a/pageNotification/index.vue +++ b/pageNotification/index.vue @@ -39,10 +39,7 @@ onShow(() => { }) - const saveImage = () => { - // #ifdef APP-PLUS - saveQrcodeImg() uni.downloadFile({ url: vdata.QrcodeUrl, success: (res) => { @@ -66,73 +63,9 @@ const saveImage = () => { infoBox.showErrorToast('保存失败') } }) - // #endif - //#ifdef MP-WEIXIN - downloadQR() - //#endif -} -//#ifdef MP-WEIXIN -function downloadQR() { - wx.getSetting({ - //获取权限 - success(res) { - console.log(res) - if (res.authSetting['scope.writePhotosAlbum']) { - saveWxQrcodeImg(vdata.QrcodeUrl) - } else { - wx.authorize({ - scope: 'scope.writePhotosAlbum', - success() { - saveWxQrcodeImg(vdata.QrcodeUrl) - }, - }) - } - }, - }) -} -//#endif -const saveQrcodeImg = () => { - saveHeadImgFile(vdata.QrcodeUrl, 80) - .then((success) => { - infoBox.showSuccessToast('保存成功') - }) - .catch((err) => { - console.log(err) - infoBox.showErrorToast('保存失败') - }) } -const saveWxQrcodeImg = (data) => { - const fileManager = wx.getFileSystemManager() - console.log( ) - const filePath = wx.env.USER_DATA_PATH + '/qrCode'+new Date().getTime()+'.png' - //这块是定义图片的名称,可自定义其他 - fileManager.writeFile({ - filePath: filePath, - data: data.slice(22), - encoding: 'base64', - success: (res) => { - wx.saveImageToPhotosAlbum({ - filePath: filePath, - success: function (res) { - //保存成功 - infoBox.showSuccessToast('保存成功') - }, - fail: function (err) { - console.log(err) - //保存失败 - infoBox.showErrorToast('保存失败') - }, - }) - }, - fail: (err) => { - infoBox.showErrorToast('保存失败') - }, - }) -} - -