애플 릿 QR 코드 - 그림 저장

 //     
  postSave(e) {
    wx.showLoading({
      title: '   ...'
    })
    wx.downloadFile({
      url: 'http://xxx.com/poster.png',
      success: function (res) {
        //       
        wx.saveImageToPhotosAlbum({
          filePath: res.tempFilePath,
          success: function (data) {
            wx.hideLoading()
            wx.showModal({
              title: '  ',
              content: '             ,        ',
              showCancel:false,
            })
          },
          fail: function (err) {
            if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
              //         ,         ,              
              wx.showModal({
                title: '  ',
                content: '         ',
                showCancel: false,
                success:modalSuccess=>{
                  wx.openSetting({
                    success(settingdata) {
                      console.log("settingdata", settingdata)
                      if (settingdata.authSetting['scope.writePhotosAlbum']) {
                        wx.showModal({
                          title: '  ',
                          content: '      ,          ',
                          showCancel: false,
                        })
                      } else {
                        wx.showModal({
                          title: '  ',
                          content: '      ,         ~',
                          showCancel: false,
                        })
                      }
                    },
                    fail(failData) {
                      console.log("failData",failData)
                    },
                    complete(finishData) {
                      console.log("finishData", finishData)
                    }
                  })
                }
              })
            }
          },
          complete(res) {
            wx.hideLoading()
          }
        })
      }
    })
  }

좋은 웹페이지 즐겨찾기