Commit 752394bfa98cbac034e528048f9f7136c03cc9b5

Authored by 前端研发-钱巧玲
1 parent fbfd395a

首页节日营销代码上传

pages/index/index/index.js
@@ -18,7 +18,10 @@ var d = getApp().globalData; @@ -18,7 +18,10 @@ var d = getApp().globalData;
18 Page({ 18 Page({
19 data: { 19 data: {
20 url: o.imghost, 20 url: o.imghost,
21 - swiperimage: ["/miniapp/images/title.png"], //,"/miniapp/images/newpeople/newpeople.png" 21 + swiperimage: [{
  22 + image: "/miniapp/images/title.png",
  23 + nav_url: 0
  24 + }],
22 resourceUrl: o.resourceUrl, 25 resourceUrl: o.resourceUrl,
23 logo: o.appLogo, 26 logo: o.appLogo,
24 homeData: null, 27 homeData: null,
@@ -66,12 +69,11 @@ Page({ @@ -66,12 +69,11 @@ Page({
66 max_sw_height: 0, //banner的最大高度 69 max_sw_height: 0, //banner的最大高度
67 is_disgraceful: 0, //是否显示新人广告 70 is_disgraceful: 0, //是否显示新人广告
68 new_image: "", //新人有礼弹窗图片 71 new_image: "", //新人有礼弹窗图片
69 - new_nav: "/pages/giftpack/newvipgift/newvipgift", //新人页面跳转地址 72 + new_nav: "", //新人页面跳转地址
70 }, 73 },
71 74
72 onLoad: function() { 75 onLoad: function() {
73 var th = this; 76 var th = this;
74 - // n.init(th, "", "recommend");  
75 77
76 //看一下商家是否开通了权益 78 //看一下商家是否开通了权益
77 //--初始化是否有打勾-- 79 //--初始化是否有打勾--
@@ -88,6 +90,7 @@ Page({ @@ -88,6 +90,7 @@ Page({
88 } 90 }
89 }) 91 })
90 th.is_new(); 92 th.is_new();
  93 + // th.is_festival();
91 94
92 }, 95 },
93 //关闭新用户领取广告 96 //关闭新用户领取广告
@@ -655,9 +658,9 @@ Page({ @@ -655,9 +658,9 @@ Page({
655 url: lurl 658 url: lurl
656 }); 659 });
657 }, 660 },
658 - new_nav: function() { 661 + new_nav: function(e) {
659 var th = this; 662 var th = this;
660 - var new_nav = th.data.new_nav; 663 + var new_nav = e.currentTarget.dataset.url;
661 getApp().goto(new_nav); 664 getApp().goto(new_nav);
662 }, 665 },
663 //跳转到权益 666 //跳转到权益
@@ -689,17 +692,21 @@ Page({ @@ -689,17 +692,21 @@ Page({
689 wx.hideLoading(); 692 wx.hideLoading();
690 getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { 693 getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
691 data: { 694 data: {
692 - storeId: o.stoid, 695 + storeId: os.stoid,
693 userId: d.user_id 696 userId: d.user_id
694 } 697 }
695 }).then(res => { 698 }).then(res => {
696 - var actid = res.data.data.id; //活动id  
697 - var giftBagId = res.data.data.giftBagId;//礼包id  
698 - var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 +'&'+ 'giftBagId=' + giftBagId;  
699 - var new_image = res.data.data.imageurl;  
700 - var swiperimage = th.data.swiperimage;  
701 - swiperimage.push("/miniapp/images/newpeople/newpeople.png");  
702 if (res.data.code == 0) { 699 if (res.data.code == 0) {
  700 + var actid = res.data.data.id; //活动id
  701 + var giftBagId = res.data.data.giftBagId; //礼包id
  702 + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
  703 + var new_image = res.data.data.imageurl;
  704 + var swiperimage = th.data.swiperimage;
  705 + var img = {
  706 + image: "/miniapp/images/newpeople/newpeople.png",
  707 + nav_url: new_nav
  708 + }
  709 + swiperimage.unshift(img);
703 th.setData({ 710 th.setData({
704 swiperimage: swiperimage, 711 swiperimage: swiperimage,
705 new_image: new_image, 712 new_image: new_image,
@@ -721,6 +728,32 @@ Page({ @@ -721,6 +728,32 @@ Page({
721 } 728 }
722 }) 729 })
723 730
  731 + },
  732 + is_festival: function(e) {
  733 + var th = this;
  734 + var url = "/api/weshop/marketing/holiday/act/judge";
  735 + getApp().request.promiseGet(url, {
  736 + data: {
  737 + storeId: os.stoid,
  738 + userId: d.user_id
  739 + }
  740 + }).then(res => {
  741 + if (res.data.code == 0) {
  742 + var actid = res.data.data.id; //活动id
  743 + var giftBagId = res.data.data.gifBagId; //礼包id
  744 + var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;
  745 + var swiperimage = th.data.swiperimage;
  746 + var actImg = res.data.data.actImg;
  747 + var img = {
  748 + image: actImg,
  749 + nav_url: nav_url
  750 + }
  751 + swiperimage.unshift(img);
  752 + th.setData({
  753 + swiperimage: swiperimage,
  754 + new_nav: nav_url
  755 + })
  756 + }
  757 + })
724 } 758 }
725 -  
726 }); 759 });
727 \ No newline at end of file 760 \ No newline at end of file
pages/index/index/index.wxml
@@ -110,11 +110,11 @@ @@ -110,11 +110,11 @@
110 </view> 110 </view>
111 <!-- 轮播 --> 111 <!-- 轮播 -->
112 <swiper class="swiper" autoplay="true" interval="5000" circular="{{true}}" indicator-dots="{{true}}" indicator-active-color="rgb(255,255,255)"> 112 <swiper class="swiper" autoplay="true" interval="5000" circular="{{true}}" indicator-dots="{{true}}" indicator-active-color="rgb(255,255,255)">
113 - <!-- 跳转我的权益 --> 113 + <!-- 活动轮播 -->
114 <block wx:for="{{swiperimage}}" wx:for-item="adver" wx:for-index="key"> 114 <block wx:for="{{swiperimage}}" wx:for-item="adver" wx:for-index="key">
115 <swiper-item> 115 <swiper-item>
116 <view class="title-img-frame"> 116 <view class="title-img-frame">
117 - <image class="xc-title-img" src="{{url+adver}}" bindtap="{{key==0?'go_quanyi':'new_nav'}}"></image> 117 + <image class="xc-title-img" src="{{url+adver.image}}" bindtap="{{adver.nav_url==0?'go_quanyi':'new_nav'}}" data-url="{{adver.nav_url}}"></image>
118 </view> 118 </view>
119 </swiper-item> 119 </swiper-item>
120 </block> 120 </block>
pages/index/index/index.wxss
@@ -451,6 +451,7 @@ @@ -451,6 +451,7 @@
451 .xc-title-img { 451 .xc-title-img {
452 height: 220rpx; 452 height: 220rpx;
453 width: 100%; 453 width: 100%;
  454 + border-radius: 15rpx;
454 } 455 }
455 456
456 .title-img-frame { 457 .title-img-frame {
@@ -906,5 +907,5 @@ @@ -906,5 +907,5 @@
906 } 907 }
907 .swiper{ 908 .swiper{
908 height: 250rpx; 909 height: 250rpx;
909 - padding-bottom:10rpx; 910 + padding-bottom:30rpx;
910 } 911 }
911 \ No newline at end of file 912 \ No newline at end of file