Commit 802708e27d34e63b4584fb67c4dc7d004afa4083
1 parent
aa4ffa02
大转盘
Showing
1 changed file
with
64 additions
and
27 deletions
packageB/pages/luckactivity/luckinfo/luckinfo.js
| @@ -80,12 +80,12 @@ let imgDraw = { | @@ -80,12 +80,12 @@ let imgDraw = { | ||
| 80 | }, | 80 | }, |
| 81 | { //5.分享图片 | 81 | { //5.分享图片 |
| 82 | "type": "image", | 82 | "type": "image", |
| 83 | - "url": "", | 83 | + "url": "/packageB/images/luckDraw/jiang.png", |
| 84 | "css": { | 84 | "css": { |
| 85 | "width": "554px", | 85 | "width": "554px", |
| 86 | "height": "350px", | 86 | "height": "350px", |
| 87 | "top": "240px", | 87 | "top": "240px", |
| 88 | - "mode": "scaleToFill", | 88 | + "mode": "aspectFill", |
| 89 | } | 89 | } |
| 90 | }, | 90 | }, |
| 91 | { //6 | 91 | { //6 |
| @@ -280,6 +280,8 @@ Page({ | @@ -280,6 +280,8 @@ Page({ | ||
| 280 | self = this; | 280 | self = this; |
| 281 | let first_leader = null; | 281 | let first_leader = null; |
| 282 | this.data.options = options; | 282 | this.data.options = options; |
| 283 | + | ||
| 284 | + | ||
| 283 | // this.setData({ | 285 | // this.setData({ |
| 284 | // options, | 286 | // options, |
| 285 | // imghost, | 287 | // imghost, |
| @@ -307,7 +309,7 @@ Page({ | @@ -307,7 +309,7 @@ Page({ | ||
| 307 | }; | 309 | }; |
| 308 | 310 | ||
| 309 | if(first_leader) { | 311 | if(first_leader) { |
| 310 | - console.log("log---", first_leader); | 312 | + // console.log("log---", first_leader); |
| 311 | app.globalData.first_leader = first_leader; | 313 | app.globalData.first_leader = first_leader; |
| 312 | //调用接口判断是不是会员 | 314 | //调用接口判断是不是会员 |
| 313 | app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{ | 315 | app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{ |
| @@ -324,7 +326,7 @@ Page({ | @@ -324,7 +326,7 @@ Page({ | ||
| 324 | }, | 326 | }, |
| 325 | 327 | ||
| 326 | onShow() { | 328 | onShow() { |
| 327 | - console.log('show~~`'); | 329 | + // console.log('show~~`'); |
| 328 | if(app.globalData.userInfo) { | 330 | if(app.globalData.userInfo) { |
| 329 | if(!this.data.isLogin) { | 331 | if(!this.data.isLogin) { |
| 330 | this.setData({ | 332 | this.setData({ |
| @@ -360,6 +362,11 @@ Page({ | @@ -360,6 +362,11 @@ Page({ | ||
| 360 | // console.log('luckInfo', res.data.data); | 362 | // console.log('luckInfo', res.data.data); |
| 361 | let luckInfo = res.data.data; | 363 | let luckInfo = res.data.data; |
| 362 | 364 | ||
| 365 | + self.setData({ | ||
| 366 | + 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题 | ||
| 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),//活动时间 | ||
| 369 | + }); | ||
| 363 | 370 | ||
| 364 | if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 | 371 | if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 |
| 365 | let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; | 372 | let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; |
| @@ -371,9 +378,9 @@ Page({ | @@ -371,9 +378,9 @@ Page({ | ||
| 371 | bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 | 378 | bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 |
| 372 | 'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 | 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'), //转盘 |
| 373 | 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.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'), //指针 |
| 374 | - 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.tilte : self.data.luckInfo.act_name,//分享标题 | 381 | + 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题 |
| 375 | 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享标题 | 382 | 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享标题 |
| 376 | - 'imgDraw.views[5].url': imghost + ((res.data.data&&res.data.data.share_image) ? res.data.data.share_image:self.data.luckInfo.imageurl),//分享图片 | 383 | + 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片 |
| 377 | 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 | 384 | 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 |
| 378 | }); | 385 | }); |
| 379 | // }; | 386 | // }; |
| @@ -413,7 +420,7 @@ Page({ | @@ -413,7 +420,7 @@ Page({ | ||
| 413 | self.setData({ | 420 | self.setData({ |
| 414 | award, | 421 | award, |
| 415 | }); | 422 | }); |
| 416 | - console.log('award', award); | 423 | + // console.log('award', award); |
| 417 | self.prizeLayout(award); | 424 | self.prizeLayout(award); |
| 418 | 425 | ||
| 419 | }, | 426 | }, |
| @@ -498,7 +505,7 @@ Page({ | @@ -498,7 +505,7 @@ Page({ | ||
| 498 | if(length == 1) { | 505 | if(length == 1) { |
| 499 | [0,2,4,6].map(function(item, index) { | 506 | [0,2,4,6].map(function(item, index) { |
| 500 | prizes[item] = { | 507 | prizes[item] = { |
| 501 | - id: award[0].record_id, | 508 | + id: award[0].id, |
| 502 | lbtype: award[0].lbtype, | 509 | lbtype: award[0].lbtype, |
| 503 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 510 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 504 | imgs: [ | 511 | imgs: [ |
| @@ -522,7 +529,7 @@ Page({ | @@ -522,7 +529,7 @@ Page({ | ||
| 522 | if(length == 2) { | 529 | if(length == 2) { |
| 523 | [0,4].map(function(item, index) { | 530 | [0,4].map(function(item, index) { |
| 524 | prizes[item] = { | 531 | prizes[item] = { |
| 525 | - id: award[0].record_id, | 532 | + id: award[0].id, |
| 526 | lbtype: award[0].lbtype, | 533 | lbtype: award[0].lbtype, |
| 527 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 534 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 528 | imgs: [ | 535 | imgs: [ |
| @@ -538,7 +545,7 @@ Page({ | @@ -538,7 +545,7 @@ Page({ | ||
| 538 | 545 | ||
| 539 | [2,6].map(function(item, index) { | 546 | [2,6].map(function(item, index) { |
| 540 | prizes[item] = { | 547 | prizes[item] = { |
| 541 | - id: award[1].record_id, | 548 | + id: award[1].id, |
| 542 | lbtype: award[1].lbtype, | 549 | lbtype: award[1].lbtype, |
| 543 | fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 550 | fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 544 | imgs: [ | 551 | imgs: [ |
| @@ -562,7 +569,7 @@ Page({ | @@ -562,7 +569,7 @@ Page({ | ||
| 562 | if(length == 3) { | 569 | if(length == 3) { |
| 563 | [0,4].map(function(item, index) { | 570 | [0,4].map(function(item, index) { |
| 564 | prizes[item] = { | 571 | prizes[item] = { |
| 565 | - id: award[0].record_id, | 572 | + id: award[0].id, |
| 566 | lbtype: award[0].lbtype, | 573 | lbtype: award[0].lbtype, |
| 567 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 574 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 568 | imgs: [ | 575 | imgs: [ |
| @@ -578,7 +585,7 @@ Page({ | @@ -578,7 +585,7 @@ Page({ | ||
| 578 | 585 | ||
| 579 | [1,5].map(function(item, index) { | 586 | [1,5].map(function(item, index) { |
| 580 | prizes[item] = { | 587 | prizes[item] = { |
| 581 | - id: award[1].record_id, | 588 | + id: award[1].id, |
| 582 | lbtype: award[1].lbtype, | 589 | lbtype: award[1].lbtype, |
| 583 | fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 590 | fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 584 | imgs: [ | 591 | imgs: [ |
| @@ -594,7 +601,7 @@ Page({ | @@ -594,7 +601,7 @@ Page({ | ||
| 594 | 601 | ||
| 595 | [2,6].map(function(item, index) { | 602 | [2,6].map(function(item, index) { |
| 596 | prizes[item] = { | 603 | prizes[item] = { |
| 597 | - id: award[2].record_id, | 604 | + id: award[2].id, |
| 598 | lbtype: award[2].lbtype, | 605 | lbtype: award[2].lbtype, |
| 599 | fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 606 | fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 600 | imgs: [ | 607 | imgs: [ |
| @@ -619,7 +626,7 @@ Page({ | @@ -619,7 +626,7 @@ Page({ | ||
| 619 | if(length == 4) { | 626 | if(length == 4) { |
| 620 | [0,2,4,6].map(function(item, index) { | 627 | [0,2,4,6].map(function(item, index) { |
| 621 | prizes[item] = { | 628 | prizes[item] = { |
| 622 | - id: award[index].record_id, | 629 | + id: award[index].id, |
| 623 | lbtype: award[index].lbtype, | 630 | lbtype: award[index].lbtype, |
| 624 | fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 631 | fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 625 | imgs: [ | 632 | imgs: [ |
| @@ -643,7 +650,7 @@ Page({ | @@ -643,7 +650,7 @@ Page({ | ||
| 643 | if(length == 5) { | 650 | if(length == 5) { |
| 644 | [0,2,3,5,6].map(function(item, index) { | 651 | [0,2,3,5,6].map(function(item, index) { |
| 645 | prizes[item] = { | 652 | prizes[item] = { |
| 646 | - id: award[index].record_id, | 653 | + id: award[index].id, |
| 647 | lbtype: award[index].lbtype, | 654 | lbtype: award[index].lbtype, |
| 648 | fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 655 | fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 649 | imgs: [ | 656 | imgs: [ |
| @@ -667,7 +674,7 @@ Page({ | @@ -667,7 +674,7 @@ Page({ | ||
| 667 | if(length == 6) { | 674 | if(length == 6) { |
| 668 | prizes = award.map(function(item, index) { | 675 | prizes = award.map(function(item, index) { |
| 669 | return { | 676 | return { |
| 670 | - id: item.record_id, | 677 | + id: item.id, |
| 671 | lbtype: item.lbtype, | 678 | lbtype: item.lbtype, |
| 672 | fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | 679 | fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
| 673 | imgs: [ | 680 | imgs: [ |
| @@ -790,7 +797,7 @@ Page({ | @@ -790,7 +797,7 @@ Page({ | ||
| 790 | if(res.data.code == 0) { | 797 | if(res.data.code == 0) { |
| 791 | 798 | ||
| 792 | if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { | 799 | if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { |
| 793 | - console.log('start choujiang'); | 800 | + // console.log('start choujiang'); |
| 794 | // let start = false; | 801 | // let start = false; |
| 795 | if(!self.data.start) { | 802 | if(!self.data.start) { |
| 796 | self.data.start = true; | 803 | self.data.start = true; |
| @@ -810,7 +817,7 @@ Page({ | @@ -810,7 +817,7 @@ Page({ | ||
| 810 | success: function(res) { | 817 | success: function(res) { |
| 811 | 818 | ||
| 812 | if(res.data.code == 0) { | 819 | if(res.data.code == 0) { |
| 813 | - console.log('开始摇奖', res.data.data); | 820 | + // console.log('开始摇奖', res.data.data); |
| 814 | if(self.data.luckInfo.vip_act_num != 0) { | 821 | if(self.data.luckInfo.vip_act_num != 0) { |
| 815 | self.setData({ | 822 | self.setData({ |
| 816 | 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | 823 | 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, |
| @@ -823,6 +830,7 @@ Page({ | @@ -823,6 +830,7 @@ Page({ | ||
| 823 | isActive: true, | 830 | isActive: true, |
| 824 | wow: res.data.data, | 831 | wow: res.data.data, |
| 825 | }); | 832 | }); |
| 833 | + // console.log('wow', self.data.wow); | ||
| 826 | // console.log('请求成功', res.data.data); | 834 | // console.log('请求成功', res.data.data); |
| 827 | let luckyId = res.data.data.id; | 835 | let luckyId = res.data.data.id; |
| 828 | let indexArr = self.luckyIndex(self.data.prizes, luckyId); | 836 | let indexArr = self.luckyIndex(self.data.prizes, luckyId); |
| @@ -938,12 +946,12 @@ Page({ | @@ -938,12 +946,12 @@ Page({ | ||
| 938 | console.log('抽奖结果:',event.detail); | 946 | console.log('抽奖结果:',event.detail); |
| 939 | let no_luck_urltype = this.data.luckInfo.no_luck_urltype; | 947 | let no_luck_urltype = this.data.luckInfo.no_luck_urltype; |
| 940 | let lbtype = null; | 948 | let lbtype = null; |
| 941 | - let good_id = null; | 949 | + // let good_id = null; |
| 942 | let resultTitle = event.detail.fonts[0].text.replace('\n',''); | 950 | let resultTitle = event.detail.fonts[0].text.replace('\n',''); |
| 943 | - if(event.detail.id) { | ||
| 944 | - console.log('~~~~~~----++++++',event.detail.id); | ||
| 945 | - good_id = event.detail.id; | ||
| 946 | - }; | 951 | + // if(event.detail.id) { |
| 952 | + // console.log('~~~~~~----++++++',event.detail.id); | ||
| 953 | + // good_id = event.detail.id; | ||
| 954 | + // }; | ||
| 947 | if(event.detail.lbtype == 5) { | 955 | if(event.detail.lbtype == 5) { |
| 948 | lbtype = 5; | 956 | lbtype = 5; |
| 949 | } else { | 957 | } else { |
| @@ -957,7 +965,7 @@ Page({ | @@ -957,7 +965,7 @@ Page({ | ||
| 957 | resultTitle, | 965 | resultTitle, |
| 958 | showPopup: false, | 966 | showPopup: false, |
| 959 | currentLbtype: lbtype, | 967 | currentLbtype: lbtype, |
| 960 | - good_id, | 968 | + // good_id, |
| 961 | }); | 969 | }); |
| 962 | 970 | ||
| 963 | 971 | ||
| @@ -1194,10 +1202,10 @@ Page({ | @@ -1194,10 +1202,10 @@ Page({ | ||
| 1194 | if(e && e.currentTarget.dataset.id) { | 1202 | if(e && e.currentTarget.dataset.id) { |
| 1195 | id = e.currentTarget.dataset.id; | 1203 | id = e.currentTarget.dataset.id; |
| 1196 | } else { | 1204 | } else { |
| 1197 | - id = this.data.good_id; | 1205 | + id = this.data.wow.record_id; |
| 1198 | }; | 1206 | }; |
| 1199 | let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`; | 1207 | let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`; |
| 1200 | - console.log('good_id', id, url); | 1208 | + // console.log('good_id', id, url); |
| 1201 | app.request.put(url, { | 1209 | app.request.put(url, { |
| 1202 | success: function(res) { | 1210 | success: function(res) { |
| 1203 | if(res.data.code == 0) { | 1211 | if(res.data.code == 0) { |
| @@ -1229,7 +1237,6 @@ Page({ | @@ -1229,7 +1237,6 @@ Page({ | ||
| 1229 | clickReceive() { | 1237 | clickReceive() { |
| 1230 | this.setData({ | 1238 | this.setData({ |
| 1231 | showResult: false, | 1239 | showResult: false, |
| 1232 | - showMask: false, | ||
| 1233 | }); | 1240 | }); |
| 1234 | this.showQr(); | 1241 | this.showQr(); |
| 1235 | }, | 1242 | }, |
| @@ -1257,4 +1264,34 @@ Page({ | @@ -1257,4 +1264,34 @@ Page({ | ||
| 1257 | myimg: e.detail.path, | 1264 | myimg: e.detail.path, |
| 1258 | }); | 1265 | }); |
| 1259 | }, | 1266 | }, |
| 1267 | + | ||
| 1268 | + | ||
| 1269 | + imageSize(e, boxWidth, boxHeight) { | ||
| 1270 | + var imageSize = {}; | ||
| 1271 | + var originalWidth = e.detail.width;//图片原始宽 | ||
| 1272 | + var originalHeight = e.detail.height;//图片原始高 | ||
| 1273 | + var originalScale = originalHeight/originalWidth;//图片高宽比 | ||
| 1274 | + console.log('originalWidth: ' + originalWidth) | ||
| 1275 | + console.log('originalHeight: ' + originalHeight) | ||
| 1276 | + | ||
| 1277 | + //获取屏幕宽高 | ||
| 1278 | + var boxWidth = boxWidth; | ||
| 1279 | + var boxHeight = boxHeight; | ||
| 1280 | + var boxscale = boxHeight/boxWidth;//屏幕高宽比 | ||
| 1281 | + console.log('windowWidth: ' + boxWidth) | ||
| 1282 | + console.log('windowHeight: ' + boxHeight) | ||
| 1283 | + if(originalScale < boxscale){//图片高宽比小于屏幕高宽比 | ||
| 1284 | + //图片缩放后的宽为屏幕宽 | ||
| 1285 | + imageSize.imageWidth = boxWidth; | ||
| 1286 | + imageSize.imageHeight = (boxWidth * originalHeight) / originalWidth; | ||
| 1287 | + }else{//图片高宽比大于屏幕高宽比 | ||
| 1288 | + //图片缩放后的高为屏幕高 | ||
| 1289 | + imageSize.imageHeight = boxHeight; | ||
| 1290 | + imageSize.imageWidth = (boxHeight * originalWidth) / originalHeight; | ||
| 1291 | + } | ||
| 1292 | + console.log('缩放后的宽: ' + imageSize.imageWidth) | ||
| 1293 | + console.log('缩放后的高: ' + imageSize.imageHeight) | ||
| 1294 | + console.log('图片尺寸', imageSize); | ||
| 1295 | + return imageSize; | ||
| 1296 | + }, | ||
| 1260 | }) | 1297 | }) |
| 1261 | \ No newline at end of file | 1298 | \ No newline at end of file |