zhaoxiaohai 2 年之前
父节点
当前提交
de736b54d5
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 10 1
      pages/tabbar/home/index.js
  2. 1 1
      pages/tabbar/home/index.wxml

+ 10 - 1
pages/tabbar/home/index.js

@@ -88,7 +88,6 @@ Page({
         this.setData({
             bannerList: wx.getStorageSync('banner_list')[0].ads
         })
-        console.log()
         this.refreshData(wx.getStorageSync('userMsg'))
         this.setData({ //获取胶囊位置信息
             capsule: wx.getMenuButtonBoundingClientRect()
@@ -191,6 +190,16 @@ Page({
             }
         })
     },
+    /* banner */
+    bannerClick(e) {
+        const {
+            hyperlink
+        } = e.currentTarget.dataset;
+        if (!hyperlink) return;
+        wx.navigateTo({
+            url: hyperlink
+        })
+    },
     /**
      * 生命周期函数--监听页面显示
      */

+ 1 - 1
pages/tabbar/home/index.wxml

@@ -15,7 +15,7 @@
     <view class="banner_oval" />
     <swiper class='banner_content'>
         <swiper-item wx:for="{{bannerList}}">
-            <image src="{{item.attinfos[0].url}}" mode="aspectFill"></image>
+            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-hyperlink="{{hyperlink}}" bindtap="bannerClick" />
         </swiper-item>
     </swiper>
 </view>