真机调试点击保存图片没有反应
发布于 6 年前 作者 ping62 7576 次浏览 来自 问答

saveImg: function () {

wx.openSetting({

success: (res) => {

if (res.authSetting[‘scope.writePhotosAlbum’]) {

console.log(‘开启权限成功’)

}

}

})

wx.downloadFile({

url: this.data.tempFilePath2,

success: function (res) {

wx.openSetting({

success(settingdata) {

console.log(settingdata)

if (settingdata.authSetting[‘scope.writePhotosAlbum’]) {

console.log(‘获取权限成功,给出再次点击图片保存到相册的提示。’)

}

}

})

let path = res.tempFilePath

wx.saveImageToPhotosAlbum({

filePath: path,

success(res) {

console.log(res)

},

fail(res) {

console.log(res)

},

complete(res) {

console.log(res)

}

})

}, fail: function (res) {

console.log(res);

if (res.errMsg === “saveImageToPhotosAlbum:fail auth deny”) {

console.log(“用户一开始拒绝了,我们想再次发起授权”)

console.log(‘打开设置窗口’)

wx.openSetting({

success(settingdata) {

console.log(settingdata)

if (settingdata.authSetting[‘scope.writePhotosAlbum’]) {

console.log(‘获取权限成功,给出再次点击图片保存到相册的提示。’)

}

}

})

}

}

})

},

1 回复

scope.writePhotosAlbum我现在调不出来。。。。

回到顶部