Explorar o código

首页轮播图

zhaoxiaohai %!s(int64=3) %!d(string=hai) anos
pai
achega
aff66dc287

+ 9 - 5
app.js

@@ -4,6 +4,13 @@ import {
 const _Http = new ApiModel();
 App({
   onLaunch() {
+
+    /* 计算tabbar+iphone安全距离  tabbar页面+100rpx*/
+    let safeAreaBottom = 0,
+      capsule = wx.getMenuButtonBoundingClientRect(),
+      height = 200,
+      that = this;
+
     //轮播图
     _Http.basic({
       "classname": "publicmethod.bannermag.bannermag",
@@ -14,13 +21,9 @@ App({
       }
     }).then(res => {
       console.log(res)
+      that.globalData.bannerDataList = res.data;
     })
 
-    /* 计算tabbar+iphone安全距离  tabbar页面+100rpx*/
-    let safeAreaBottom = 0,
-      capsule = wx.getMenuButtonBoundingClientRect(),
-      height = 200,
-      that = this;
 
     wx.getSystemInfo({
       success(res) {
@@ -39,5 +42,6 @@ App({
   globalData: {
     myNavBorHeight: null, //自定义头部导航高度
     account_list: [], //用户列表
+    bannerDataList: [],
   }
 })

+ 15 - 15
pages/tabbar-pages/home/index.js

@@ -10,19 +10,7 @@ Page({
     data: {
         productList: [], //供需列表
         //轮播图列表
-        swiperBannerList: [{
-            id: "001",
-            url: "/static/changeImg.png",
-            src: ''
-        }, {
-            id: "002",
-            url: "/static/changeImg.png",
-            src: ''
-        }, {
-            id: "003",
-            url: "/static/changeImg.png",
-            src: ''
-        }],
+        swiperBannerList: [],
         /* 宫格列表 */
         gridList: [{
             text: '开单',
@@ -59,6 +47,11 @@ Page({
             wx.navigateTo({
                 url: '/pages/liveStreaming/index',
             })
+        } else {
+            wx.showToast({
+                title: '功能开发中',
+                icon: "none"
+            })
         }
     },
     /* 获得展示区标题 */
@@ -89,13 +82,20 @@ Page({
                 }
             }
         }).then(res => {
-            console.log(res)
-            if (res.msg != '成功') return;
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
             const data = handleList.getYTD(res.data)
             const productList = handleList.listOrdering(data);
             this.setData({
                 productList
             })
+        });
+        /* 获取轮播图 */
+        const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'home_head');
+        this.setData({
+            swiperBannerList: bannerList[0].banner
         })
     },
     /* 一键联系 */

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

@@ -4,7 +4,7 @@
 <view class="homeBanner">
     <swiper class="swiperBanner" autoplay indicator-dots circular="true" indicator-active-color="#fff">
         <swiper-item wx:for="{{swiperBannerList}}" wx:key="index">
-            <image src="{{item.url}}" mode="aspectFill"></image>
+            <image src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
         </swiper-item>
     </swiper>
 </view>

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

@@ -10,7 +10,6 @@
     height: 286rpx;
     padding-top: 20rpx;
     margin: 0 auto;
-    border-radius: 10rpx;
     overflow: hidden;
 }
 
@@ -18,6 +17,7 @@
 .swiperBanner image {
     width: 100%;
     height: 100%;
+    border-radius: 10rpx;
 }
 
 /* 宫格 */