Commit 1d0fc3919ea362eaf069e6f075cdccf5f16f92d2

Authored by 后端研发-倪永富
1 parent 1f931ea0

首页顶部的图片,要用广告的图片

pages/user/index/index.js
@@ -40,6 +40,7 @@ Page({ @@ -40,6 +40,7 @@ Page({
40 actId: "", //生日活动的id 40 actId: "", //生日活动的id
41 actImg: "", 41 actImg: "",
42 is_assistance: 0, //助力活动 42 is_assistance: 0, //助力活动
  43 + ad_img:"",
43 }, 44 },
44 goto_nav: function(e) { 45 goto_nav: function(e) {
45 var th = this; 46 var th = this;
@@ -56,7 +57,18 @@ Page({ @@ -56,7 +57,18 @@ Page({
56 * 生命周期函数--监听页面加载 57 * 生命周期函数--监听页面加载
57 */ 58 */
58 onLoad: function(options) { 59 onLoad: function(options) {
  60 + var th=this;
59 this.birthday(); 61 this.birthday();
  62 + getApp().request.promiseGet("/api/weshop/ad/list?pid=401&store_id=" + os.stoid, {
  63 + data: {
  64 + enabled: 1
  65 + }
  66 + }).then(res => {
  67 + if(res.data.code==0 && res.data.data){
  68 + var item=res.data.data[0];
  69 + th.setData({ad_img:item.ad_code})
  70 + }
  71 + })
60 }, 72 },
61 73
62 /** 74 /**
@@ -551,12 +563,12 @@ Page({ @@ -551,12 +563,12 @@ Page({
551 }, 563 },
552 // 判断生日营销的页面是不是存在 564 // 判断生日营销的页面是不是存在
553 birthday: function() { 565 birthday: function() {
554 - 566 +
555 var th = this; 567 var th = this;
556 rq.get("/api/weshop/marketing/birthday/act/judge", { 568 rq.get("/api/weshop/marketing/birthday/act/judge", {
557 data: { storeId: os.stoid, userId: app_d.user_id }, 569 data: { storeId: os.stoid, userId: app_d.user_id },
558 success: function (res) { 570 success: function (res) {
559 - 571 +
560 var code = res.data.code; 572 var code = res.data.code;
561 if (code == 0) { 573 if (code == 0) {
562 var giftbagid = res.data.data.giftBagId; 574 var giftbagid = res.data.data.giftBagId;
@@ -575,7 +587,7 @@ Page({ @@ -575,7 +587,7 @@ Page({
575 var th = this; 587 var th = this;
576 var actId = th.data.actId; 588 var actId = th.data.actId;
577 var giftbagid = th.data.giftbagid; 589 var giftbagid = th.data.giftbagid;
578 - 590 +
579 if (actId != "" && giftbagid != "") { 591 if (actId != "" && giftbagid != "") {
580 592
581 getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3); 593 getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3);
@@ -584,7 +596,7 @@ Page({ @@ -584,7 +596,7 @@ Page({
584 getApp().showWarning("请稍后重试"); 596 getApp().showWarning("请稍后重试");
585 } 597 }
586 }, 598 },
587 - // 判断助力活动是不是存在 599 + // 判断助力活动是不是存在
588 is_assistance: function() { 600 is_assistance: function() {
589 var th = this; 601 var th = this;
590 rq.get("/api/weshop/marketing/help/act/judge", { 602 rq.get("/api/weshop/marketing/help/act/judge", {
@@ -607,4 +619,4 @@ Page({ @@ -607,4 +619,4 @@ Page({
607 619
608 620
609 621
610 -})  
611 \ No newline at end of file 622 \ No newline at end of file
  623 +})
pages/user/index/index.wxml
1 <view class="xc-page"> 1 <view class="xc-page">
2 <view class="xc-user"> 2 <view class="xc-user">
3 - <view class="xc-head rel">  
4 - <image class="xc-background" src="{{iurl}}/miniapp/images/user_index_powder.jpg"> 3 + <view class="xc-head rel">
  4 + <image class="xc-background" src="{{iurl}}{{ad_img?ad_img:'/miniapp/images/user_index_powder.jpg'}}">
5 <view class="flex-space-between abs xc-user-frame"> 5 <view class="flex-space-between abs xc-user-frame">
6 <view class="xc-user-left flex" wx:if="{{userInfo}}"> 6 <view class="xc-user-left flex" wx:if="{{userInfo}}">
7 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image> 7 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image>
@@ -69,19 +69,19 @@ @@ -69,19 +69,19 @@
69 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image> 69 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image>
70 <view class="member fs28 "> 加入plus会员预计可省3031元</view> 70 <view class="member fs28 "> 加入plus会员预计可省3031元</view>
71 </view> 71 </view>
72 - <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto"> 72 + <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto">
73 <view class="xc-opening fs28">立即开通</view> 73 <view class="xc-opening fs28">立即开通</view>
74 </view> 74 </view>
75 </view> 75 </view>
76 </view> 76 </view>
77 - 77 +
78 <view class="xc-add-member-frame flex-level rel addplus" wx:if="{{is_dengji==3}}"> 78 <view class="xc-add-member-frame flex-level rel addplus" wx:if="{{is_dengji==3}}">
79 <view class="xc-add-member flex-center-around "> 79 <view class="xc-add-member flex-center-around ">
80 <view class="flex jc-center ai-center"> 80 <view class="flex jc-center ai-center">
81 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image> 81 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image>
82 <view class="member fs28 "> 加入plus会员预计可省3031元</view> 82 <view class="member fs28 "> 加入plus会员预计可省3031元</view>
83 </view> 83 </view>
84 - <view class="xc-opening-button t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto"> 84 + <view class="xc-opening-button t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto">
85 <view class="xc-opening fs28">立即续费</view> 85 <view class="xc-opening fs28">立即续费</view>
86 </view> 86 </view>
87 </view> 87 </view>
@@ -232,7 +232,7 @@ @@ -232,7 +232,7 @@
232 <view class="item t-c" data-url="/pages/user/assistance/assistance" bindtap="goto_nav"> 232 <view class="item t-c" data-url="/pages/user/assistance/assistance" bindtap="goto_nav">
233 <image class="xc-center-img " src="{{iurl}}/miniapp/images/friendhelp/icon-zl.png"></image> 233 <image class="xc-center-img " src="{{iurl}}/miniapp/images/friendhelp/icon-zl.png"></image>
234 <view class="four-level-word">助力活动</view> 234 <view class="four-level-word">助力活动</view>
235 - </view> 235 + </view>
236 </block> 236 </block>
237 237
238 </view> 238 </view>
@@ -262,7 +262,7 @@ @@ -262,7 +262,7 @@
262 <!-- 显示商品 --> 262 <!-- 显示商品 -->
263 <!-- 好物推荐 --> 263 <!-- 好物推荐 -->
264 <goods_recommend id="goods_recommend"></goods_recommend> 264 <goods_recommend id="goods_recommend"></goods_recommend>
265 - 265 +
266 </view> 266 </view>
267 </view> 267 </view>
268 268
@@ -290,4 +290,4 @@ @@ -290,4 +290,4 @@
290 </view> 290 </view>
291 </view> 291 </view>
292 292
293 -<pop_txt id="pop_txt"></pop_txt>  
294 \ No newline at end of file 293 \ No newline at end of file
  294 +<pop_txt id="pop_txt"></pop_txt>