Commit 0096f66cb4f52322cd441ba67bcc5039de7ed791
1 parent
7d7eba85
大转盘修改
Showing
3 changed files
with
46 additions
and
44 deletions
packageB/components/painter/painter.js
@@ -746,7 +746,7 @@ Component({ | @@ -746,7 +746,7 @@ Component({ | ||
746 | fail: (error) => { | 746 | fail: (error) => { |
747 | // 如果图片坏了,则直接置空,防止坑爹的 canvas 画崩溃了 | 747 | // 如果图片坏了,则直接置空,防止坑爹的 canvas 画崩溃了 |
748 | view.url = ""; | 748 | view.url = ""; |
749 | - console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); | 749 | + // console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); |
750 | }, | 750 | }, |
751 | complete: () => { | 751 | complete: () => { |
752 | completeCount++; | 752 | completeCount++; |
packageB/pages/luckactivity/luckinfo/luckinfo.js
@@ -10,7 +10,7 @@ let imgDraw = { | @@ -10,7 +10,7 @@ let imgDraw = { | ||
10 | "views": [ | 10 | "views": [ |
11 | { //0.头像 | 11 | { //0.头像 |
12 | "type": "image", | 12 | "type": "image", |
13 | - "url": "", | 13 | + // "url": "", |
14 | "css": { | 14 | "css": { |
15 | "background": "white", | 15 | "background": "white", |
16 | "width": "80px", | 16 | "width": "80px", |
@@ -64,7 +64,7 @@ let imgDraw = { | @@ -64,7 +64,7 @@ let imgDraw = { | ||
64 | }, | 64 | }, |
65 | { //4.分享内容 | 65 | { //4.分享内容 |
66 | "type": "text", | 66 | "type": "text", |
67 | - "text": "", | 67 | + // "text": "", |
68 | "css": { | 68 | "css": { |
69 | "color": "#000000", | 69 | "color": "#000000", |
70 | "width": "554px", | 70 | "width": "554px", |
@@ -179,7 +179,7 @@ let imgDraw = { | @@ -179,7 +179,7 @@ let imgDraw = { | ||
179 | }, | 179 | }, |
180 | { //14.时间 | 180 | { //14.时间 |
181 | "type": "text", | 181 | "type": "text", |
182 | - "text": "", | 182 | + // "text": "", |
183 | "css": { | 183 | "css": { |
184 | "width": "377px", | 184 | "width": "377px", |
185 | "top": "770px", | 185 | "top": "770px", |
@@ -201,7 +201,7 @@ let imgDraw = { | @@ -201,7 +201,7 @@ let imgDraw = { | ||
201 | 201 | ||
202 | { //16.码 | 202 | { //16.码 |
203 | "type": "image", | 203 | "type": "image", |
204 | - "url": "", | 204 | + // "url": "", |
205 | "css": { | 205 | "css": { |
206 | "width": "150px", | 206 | "width": "150px", |
207 | "height": "150px", | 207 | "height": "150px", |
@@ -367,21 +367,30 @@ Page({ | @@ -367,21 +367,30 @@ Page({ | ||
367 | // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 | 367 | // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 |
368 | 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 | 368 | 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 |
369 | }); | 369 | }); |
370 | - | 370 | + |
371 | + | ||
372 | + let luckStyle = null; | ||
371 | if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 | 373 | if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 |
372 | let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; | 374 | let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; |
373 | app.request.get(url, { | 375 | app.request.get(url, { |
374 | success: function(res) { | 376 | success: function(res) { |
377 | + let template = null; | ||
375 | if(res.data.code == 0) { | 378 | if(res.data.code == 0) { |
379 | + template = res.data.data; | ||
376 | self.setData({ | 380 | self.setData({ |
377 | - template: res.data.data, | ||
378 | - bannerUrl: imghost + res.data.data.bannerUrl, //背景图 | ||
379 | - 'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 | ||
380 | - 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 | ||
381 | - 'imgDraw.views[3].text': res.data.data.title, //分享标题 | ||
382 | - 'imgDraw.views[5].url': imghost + (res.data.data&&res.data.data.share_image ? res.data.data.share_image:self.data.luckInfo.imageurl), //分享图片 | 381 | + template, |
382 | + bannerUrl: imghost + template.bannerUrl, //背景图 | ||
383 | + 'blocks[0].imgs[0].src': imghost + ((template&&template.wheelBaseUrl) ? template.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 | ||
384 | + 'buttons[0].imgs[0].src': imghost + ((template&&template.wheelPointerUrl) ? template.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 | ||
385 | + 'imgDraw.views[3].text': template.title, //分享标题 | ||
386 | + 'imgDraw.views[5].url': imghost + (template&&template.share_image ? template.share_image:self.data.luckInfo.imageurl), //分享图片 | ||
383 | }); | 387 | }); |
384 | 388 | ||
389 | + let color = template&&template.colorCode ? template.colorCode:'#da104b'; | ||
390 | + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; | ||
391 | + self.setData({ | ||
392 | + luckStyle, | ||
393 | + }); | ||
385 | // self.setData({ | 394 | // self.setData({ |
386 | // template: res.data.data, | 395 | // template: res.data.data, |
387 | // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 | 396 | // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 |
@@ -394,11 +403,18 @@ Page({ | @@ -394,11 +403,18 @@ Page({ | ||
394 | // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 | 403 | // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 |
395 | // }); | 404 | // }); |
396 | } else { | 405 | } else { |
406 | + luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`; | ||
397 | self.setData({ | 407 | self.setData({ |
408 | + luckStyle, | ||
398 | 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片 | 409 | 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片 |
399 | //'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 | 410 | //'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 |
400 | //'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 | 411 | //'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 |
401 | }); | 412 | }); |
413 | + // let color = template&&template.colorCode ? template.colorCode:'#da104b'; | ||
414 | + | ||
415 | + // self.setData({ | ||
416 | + // luckStyle, | ||
417 | + // }); | ||
402 | }; | 418 | }; |
403 | 419 | ||
404 | }, | 420 | }, |
@@ -416,8 +432,19 @@ Page({ | @@ -416,8 +432,19 @@ Page({ | ||
416 | bannerUrl: imghost + luckInfo.store_bannerUrl, | 432 | bannerUrl: imghost + luckInfo.store_bannerUrl, |
417 | custom: true, | 433 | custom: true, |
418 | }); | 434 | }); |
435 | + } else { | ||
436 | + self.setData({ | ||
437 | + bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', | ||
438 | + custom: false, | ||
439 | + }); | ||
419 | }; | 440 | }; |
420 | 441 | ||
442 | + let color = self.data.custom ? '#f0f0f0':'#da104b'; | ||
443 | + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; | ||
444 | + self.setData({ | ||
445 | + luckStyle, | ||
446 | + }); | ||
447 | + | ||
421 | }; | 448 | }; |
422 | 449 | ||
423 | 450 | ||
@@ -1287,34 +1314,5 @@ Page({ | @@ -1287,34 +1314,5 @@ Page({ | ||
1287 | myimg: e.detail.path, | 1314 | myimg: e.detail.path, |
1288 | }); | 1315 | }); |
1289 | }, | 1316 | }, |
1290 | - | ||
1291 | - | ||
1292 | - imageSize(e, boxWidth, boxHeight) { | ||
1293 | - var imageSize = {}; | ||
1294 | - var originalWidth = e.detail.width;//图片原始宽 | ||
1295 | - var originalHeight = e.detail.height;//图片原始高 | ||
1296 | - var originalScale = originalHeight/originalWidth;//图片高宽比 | ||
1297 | - console.log('originalWidth: ' + originalWidth) | ||
1298 | - console.log('originalHeight: ' + originalHeight) | ||
1299 | - | ||
1300 | - //获取屏幕宽高 | ||
1301 | - var boxWidth = boxWidth; | ||
1302 | - var boxHeight = boxHeight; | ||
1303 | - var boxscale = boxHeight/boxWidth;//屏幕高宽比 | ||
1304 | - console.log('windowWidth: ' + boxWidth) | ||
1305 | - console.log('windowHeight: ' + boxHeight) | ||
1306 | - if(originalScale < boxscale){//图片高宽比小于屏幕高宽比 | ||
1307 | - //图片缩放后的宽为屏幕宽 | ||
1308 | - imageSize.imageWidth = boxWidth; | ||
1309 | - imageSize.imageHeight = (boxWidth * originalHeight) / originalWidth; | ||
1310 | - }else{//图片高宽比大于屏幕高宽比 | ||
1311 | - //图片缩放后的高为屏幕高 | ||
1312 | - imageSize.imageHeight = boxHeight; | ||
1313 | - imageSize.imageWidth = (boxHeight * originalWidth) / originalHeight; | ||
1314 | - } | ||
1315 | - console.log('缩放后的宽: ' + imageSize.imageWidth) | ||
1316 | - console.log('缩放后的高: ' + imageSize.imageHeight) | ||
1317 | - console.log('图片尺寸', imageSize); | ||
1318 | - return imageSize; | ||
1319 | - }, | 1317 | + |
1320 | }) | 1318 | }) |
1321 | \ No newline at end of file | 1319 | \ No newline at end of file |
packageB/pages/luckactivity/luckinfo/luckinfo.wxml
1 | <wxs module="filter" src="../../../../utils/filter.wxs"></wxs> | 1 | <wxs module="filter" src="../../../../utils/filter.wxs"></wxs> |
2 | <wxs module="tool" src="./tool.wxs"></wxs> | 2 | <wxs module="tool" src="./tool.wxs"></wxs> |
3 | -<view class="luck-container {{!template&&custom ? 'on':''}}" style="background: {{template&&template.colorCode ? template.colorCode:(custom ? '#f0f0f0':'#da104b')}} url({{bannerUrl ? bannerUrl:(imghost + 'miniapp/images/luckDraw/bg.png?v=2')}}) no-repeat;"> | 3 | +<view class="luck-container {{!template&&custom ? 'on':''}}" style="{{luckStyle}}"> |
4 | +<!-- <view class="luck-container {{!template&&custom ? 'on':''}}" style="background: {{template&&template.colorCode ? template.colorCode:(custom ? '#f0f0f0':'#da104b')}} url({{bannerUrl ? bannerUrl:''}}) no-repeat;"> --> | ||
4 | <!-- 中奖人员 --> | 5 | <!-- 中奖人员 --> |
5 | <view class="swiper-container" wx:if="{{nameList && nameList.length != 0}}"> | 6 | <view class="swiper-container" wx:if="{{nameList && nameList.length != 0}}"> |
6 | <swiper class="swiper" autoplay="true" circular="true" vertical="true" interval="3000"> | 7 | <swiper class="swiper" autoplay="true" circular="true" vertical="true" interval="3000"> |
@@ -36,7 +37,7 @@ | @@ -36,7 +37,7 @@ | ||
36 | /> | 37 | /> |
37 | </view> | 38 | </view> |
38 | <view class="weel-txt fs28 white t-c pdt10" wx:if="{{luckInfo.vip_act_num == 0}}">今天你有 <text class="fs50 c-yellow cs">不限次</text> 抽奖机会</view> | 39 | <view class="weel-txt fs28 white t-c pdt10" wx:if="{{luckInfo.vip_act_num == 0}}">今天你有 <text class="fs50 c-yellow cs">不限次</text> 抽奖机会</view> |
39 | - <view class="weel-txt fs28 white t-c pdt10" wx:else>今天你还有 <text class="fs50 c-yellow cs">{{filter.show_default(luckInfo.user_LuckNumDay, '0')}}</text> 次抽奖机会</view> | 40 | + <view class="weel-txt fs28 white t-c pdt10" wx:else>今天你还有 <text class="fs50 c-yellow cs">{{filter.show_default(luckInfo.user_LuckNumDay < 0 ? 0:luckInfo.user_LuckNumDay, '0')}}</text> 次抽奖机会</view> |
40 | <view class="tip-to-down expand-transition"> | 41 | <view class="tip-to-down expand-transition"> |
41 | <text></text> | 42 | <text></text> |
42 | <text></text> | 43 | <text></text> |
@@ -198,6 +199,9 @@ | @@ -198,6 +199,9 @@ | ||
198 | <!-- 遮罩层 --> | 199 | <!-- 遮罩层 --> |
199 | <view class="mask" wx:if="{{showMask}}"></view> | 200 | <view class="mask" wx:if="{{showMask}}"></view> |
200 | 201 | ||
202 | +<!-- 遮罩层2 --> | ||
203 | +<!-- <cover-view class="mask2"></cover-view> --> | ||
204 | + | ||
201 | <qrcode id="qrcode" bind:close="closeQr"></qrcode> | 205 | <qrcode id="qrcode" bind:close="closeQr"></qrcode> |
202 | 206 | ||
203 | 207 |