lmx217
  //点击保存到相册
  baocun() {
    var that = this
    wx.getSetting({
      success(res) {
        console.log(res.authSetting)
        const scopeWritePhotosAlbum = res.authSetting[\'scope.writePhotosAlbum\'];
        if (scopeWritePhotosAlbum === true || scopeWritePhotosAlbum === undefined) {
          // undefined为第一次进授权未定义的时候
          wx.saveImageToPhotosAlbum({
            filePath: that.data.imagePath,
            success(res) {
              console.log(123);
              wx.showModal({
                content: \'图片已保存到相册,赶紧晒一下吧~\',
                showCancel: false,
                confirmText: \'好的\',
                confirmColor: \'#333\',
                success: function (res) {
                  if (res.confirm) {
                    console.log(\'用户点击确定\');
                    /* 该隐藏的隐藏 */
                    that.setData({
                      maskHidden: false
                    })
                  }
                },
                fail: function (res) {
                  console.log(11111)
                }
              })
            },
            fail(res) {
              console.log("用户取消保存");

            }
          })
        } else {
          //用户以前拒绝过,诱导用户打开授权界面
          console.log(\'用户以前拒绝过,诱导用户打开授权界面\');
          wx.openSetting({
            success: (res2) => {
              console.log(res2);
              console.log(\'打开成功\');
            },
            fail(res) {
              console.log("打开失败");
            }
          })
        }

      }
    })

  },

分类:

技术点:

相关文章:

  • 2021-07-13
  • 2021-12-15
  • 2021-11-21
  • 2021-11-05
  • 2021-12-15
  • 2021-12-09
猜你喜欢
  • 2021-11-28
  • 2021-12-05
  • 2021-12-08
  • 2021-12-08
  • 2021-04-07
  • 2021-09-24
相关资源
相似解决方案