<view class="qrcardbox">
<image src="/common/images/about_us_qr.png" data-url="/common/images/about_us_qr.png" bindlongpress='saveweixinImage'></image>
<text class="long">【长按保存二维码图片】</text>
</view>
// 点击保存图片
saveweixinImage(e) {
let url = e.currentTarget.dataset.url;
let that = this;
//用户需要授权
//wx.getSetting获取用户的当前设置。(不管同意与否)
wx.getSetting({
success: (res) =>{
//authSetting用户授权设置信息(用户授权结果)
//是否授权保存到相册 boolean scope.writePhotosAlbum
//如果值为undefined:以前没有授权过或者以前第一次点了拒绝之类的
if(res.authSetting['scope.writePhotosAlbum'] == undefined) {
// wx.authorize是否开启授权(去申请获取权限) 掉起授权弹窗
//首先得开启authorize,才能去判断到底是true或者false
wx.authorize({
scope: 'scope.writePhotosAlbum',
success: () =>{
//同意授权