⼩程序保存图⽚⾄相册(解决saveimagetophotosalbum:
failinv。。。
  const that = this
let fileName = new Date().valueOf();
let filePath = wx.env.USER_DATA_PATH + '/' + fileName + '.jpg'
wx.downloadFile({
url: srcUrl,//此处为接⼝返回的图⽚地址
filePath: filePath,
success: function (res) {
// 保存图⽚到系统相册
wx.saveImageToPhotosAlbum({
filePath: filePath,
success(data) {
let fileMgr = wx.getFileSystemManager()
fileMgr.unlink({
filePath: filePath,
记住我success(){
console.log(222);
}
})
},
fail(data){
        Msg === "saveImageToPhotosAlbum:fail:auth denied" || Msg === "saveImageToPhotosAlbum:fail auth deny" || Msg === "saveImageToPhotosAlbum:fail authorize no response") {
          wx.showModal({
            title: '提⽰',
            content: '需要您授权保存相册',
            showCancel: false,
            success: modalSuccess => {
              wx.openSetting({
                success(settingdata) {
                  if (settingdata.authSetting['scope.writePhotosAlbum']) {
                    console.log('获取权限成功,给出再次点击图⽚保存到相册的提⽰。')
                  }else {
                    console.log('获取权限失败,给出不给权限就⽆法正常使⽤的提⽰')
                  }
                }
              })
            }
          })
        }     
}
})
},
fail: function (res) {
}
})