小程序
小游戏
企业微信
微信支付
扫描小程序码分享
- 部分手机无法存图,ios 同一微信版本 7.0.2有的能存有的不能,不能存的 手机
success、fail、complate 回调都没数据。 而且查看权限设置没有 保存到相册的开关。
- 保存图片
- 复现路径
- 提供一个最简复现 Demo
正常的手机有保存到相册开关,不正常的手机只有使用我的用户信息这项。
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
getsharepic:
function
(e) {
var
that =
this
that.setData({
showfenxiang:
false
,
showfenxiang_pic:
true
showbaocunbutton:
})
wx.showLoading({
title:
'海报生成中...'
wx.request({
url: app.globalData.bastUrl +
'api/xcxv1/share/'
data: {
openid: wx.getStorageSync(
'openid'
),
hdid: that.data.huodong_info.id,
tuid: wx.getStorageSync(
'tuid'
},
header: {
'content-type'
:
'application/json'
// 默认值
success:
(res) {
wx.downloadFile({
url: res.data.data.share_pic,
success(res) {
wx.hideLoading()
if
(res.statusCode ===
200
) {
share_pic: res.tempFilePath,
}
savetoalbum:
imgSrc = that.data.share_pic
//图片保存到本地
wx.saveImageToPhotosAlbum({
filePath: imgSrc,
(data) {
wx.showToast({
'保存到相册成功,可以分享了。'
icon:
'none'
duration:
2000
that.hideall()
fail:
(err) {
console.log(err);
(err.errMsg ===
"saveImageToPhotosAlbum:fail auth deny"
console.log(
"当初用户拒绝,再次发起授权"
)
'您拒绝了保存到相册的权限,请到我的栏目中的微信权限设置中打开。'
complete(res) {
console.log(res);
老师你好,苹果6s \ 7plus 微信版本 7.0.2 。现在开发工具上正常,点击保存就让下载,生成二维码,手机扫描点击没有反应,开启调试也看不到 console.log 的显示。
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
麻烦提供出现问题的机型和微信版本,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
麻烦提供这种格式的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
老师十分感谢,问题找到了, 出问题这一版本是我没有更新 开发工具,昨天把开发工具更新了以后再编译出来的小程序,问题都解决了。 之前那些部分可用的手机应该是继承了之前的权限,有问题的手机都是删除了小程序然后新安装了老开发工具编译出来的版本。 十分感谢
老师不敢当。。。解决了就好
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
getsharepic:function(e) {varthat =thisthat.setData({showfenxiang:false,showfenxiang_pic:true,showbaocunbutton:false})wx.showLoading({title:'海报生成中...',})wx.request({url: app.globalData.bastUrl +'api/xcxv1/share/',data: {openid: wx.getStorageSync('openid'),hdid: that.data.huodong_info.id,tuid: wx.getStorageSync('tuid'),},header: {'content-type':'application/json'// 默认值},success:function(res) {wx.downloadFile({url: res.data.data.share_pic,success(res) {wx.hideLoading()if(res.statusCode ===200) {that.setData({share_pic: res.tempFilePath,showbaocunbutton:true})}}})}})},savetoalbum:function(e) {varthat =thisvarimgSrc = that.data.share_pic//图片保存到本地wx.saveImageToPhotosAlbum({filePath: imgSrc,success:function(data) {wx.showToast({title:'保存到相册成功,可以分享了。',icon:'none',duration:2000})that.hideall()},fail:function(err) {console.log(err);if(err.errMsg ==="saveImageToPhotosAlbum:fail auth deny") {console.log("当初用户拒绝,再次发起授权")wx.showToast({title:'您拒绝了保存到相册的权限,请到我的栏目中的微信权限设置中打开。',icon:'none',duration:2000})}},complete(res) {console.log(res);}})},老师你好,苹果6s \ 7plus 微信版本 7.0.2 。现在开发工具上正常,点击保存就让下载,生成二维码,手机扫描点击没有反应,开启调试也看不到 console.log 的显示。
麻烦提供出现问题的机型和微信版本,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
getsharepic:function(e) {varthat =thisthat.setData({showfenxiang:false,showfenxiang_pic:true,showbaocunbutton:false})wx.showLoading({title:'海报生成中...',})wx.request({url: app.globalData.bastUrl +'api/xcxv1/share/',data: {openid: wx.getStorageSync('openid'),hdid: that.data.huodong_info.id,tuid: wx.getStorageSync('tuid'),},header: {'content-type':'application/json'// 默认值},success:function(res) {wx.downloadFile({url: res.data.data.share_pic,success(res) {wx.hideLoading()if(res.statusCode ===200) {that.setData({share_pic: res.tempFilePath,showbaocunbutton:true})}}})}})},savetoalbum:function(e) {varthat =thisvarimgSrc = that.data.share_pic//图片保存到本地wx.saveImageToPhotosAlbum({filePath: imgSrc,success:function(data) {wx.showToast({title:'保存到相册成功,可以分享了。',icon:'none',duration:2000})that.hideall()},fail:function(err) {console.log(err);if(err.errMsg ==="saveImageToPhotosAlbum:fail auth deny") {console.log("当初用户拒绝,再次发起授权")wx.showToast({title:'您拒绝了保存到相册的权限,请到我的栏目中的微信权限设置中打开。',icon:'none',duration:2000})}},complete(res) {console.log(res);}})},老师你好,苹果6s \ 7plus 微信版本 7.0.2 。现在开发工具上正常,点击保存就让下载,生成二维码,手机扫描点击没有反应,开启调试也看不到 console.log 的显示。
麻烦提供这种格式的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
老师十分感谢,问题找到了, 出问题这一版本是我没有更新 开发工具,昨天把开发工具更新了以后再编译出来的小程序,问题都解决了。 之前那些部分可用的手机应该是继承了之前的权限,有问题的手机都是删除了小程序然后新安装了老开发工具编译出来的版本。 十分感谢
老师十分感谢,问题找到了, 出问题这一版本是我没有更新 开发工具,昨天把开发工具更新了以后再编译出来的小程序,问题都解决了。 之前那些部分可用的手机应该是继承了之前的权限,有问题的手机都是删除了小程序然后新安装了老开发工具编译出来的版本。 十分感谢
老师不敢当。。。解决了就好