{
load_activity: function () {
var that = this;
wx.showLoading({
title: '图片生成中',
})
wx.request({
url: app.globalData.webservice_url + 'biz/activity/saveSharePic',
data: JSON.stringify(app.encode({
activityId: that.data.activityid,
width: that.data.width,
height: that.data.height
})),
header: {
'X-Token': wx.getStorageSync('token')
},
method: 'POST',
success: function (res) {
if (res.data.code === 1) {
if (res.data.data) {
that.setData({
activity: res.data.data
}, function () {
that.timer_helper(res.data.data.shareActivityPath);
})
} else {
app.showModal('提示', res.data.desc);
}
} else {
app.showModal('提示', res.data.desc);
}
},
fail: function (res) {
app.showModal('提示', res.errMsg);
},
complete: function (res) {
console.log(res);
}
})
},
timer_helper: function (path) {
var that = this;
app.globalData.timer_canvas = setInterval(function () {
clearInterval(app.globalData.timer_canvas);
wx.getImageInfo({
src: app.globalData.file_url_server + path,
success(res1) {
that.setData({
path: res1.path
}, function () {
wx.saveImageToPhotosAlbum({
filePath: res1.path,
success(res) {
wx.showToast({
title: '已保存到本地相册',
})
}
})
})
},
fail(res1) {
that.timer_helper(path);
},
complete(res1) {
}
})
}, 2000)
}
}
微信小程序循环等待加载图片 - Wait and Load Image
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- 初始情况下,我们给 image 设置了宽度后,发现高度并不像 HTML 中一样自动缩放,好吧,我们试着设置 hei...
- 因为最近iOS的工作量比较少,因此就和公司大牛开始了小程序开发,由于是新手,许多东西总是喜欢问问同事,免得走弯路,...