diff --git a/packageB/components/painter/painter.js b/packageB/components/painter/painter.js index f24fa86..2c00c0b 100644 --- a/packageB/components/painter/painter.js +++ b/packageB/components/painter/painter.js @@ -746,7 +746,7 @@ Component({ fail: (error) => { // 如果图片坏了,则直接置空,防止坑爹的 canvas 画崩溃了 view.url = ""; - console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); + // console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); }, complete: () => { completeCount++; diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js index 7e9a2f7..40033af 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.js +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js @@ -10,7 +10,7 @@ let imgDraw = { "views": [ { //0.头像 "type": "image", - "url": "", + // "url": "", "css": { "background": "white", "width": "80px", @@ -64,7 +64,7 @@ let imgDraw = { }, { //4.分享内容 "type": "text", - "text": "", + // "text": "", "css": { "color": "#000000", "width": "554px", @@ -179,7 +179,7 @@ let imgDraw = { }, { //14.时间 "type": "text", - "text": "", + // "text": "", "css": { "width": "377px", "top": "770px", @@ -201,7 +201,7 @@ let imgDraw = { { //16.码 "type": "image", - "url": "", + // "url": "", "css": { "width": "150px", "height": "150px", @@ -367,21 +367,30 @@ Page({ // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 }); - + + + let luckStyle = null; if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; app.request.get(url, { success: function(res) { + let template = null; if(res.data.code == 0) { + template = res.data.data; self.setData({ - template: res.data.data, - bannerUrl: imghost + res.data.data.bannerUrl, //背景图 - 'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 - 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 - 'imgDraw.views[3].text': res.data.data.title, //分享标题 - 'imgDraw.views[5].url': imghost + (res.data.data&&res.data.data.share_image ? res.data.data.share_image:self.data.luckInfo.imageurl), //分享图片 + template, + bannerUrl: imghost + template.bannerUrl, //背景图 + 'blocks[0].imgs[0].src': imghost + ((template&&template.wheelBaseUrl) ? template.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 + 'buttons[0].imgs[0].src': imghost + ((template&&template.wheelPointerUrl) ? template.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 + 'imgDraw.views[3].text': template.title, //分享标题 + 'imgDraw.views[5].url': imghost + (template&&template.share_image ? template.share_image:self.data.luckInfo.imageurl), //分享图片 }); + let color = template&&template.colorCode ? template.colorCode:'#da104b'; + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; + self.setData({ + luckStyle, + }); // self.setData({ // template: res.data.data, // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 @@ -394,11 +403,18 @@ Page({ // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 // }); } else { + luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`; self.setData({ + luckStyle, 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片 //'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 //'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 }); + // let color = template&&template.colorCode ? template.colorCode:'#da104b'; + + // self.setData({ + // luckStyle, + // }); }; }, @@ -416,8 +432,19 @@ Page({ bannerUrl: imghost + luckInfo.store_bannerUrl, custom: true, }); + } else { + self.setData({ + bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', + custom: false, + }); }; + let color = self.data.custom ? '#f0f0f0':'#da104b'; + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; + self.setData({ + luckStyle, + }); + }; @@ -1287,34 +1314,5 @@ Page({ myimg: e.detail.path, }); }, - - - imageSize(e, boxWidth, boxHeight) { - var imageSize = {}; - var originalWidth = e.detail.width;//图片原始宽 - var originalHeight = e.detail.height;//图片原始高 - var originalScale = originalHeight/originalWidth;//图片高宽比 - console.log('originalWidth: ' + originalWidth) - console.log('originalHeight: ' + originalHeight) - - //获取屏幕宽高 - var boxWidth = boxWidth; - var boxHeight = boxHeight; - var boxscale = boxHeight/boxWidth;//屏幕高宽比 - console.log('windowWidth: ' + boxWidth) - console.log('windowHeight: ' + boxHeight) - if(originalScale < boxscale){//图片高宽比小于屏幕高宽比 - //图片缩放后的宽为屏幕宽 - imageSize.imageWidth = boxWidth; - imageSize.imageHeight = (boxWidth * originalHeight) / originalWidth; - }else{//图片高宽比大于屏幕高宽比 - //图片缩放后的高为屏幕高 - imageSize.imageHeight = boxHeight; - imageSize.imageWidth = (boxHeight * originalWidth) / originalHeight; - } - console.log('缩放后的宽: ' + imageSize.imageWidth) - console.log('缩放后的高: ' + imageSize.imageHeight) - console.log('图片尺寸', imageSize); - return imageSize; - }, + }) \ No newline at end of file diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml index 7fda334..aecd4c8 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml @@ -1,6 +1,7 @@ - + + @@ -36,7 +37,7 @@ /> 今天你有 不限次 抽奖机会 - 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 + 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay < 0 ? 0:luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 @@ -198,6 +199,9 @@ + + +