Commit 668c94009767c2b85bc40e8224c5d269801a6877

Authored by yvan.ni
1 parent b7ec4747

积分列表要显示系统广告图片

packageA/pages/jfbuy/jfbuy.js
... ... @@ -73,7 +73,12 @@ Page({
73 73 page:th.data.currentPage2,
74 74 pageSize:th.data.pageSize
75 75 };
76   -
  76 +
  77 + var clientHeight = wx.getSystemInfoSync().windowHeight;
  78 + var clientWidth = wx.getSystemInfoSync().windowWidth;
  79 + this.data.clientHeight=clientHeight;
  80 + this.data.clientWidth=clientWidth;
  81 +
77 82  
78 83 this.request_list(this.data.requestData);
79 84 // var th=this;
... ... @@ -139,6 +144,24 @@ Page({
139 144 // th.countDown();
140 145 // },1000);
141 146 // }
  147 +
  148 +
  149 + //-- 判断有没有自定义的广告图片 --
  150 + getApp().request.get("/api/weshop/ad/page?pid=501&store_id=" + os.stoid, {
  151 + data: {
  152 + enabled: 1
  153 + },
  154 + success:function(res){
  155 + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
  156 + var a = res.data.data.pageData;
  157 + var tt = {
  158 + 'ad_code': os.imghost + a[0].ad_code,
  159 + };
  160 + th.setData({ad:tt})
  161 + }
  162 + }
  163 + })
  164 +
142 165 },
143 166  
144 167 /**
... ... @@ -393,5 +416,18 @@ Page({
393 416 var item=this.data.list2[index];
394 417 var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id;
395 418 getApp().goto(url);
  419 + },
  420 +
  421 +
  422 + imageLoad:function(e){
  423 + var imgwidth = e.detail.width;
  424 + var imgheight = e.detail.height;
  425 + //宽高比
  426 + var ratio = imgwidth / imgheight;
  427 + //计算的高度值
  428 + var viewHeight = this.data.clientWidth / ratio;
  429 + var con_heihgt=this.data.clientHeight-viewHeight;
  430 + this.setData({con_heihgt:con_heihgt})
  431 +
396 432 }
397 433 })
398 434 \ No newline at end of file
... ...
packageA/pages/jfbuy/jfbuy.wxml
... ... @@ -5,8 +5,10 @@
5 5 <view class="input-container"><input bindinput="set_search_value" class="search" type="text" placeholder="请输入您想查找的商品信息"/></view>
6 6 <view bindtap="search_data" class="btn-search">搜索</view>
7 7 </view> -->
8   -
9   - <view class="banner-container flex">
  8 + <view wx:if="{{ad}}">
  9 + <image src="{{ad.ad_code}}" mode="widthFix" bindload="imageLoad"></image>
  10 + </view>
  11 + <view wx:else class="banner-container flex">
10 12 <image src="{{url}}/miniapp/images/integral/liwu.png?v=1" class="banner"></image>
11 13 <view style="display: inline-block; padding-top: 72rpx;">
12 14 <view class="fs36">小积分大作为</view>
... ... @@ -15,7 +17,7 @@
15 17 </view>
16 18  
17 19 <!-- 列表 -->
18   - <view class="list-container">
  20 + <view class="list-container" style="{{ad?('height:'+con_heihgt+'px;'):''}}">
19 21 <!-- 标题 -->
20 22 <view class="title" >
21 23 <block wx:for="{{tab}}">
... ...