Commit 802708e27d34e63b4584fb67c4dc7d004afa4083

Authored by taiyuan
1 parent aa4ffa02

大转盘

packageB/pages/luckactivity/luckinfo/luckinfo.js
... ... @@ -80,12 +80,12 @@ let imgDraw = {
80 80 },
81 81 { //5.分享图片
82 82 "type": "image",
83   - "url": "",
  83 + "url": "/packageB/images/luckDraw/jiang.png",
84 84 "css": {
85 85 "width": "554px",
86 86 "height": "350px",
87 87 "top": "240px",
88   - "mode": "scaleToFill",
  88 + "mode": "aspectFill",
89 89 }
90 90 },
91 91 { //6
... ... @@ -280,6 +280,8 @@ Page({
280 280 self = this;
281 281 let first_leader = null;
282 282 this.data.options = options;
  283 +
  284 +
283 285 // this.setData({
284 286 // options,
285 287 // imghost,
... ... @@ -307,7 +309,7 @@ Page({
307 309 };
308 310  
309 311 if(first_leader) {
310   - console.log("log---", first_leader);
  312 + // console.log("log---", first_leader);
311 313 app.globalData.first_leader = first_leader;
312 314 //调用接口判断是不是会员
313 315 app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{
... ... @@ -324,7 +326,7 @@ Page({
324 326 },
325 327  
326 328 onShow() {
327   - console.log('show~~`');
  329 + // console.log('show~~`');
328 330 if(app.globalData.userInfo) {
329 331 if(!this.data.isLogin) {
330 332 this.setData({
... ... @@ -360,6 +362,11 @@ Page({
360 362 // console.log('luckInfo', res.data.data);
361 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 371 if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板
365 372 let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`;
... ... @@ -371,9 +378,9 @@ Page({
371 378 bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图
372 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 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 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 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 420 self.setData({
414 421 award,
415 422 });
416   - console.log('award', award);
  423 + // console.log('award', award);
417 424 self.prizeLayout(award);
418 425  
419 426 },
... ... @@ -498,7 +505,7 @@ Page({
498 505 if(length == 1) {
499 506 [0,2,4,6].map(function(item, index) {
500 507 prizes[item] = {
501   - id: award[0].record_id,
  508 + id: award[0].id,
502 509 lbtype: award[0].lbtype,
503 510 fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
504 511 imgs: [
... ... @@ -522,7 +529,7 @@ Page({
522 529 if(length == 2) {
523 530 [0,4].map(function(item, index) {
524 531 prizes[item] = {
525   - id: award[0].record_id,
  532 + id: award[0].id,
526 533 lbtype: award[0].lbtype,
527 534 fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
528 535 imgs: [
... ... @@ -538,7 +545,7 @@ Page({
538 545  
539 546 [2,6].map(function(item, index) {
540 547 prizes[item] = {
541   - id: award[1].record_id,
  548 + id: award[1].id,
542 549 lbtype: award[1].lbtype,
543 550 fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
544 551 imgs: [
... ... @@ -562,7 +569,7 @@ Page({
562 569 if(length == 3) {
563 570 [0,4].map(function(item, index) {
564 571 prizes[item] = {
565   - id: award[0].record_id,
  572 + id: award[0].id,
566 573 lbtype: award[0].lbtype,
567 574 fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
568 575 imgs: [
... ... @@ -578,7 +585,7 @@ Page({
578 585  
579 586 [1,5].map(function(item, index) {
580 587 prizes[item] = {
581   - id: award[1].record_id,
  588 + id: award[1].id,
582 589 lbtype: award[1].lbtype,
583 590 fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
584 591 imgs: [
... ... @@ -594,7 +601,7 @@ Page({
594 601  
595 602 [2,6].map(function(item, index) {
596 603 prizes[item] = {
597   - id: award[2].record_id,
  604 + id: award[2].id,
598 605 lbtype: award[2].lbtype,
599 606 fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
600 607 imgs: [
... ... @@ -619,7 +626,7 @@ Page({
619 626 if(length == 4) {
620 627 [0,2,4,6].map(function(item, index) {
621 628 prizes[item] = {
622   - id: award[index].record_id,
  629 + id: award[index].id,
623 630 lbtype: award[index].lbtype,
624 631 fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
625 632 imgs: [
... ... @@ -643,7 +650,7 @@ Page({
643 650 if(length == 5) {
644 651 [0,2,3,5,6].map(function(item, index) {
645 652 prizes[item] = {
646   - id: award[index].record_id,
  653 + id: award[index].id,
647 654 lbtype: award[index].lbtype,
648 655 fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
649 656 imgs: [
... ... @@ -667,7 +674,7 @@ Page({
667 674 if(length == 6) {
668 675 prizes = award.map(function(item, index) {
669 676 return {
670   - id: item.record_id,
  677 + id: item.id,
671 678 lbtype: item.lbtype,
672 679 fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
673 680 imgs: [
... ... @@ -790,7 +797,7 @@ Page({
790 797 if(res.data.code == 0) {
791 798  
792 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 801 // let start = false;
795 802 if(!self.data.start) {
796 803 self.data.start = true;
... ... @@ -810,7 +817,7 @@ Page({
810 817 success: function(res) {
811 818  
812 819 if(res.data.code == 0) {
813   - console.log('开始摇奖', res.data.data);
  820 + // console.log('开始摇奖', res.data.data);
814 821 if(self.data.luckInfo.vip_act_num != 0) {
815 822 self.setData({
816 823 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,
... ... @@ -823,6 +830,7 @@ Page({
823 830 isActive: true,
824 831 wow: res.data.data,
825 832 });
  833 + // console.log('wow', self.data.wow);
826 834 // console.log('请求成功', res.data.data);
827 835 let luckyId = res.data.data.id;
828 836 let indexArr = self.luckyIndex(self.data.prizes, luckyId);
... ... @@ -938,12 +946,12 @@ Page({
938 946 console.log('抽奖结果:',event.detail);
939 947 let no_luck_urltype = this.data.luckInfo.no_luck_urltype;
940 948 let lbtype = null;
941   - let good_id = null;
  949 + // let good_id = null;
942 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 955 if(event.detail.lbtype == 5) {
948 956 lbtype = 5;
949 957 } else {
... ... @@ -957,7 +965,7 @@ Page({
957 965 resultTitle,
958 966 showPopup: false,
959 967 currentLbtype: lbtype,
960   - good_id,
  968 + // good_id,
961 969 });
962 970  
963 971  
... ... @@ -1194,10 +1202,10 @@ Page({
1194 1202 if(e && e.currentTarget.dataset.id) {
1195 1203 id = e.currentTarget.dataset.id;
1196 1204 } else {
1197   - id = this.data.good_id;
  1205 + id = this.data.wow.record_id;
1198 1206 };
1199 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 1209 app.request.put(url, {
1202 1210 success: function(res) {
1203 1211 if(res.data.code == 0) {
... ... @@ -1229,7 +1237,6 @@ Page({
1229 1237 clickReceive() {
1230 1238 this.setData({
1231 1239 showResult: false,
1232   - showMask: false,
1233 1240 });
1234 1241 this.showQr();
1235 1242 },
... ... @@ -1257,4 +1264,34 @@ Page({
1257 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 1298 \ No newline at end of file
... ...