Commit b112c6c0ca3d31fe914e36b66c2e0908a76f3f21
1 parent
0bbf5cc5
1. 点击首页广告的滚动跳转到链接地址
Showing
2 changed files
with
11 additions
and
4 deletions
pages/index/index/index.js
@@ -229,7 +229,6 @@ Page({ | @@ -229,7 +229,6 @@ Page({ | ||
229 | }); | 229 | }); |
230 | } | 230 | } |
231 | }, | 231 | }, |
232 | - | ||
233 | //---读取数据内容--- | 232 | //---读取数据内容--- |
234 | async init_fir() { | 233 | async init_fir() { |
235 | var th = this; | 234 | var th = this; |
@@ -245,7 +244,8 @@ Page({ | @@ -245,7 +244,8 @@ Page({ | ||
245 | for (var i = 0; i < a.length; i++) { | 244 | for (var i = 0; i < a.length; i++) { |
246 | var tt = { | 245 | var tt = { |
247 | 'ad_code': o.imghost + a[i].ad_code, | 246 | 'ad_code': o.imghost + a[i].ad_code, |
248 | - 'media_link': '' | 247 | + 'media_link': '', |
248 | + 'ad_weapplink':a[i].ad_weapplink | ||
249 | }; | 249 | }; |
250 | arr.push(tt); | 250 | arr.push(tt); |
251 | } | 251 | } |
@@ -825,6 +825,13 @@ Page({ | @@ -825,6 +825,13 @@ Page({ | ||
825 | is_disgraceful: 1 | 825 | is_disgraceful: 1 |
826 | }) | 826 | }) |
827 | }) | 827 | }) |
828 | + }, | ||
829 | + | ||
830 | + go_ad:function(e){ | ||
831 | + var url=e.currentTarget.dataset.url; | ||
832 | + if(!url || url=='') return; | ||
833 | + if(url[0]!='/') url='/'+url; | ||
834 | + getApp().goto(url); | ||
828 | } | 835 | } |
829 | 836 | ||
830 | }); | 837 | }); |
831 | \ No newline at end of file | 838 | \ No newline at end of file |
pages/index/index/index.wxml
@@ -31,8 +31,8 @@ | @@ -31,8 +31,8 @@ | ||
31 | <view class="rel title-img" wx:if="{{banner}}"> | 31 | <view class="rel title-img" wx:if="{{banner}}"> |
32 | <swiper autoplay="true" class="swiper_box" duration="1000" interval="3000" vertical="" bindchange="bannerSwiperChange" style="height:{{max_sw_height}}rpx"> | 32 | <swiper autoplay="true" class="swiper_box" duration="1000" interval="3000" vertical="" bindchange="bannerSwiperChange" style="height:{{max_sw_height}}rpx"> |
33 | <swiper-item wx:for="{{banner}}" wx:key="banner" class="swiperItem"> | 33 | <swiper-item wx:for="{{banner}}" wx:key="banner" class="swiperItem"> |
34 | - <view url="{{item.media_link}}" class="slide-image-frame"> | ||
35 | - <image class="slide-image" mode="widthFix" src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" lazy-load="true" binderror="bind_bnerr" data-errorimg="banner[{{index}}].ad_code"></image> | 34 | + <view class="slide-image-frame"> |
35 | + <image bindtap='go_ad' data-url="{{item.ad_weapplink}}" class="slide-image" mode="widthFix" src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" lazy-load="true" binderror="bind_bnerr" data-errorimg="banner[{{index}}].ad_code"></image> | ||
36 | </view> | 36 | </view> |
37 | </swiper-item> | 37 | </swiper-item> |
38 | </swiper> | 38 | </swiper> |