diff --git a/packageA/pages/liveStreamDetails/liveStreamDetails.js b/packageA/pages/liveStreamDetails/liveStreamDetails.js index 3a55568..d808a22 100644 --- a/packageA/pages/liveStreamDetails/liveStreamDetails.js +++ b/packageA/pages/liveStreamDetails/liveStreamDetails.js @@ -9,6 +9,7 @@ var t = require("../../../utils/util.js"), oo = s.globalData, o = s.globalData.setting, os = o; +var regeneratorRuntime = require('../../../utils/runtime.js'); const app = getApp(); @@ -148,15 +149,59 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un }, // 生成海报 - drawPlaybill: function () { + drawPlaybill: async function () { + + var that=this; // wx.showLoading({ // title: '正在生成海报...' // }); + + + if(!this.data.coverImg) { + + // 请求主图 + await that.getImageInfo(that.data.details['share_img']).then(res => { + that.setData({ + coverImg: res.path, + coverImgWidth: res.width, + coverImgHeight: res.height, + coverImgSize: that.imageResize(res.width, res.height), + // coverImgHeight: res.height, + }); + // console.log('主图加载成功~', that.data.coverImgSize); + }); + } + + if(!this.data.avatarUrl) { + + // 请求头像 + await that.getImageInfo(app.globalData.userInfo['head_pic']).then(res => { + that.setData({ + avatarUrl: res.path + }); + console.log('头像加载成功~') + }); + } + + // 请求二维码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; + + if(!this.data.ewm) { + + await that.getImageInfo(path3).then(res => { + that.setData({ + ewm: res.path + }); + console.log('二维码加载成功~') + }); + } + + // 数据准备 const title = this.data.details.name; // const headImg = app.globalData.userInfo['head_pic']; - const that = this; // console.log('----------------v', headImg); @@ -479,37 +524,6 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un } - - // 请求主图 - that.getImageInfo(that.data.details['share_img']).then(res => { - that.setData({ - coverImg: res.path, - coverImgWidth: res.width, - coverImgHeight: res.height, - coverImgSize: that.imageResize(res.width, res.height), - // coverImgHeight: res.height, - }); - // console.log('主图加载成功~', that.data.coverImgSize); - }); - - // 请求头像 - that.getImageInfo(app.globalData.userInfo['head_pic']).then(res => { - that.setData({ - avatarUrl: res.path - }); - console.log('头像加载成功~') - }); - - // 请求二维码 - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; - that.getImageInfo(path3).then(res => { - that.setData({ - ewm: res.path - }); - console.log('二维码加载成功~') - }); - } })