Commit ad060c853043a4714c0e8f0c42a97d1006b5513a

Authored by yvan.ni
2 parents 5450d326 7d7eba85

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

packageB/images/luckDraw/jiang.png 0 → 100644

19.6 KB

packageB/pages/luckactivity/luckinfo/luckinfo.js
... ... @@ -6,7 +6,7 @@ let self = null;
6 6 let imgDraw = {
7 7 "width": "554px",
8 8 "height": "899px",
9   - "background": "http://jmh.xinda100.cn/public/images/share_bg.png",
  9 + "background": imghost + "miniapp/images/share_bg.png",
10 10 "views": [
11 11 { //0.头像
12 12 "type": "image",
... ... @@ -38,7 +38,7 @@ let imgDraw = {
38 38 "css": {
39 39 "color": "#fff",
40 40 "background": "#FF6768",
41   - "width": "110px",
  41 + "width": "105px",
42 42 "height": "26px",
43 43 "lineHeight": "26px",
44 44 "top": "70px",
... ... @@ -53,20 +53,18 @@ let imgDraw = {
53 53 "type": "text",
54 54 "text": "",
55 55 "css": {
56   - "color": "red",
57 56 "width": "554px",
58 57 "padding": "20px",
59 58 "left": "20px",
60   - "top": "140px",
  59 + "top": "160px",
61 60 "fontSize": "28px",
62   - "textAlign": "center",
  61 + "textAlign": "left",
63 62 "maxLines": "1",
64   - "fontWeight": "bold",
65 63 }
66 64 },
67 65 { //4.分享内容
68 66 "type": "text",
69   - "text": "分享内容分享内容分享内容分享内容分享内容分享内容分享内容分享内容分享内容",
  67 + "text": "",
70 68 "css": {
71 69 "color": "#000000",
72 70 "width": "554px",
... ... @@ -80,12 +78,14 @@ let imgDraw = {
80 78 },
81 79 { //5.分享图片
82 80 "type": "image",
83   - "url": "",
  81 + "url": "/packageB/images/luckDraw/jiang.png",
84 82 "css": {
85   - "width": "554px",
  83 + "width": "auto",
86 84 "height": "350px",
87   - "top": "240px",
88   - "mode": "scaleToFill",
  85 + "top": "230px",
  86 + "left": "277px",
  87 + "align": "center",
  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,31 +362,59 @@ 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}`;
366 373 app.request.get(url, {
367 374 success: function(res) {
368   - // if(res.data.code == 0) {
  375 + if(res.data.code == 0) {
369 376 self.setData({
370 377 template: res.data.data,
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.bannerUrl, //背景图
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,//分享标题
375   - '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),//分享图片
377   - 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间
  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), //分享图片
  383 + });
  384 +
  385 + // self.setData({
  386 + // template: res.data.data,
  387 + // bannerUrl: imghost + res.data.data.bannerUrl, //背景图
  388 + // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图
  389 + // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘
  390 + // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针
  391 + // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题
  392 + // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容
  393 + // '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'),//分享图片
  394 + // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间
  395 + // });
  396 + } else {
  397 + self.setData({
  398 + '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'), //转盘
  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'), //指针
378 401 });
379   - // };
  402 + };
380 403  
381 404 },
382 405 });
383 406 } else {
  407 +
  408 + if(luckInfo && luckInfo.imageurl) {
  409 + self.setData({
  410 + 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片
  411 + });
  412 + };
384 413  
385 414 if(luckInfo && luckInfo.store_bannerUrl) {
386 415 self.setData({
387 416 bannerUrl: imghost + luckInfo.store_bannerUrl,
  417 + custom: true,
388 418 });
389 419 };
390 420  
... ... @@ -413,7 +443,7 @@ Page({
413 443 self.setData({
414 444 award,
415 445 });
416   - console.log('award', award);
  446 + // console.log('award', award);
417 447 self.prizeLayout(award);
418 448  
419 449 },
... ... @@ -463,9 +493,9 @@ Page({
463 493 // let user_id = app.globalData.userInfo.user_id;
464 494  
465 495 wx.getImageInfo({
466   - src: `${mainUrl}/api/wx/open/app/user/getWeAppEwm/${store_id}?sceneValue=${user_id}_${cj_id}&pageValue=packageB/pages/luckactivity/luckinfo/luckinfo`,
  496 + src: `${mainUrl}/api/wx/open/app/user/getWeAppEwm/${store_id}?sceneValue=${user_id}_${cj_id}&pageValue=pages/index/index/index`,
467 497 success (res) {
468   - if(res.data.code != -1) {
  498 + if(res.code != -1) {
469 499 self.setData({
470 500 'imgDraw.views[16].url': res.path,
471 501 });
... ... @@ -498,7 +528,7 @@ Page({
498 528 if(length == 1) {
499 529 [0,2,4,6].map(function(item, index) {
500 530 prizes[item] = {
501   - id: award[0].record_id,
  531 + id: award[0].id,
502 532 lbtype: award[0].lbtype,
503 533 fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
504 534 imgs: [
... ... @@ -522,7 +552,7 @@ Page({
522 552 if(length == 2) {
523 553 [0,4].map(function(item, index) {
524 554 prizes[item] = {
525   - id: award[0].record_id,
  555 + id: award[0].id,
526 556 lbtype: award[0].lbtype,
527 557 fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
528 558 imgs: [
... ... @@ -538,7 +568,7 @@ Page({
538 568  
539 569 [2,6].map(function(item, index) {
540 570 prizes[item] = {
541   - id: award[1].record_id,
  571 + id: award[1].id,
542 572 lbtype: award[1].lbtype,
543 573 fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
544 574 imgs: [
... ... @@ -562,7 +592,7 @@ Page({
562 592 if(length == 3) {
563 593 [0,4].map(function(item, index) {
564 594 prizes[item] = {
565   - id: award[0].record_id,
  595 + id: award[0].id,
566 596 lbtype: award[0].lbtype,
567 597 fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
568 598 imgs: [
... ... @@ -578,7 +608,7 @@ Page({
578 608  
579 609 [1,5].map(function(item, index) {
580 610 prizes[item] = {
581   - id: award[1].record_id,
  611 + id: award[1].id,
582 612 lbtype: award[1].lbtype,
583 613 fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
584 614 imgs: [
... ... @@ -594,7 +624,7 @@ Page({
594 624  
595 625 [2,6].map(function(item, index) {
596 626 prizes[item] = {
597   - id: award[2].record_id,
  627 + id: award[2].id,
598 628 lbtype: award[2].lbtype,
599 629 fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
600 630 imgs: [
... ... @@ -619,7 +649,7 @@ Page({
619 649 if(length == 4) {
620 650 [0,2,4,6].map(function(item, index) {
621 651 prizes[item] = {
622   - id: award[index].record_id,
  652 + id: award[index].id,
623 653 lbtype: award[index].lbtype,
624 654 fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
625 655 imgs: [
... ... @@ -643,7 +673,7 @@ Page({
643 673 if(length == 5) {
644 674 [0,2,3,5,6].map(function(item, index) {
645 675 prizes[item] = {
646   - id: award[index].record_id,
  676 + id: award[index].id,
647 677 lbtype: award[index].lbtype,
648 678 fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
649 679 imgs: [
... ... @@ -667,7 +697,7 @@ Page({
667 697 if(length == 6) {
668 698 prizes = award.map(function(item, index) {
669 699 return {
670   - id: item.record_id,
  700 + id: item.id,
671 701 lbtype: item.lbtype,
672 702 fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}],
673 703 imgs: [
... ... @@ -790,7 +820,7 @@ Page({
790 820 if(res.data.code == 0) {
791 821  
792 822 if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) {
793   - console.log('start choujiang');
  823 + // console.log('start choujiang');
794 824 // let start = false;
795 825 if(!self.data.start) {
796 826 self.data.start = true;
... ... @@ -810,7 +840,7 @@ Page({
810 840 success: function(res) {
811 841  
812 842 if(res.data.code == 0) {
813   - console.log('开始摇奖', res.data.data);
  843 + // console.log('开始摇奖', res.data.data);
814 844 if(self.data.luckInfo.vip_act_num != 0) {
815 845 self.setData({
816 846 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,
... ... @@ -823,6 +853,7 @@ Page({
823 853 isActive: true,
824 854 wow: res.data.data,
825 855 });
  856 + // console.log('wow', self.data.wow);
826 857 // console.log('请求成功', res.data.data);
827 858 let luckyId = res.data.data.id;
828 859 let indexArr = self.luckyIndex(self.data.prizes, luckyId);
... ... @@ -938,12 +969,12 @@ Page({
938 969 console.log('抽奖结果:',event.detail);
939 970 let no_luck_urltype = this.data.luckInfo.no_luck_urltype;
940 971 let lbtype = null;
941   - let good_id = null;
  972 + // let good_id = null;
942 973 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   - };
  974 + // if(event.detail.id) {
  975 + // console.log('~~~~~~----++++++',event.detail.id);
  976 + // good_id = event.detail.id;
  977 + // };
947 978 if(event.detail.lbtype == 5) {
948 979 lbtype = 5;
949 980 } else {
... ... @@ -957,7 +988,7 @@ Page({
957 988 resultTitle,
958 989 showPopup: false,
959 990 currentLbtype: lbtype,
960   - good_id,
  991 + // good_id,
961 992 });
962 993  
963 994  
... ... @@ -1194,10 +1225,10 @@ Page({
1194 1225 if(e && e.currentTarget.dataset.id) {
1195 1226 id = e.currentTarget.dataset.id;
1196 1227 } else {
1197   - id = this.data.good_id;
  1228 + id = this.data.wow.record_id;
1198 1229 };
1199 1230 let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`;
1200   - console.log('good_id', id, url);
  1231 + // console.log('good_id', id, url);
1201 1232 app.request.put(url, {
1202 1233 success: function(res) {
1203 1234 if(res.data.code == 0) {
... ... @@ -1229,7 +1260,6 @@ Page({
1229 1260 clickReceive() {
1230 1261 this.setData({
1231 1262 showResult: false,
1232   - showMask: false,
1233 1263 });
1234 1264 this.showQr();
1235 1265 },
... ... @@ -1257,4 +1287,34 @@ Page({
1257 1287 myimg: e.detail.path,
1258 1288 });
1259 1289 },
  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 + },
1260 1320 })
1261 1321 \ No newline at end of file
... ...
packageB/pages/luckactivity/luckinfo/luckinfo.wxml
1 1 <wxs module="filter" src="../../../../utils/filter.wxs"></wxs>
2 2 <wxs module="tool" src="./tool.wxs"></wxs>
3   -<view class="luck-container {{template ? '':'on'}}" style="background: {{template.colorCode ? template.colorCode:'#f0f0f0'}} url({{bannerUrl ? bannerUrl:(imghost + 'miniapp/images/luckDraw/bg.png?v=2')}}) no-repeat;">
  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;">
4 4 <!-- 中奖人员 -->
5 5 <view class="swiper-container" wx:if="{{nameList && nameList.length != 0}}">
6 6 <swiper class="swiper" autoplay="true" circular="true" vertical="true" interval="3000">
... ... @@ -36,7 +36,7 @@
36 36 />
37 37 </view>
38 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:else>今天你还有 <text class="fs50 c-yellow">{{filter.show_default(luckInfo.user_LuckNumDay, '0')}}</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 40 <view class="tip-to-down expand-transition">
41 41 <text></text>
42 42 <text></text>
... ... @@ -118,7 +118,7 @@
118 118 <!-- 技术支持 -->
119 119 <view class="logo-container t-c">
120 120 <!-- <view class="pdt20 fs26 text-underline">帮美店免费开通这个玩法</view> -->
121   - <view class="flex ai_c fs24 jc-center pdv20 white"><image src="{{imghost + 'miniapp/images/luckDraw/logo.png'}}" class="logo" lazy-load></image>提供技术支持</view>
  121 + <view class="flex ai_c fs24 jc-center pdv20 white"><image src="{{imghost + 'miniapp/images/luckDraw/logo.png?v=3'}}" class="logo" lazy-load></image>提供技术支持</view>
122 122 </view>
123 123 </view>
124 124  
... ...
packageB/pages/luckactivity/luckinfo/luckinfo.wxss
... ... @@ -113,8 +113,8 @@ page,
113 113 }
114 114  
115 115 .logo {
116   - width: 120rpx;
117   - height: 40rpx;
  116 + width: 132rpx;
  117 + height: 37rpx;
118 118 margin-right: 10rpx;
119 119 }
120 120  
... ... @@ -470,7 +470,7 @@ page,
470 470 }
471 471  
472 472 .luck-container.on .panel {
473   - box-shadow: 0 16rpx 24rpx #e7e9eb;
  473 + box-shadow: 0 0 24rpx #e7e9eb;
474 474 }
475 475  
476 476 .luck-container.on .cs {
... ...