Commit 752394bfa98cbac034e528048f9f7136c03cc9b5
1 parent
fbfd395a
首页节日营销代码上传
Showing
3 changed files
with
50 additions
and
16 deletions
pages/index/index/index.js
| ... | ... | @@ -18,7 +18,10 @@ var d = getApp().globalData; |
| 18 | 18 | Page({ |
| 19 | 19 | data: { |
| 20 | 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 | 25 | resourceUrl: o.resourceUrl, |
| 23 | 26 | logo: o.appLogo, |
| 24 | 27 | homeData: null, |
| ... | ... | @@ -66,12 +69,11 @@ Page({ |
| 66 | 69 | max_sw_height: 0, //banner的最大高度 |
| 67 | 70 | is_disgraceful: 0, //是否显示新人广告 |
| 68 | 71 | new_image: "", //新人有礼弹窗图片 |
| 69 | - new_nav: "/pages/giftpack/newvipgift/newvipgift", //新人页面跳转地址 | |
| 72 | + new_nav: "", //新人页面跳转地址 | |
| 70 | 73 | }, |
| 71 | 74 | |
| 72 | 75 | onLoad: function() { |
| 73 | 76 | var th = this; |
| 74 | - // n.init(th, "", "recommend"); | |
| 75 | 77 | |
| 76 | 78 | //看一下商家是否开通了权益 |
| 77 | 79 | //--初始化是否有打勾-- |
| ... | ... | @@ -88,6 +90,7 @@ Page({ |
| 88 | 90 | } |
| 89 | 91 | }) |
| 90 | 92 | th.is_new(); |
| 93 | + // th.is_festival(); | |
| 91 | 94 | |
| 92 | 95 | }, |
| 93 | 96 | //关闭新用户领取广告 |
| ... | ... | @@ -655,9 +658,9 @@ Page({ |
| 655 | 658 | url: lurl |
| 656 | 659 | }); |
| 657 | 660 | }, |
| 658 | - new_nav: function() { | |
| 661 | + new_nav: function(e) { | |
| 659 | 662 | var th = this; |
| 660 | - var new_nav = th.data.new_nav; | |
| 663 | + var new_nav = e.currentTarget.dataset.url; | |
| 661 | 664 | getApp().goto(new_nav); |
| 662 | 665 | }, |
| 663 | 666 | //跳转到权益 |
| ... | ... | @@ -689,17 +692,21 @@ Page({ |
| 689 | 692 | wx.hideLoading(); |
| 690 | 693 | getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { |
| 691 | 694 | data: { |
| 692 | - storeId: o.stoid, | |
| 695 | + storeId: os.stoid, | |
| 693 | 696 | userId: d.user_id |
| 694 | 697 | } |
| 695 | 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 | 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 | 710 | th.setData({ |
| 704 | 711 | swiperimage: swiperimage, |
| 705 | 712 | new_image: new_image, |
| ... | ... | @@ -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 | 760 | \ No newline at end of file | ... | ... |
pages/index/index/index.wxml
| ... | ... | @@ -110,11 +110,11 @@ |
| 110 | 110 | </view> |
| 111 | 111 | <!-- 轮播 --> |
| 112 | 112 | <swiper class="swiper" autoplay="true" interval="5000" circular="{{true}}" indicator-dots="{{true}}" indicator-active-color="rgb(255,255,255)"> |
| 113 | - <!-- 跳转我的权益 --> | |
| 113 | + <!-- 活动轮播 --> | |
| 114 | 114 | <block wx:for="{{swiperimage}}" wx:for-item="adver" wx:for-index="key"> |
| 115 | 115 | <swiper-item> |
| 116 | 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 | 118 | </view> |
| 119 | 119 | </swiper-item> |
| 120 | 120 | </block> | ... | ... |
pages/index/index/index.wxss
| ... | ... | @@ -451,6 +451,7 @@ |
| 451 | 451 | .xc-title-img { |
| 452 | 452 | height: 220rpx; |
| 453 | 453 | width: 100%; |
| 454 | + border-radius: 15rpx; | |
| 454 | 455 | } |
| 455 | 456 | |
| 456 | 457 | .title-img-frame { |
| ... | ... | @@ -906,5 +907,5 @@ |
| 906 | 907 | } |
| 907 | 908 | .swiper{ |
| 908 | 909 | height: 250rpx; |
| 909 | - padding-bottom:10rpx; | |
| 910 | + padding-bottom:30rpx; | |
| 910 | 911 | } |
| 911 | 912 | \ No newline at end of file | ... | ... |