Browse Source

首页轮播

zhaoxiaohai 3 years ago
parent
commit
0eebc1a57e

+ 0 - 1
app.js

@@ -20,7 +20,6 @@ App({
         "fclienttype": "MOBILE"
       }
     }).then(res => {
-      console.log(res)
       that.globalData.bannerDataList = res.data;
     })
 

+ 4 - 1
components/My_BannerSwiper/index.js

@@ -25,7 +25,10 @@ Component({
             const {
                 url
             } = e.target.dataset;
-            console.log(url)
+            if (url) wx.navigateTo({
+                url: url,
+            })
+
         }
     }
 })

+ 1 - 1
components/My_BannerSwiper/index.wxml

@@ -1,7 +1,7 @@
 <!-- banner -->
 <view class="supplyAndDemandBanner">
     <view class="swiperBanner">
-        <swiper autoplay indicator-dots circular="true" indicator-active-color="#fff">
+        <swiper autoplay indicator-dots circular="true" indicator-active-color="#fff" indicator-color="rgba(255,255,255,.5)">
             <swiper-item wx:for="{{swiperBannerList}}" wx:key="index">
                 <image src="{{item.attinfos[0].fobsurl}}" data-url="{{item.fhyperlink}}" catchtap="clickToPage" mode="aspectFill"></image>
             </swiper-item>

+ 1 - 1
components/My_TwoDimensionalCode/index.wxml

@@ -1,5 +1,5 @@
 <My_DisplayBox title="{{title}}" isMore="{{false}}">
-    <image slot="display-box-img" class="display-title_image" src="/static/icon-05.png" mode="aspectFit"></image>
+    <image slot="display-box-img" class="display-title_image" src="/static/icon-08.png" mode="aspectFit"></image>
     <view class="two-code" bindtap="preViewImage">
         <image src="{{imageUrl}}" mode="aspectFit"></image>
     </view>

+ 4 - 2
components/My_VerticalBox/index.js

@@ -4,7 +4,9 @@ Component({
      * 组件的属性列表
      */
     properties: {
-
+        list: {
+            type: Array
+        }
     },
 
     /**
@@ -20,4 +22,4 @@ Component({
     methods: {
 
     }
-})
+})

+ 3 - 3
components/My_VerticalBox/index.wxml

@@ -1,7 +1,7 @@
 <view class="VerticalBox">
-    <view class="VerticalBox-item" wx:for="{{3}}">
-        <image class="VerticalBox-image" src="/static/userImage.png" mode="aspectFit"></image>
-        <view class="VerticalBox-title">花旗</view>
+    <view class="VerticalBox-item" wx:for="{{list}}">
+        <image class="VerticalBox-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+        <view class="VerticalBox-title">{{item.fbrand}}</view>
         <view class="VerticalBox-explain">休闲风格</view>
     </view>
 </view>

+ 36 - 4
pages/tabbar-pages/home/index.js

@@ -28,7 +28,8 @@ Page({
         /* 圆角按钮tabs列表 */
         roundedList: [
             "兴趣爱好", "关注板块", "最新发布"
-        ]
+        ],
+        partnerList: [], //合作商家列表
     },
     /* tabs切换 */
     /* tabsSelectedIitem(text) {
@@ -56,11 +57,17 @@ Page({
     },
     /* 获得展示区标题 */
     getExhibitionTitle(title) {
-        console.log(title.detail)
-        if (title.detail == '最新供需') {
+        const {
+            detail
+        } = title;
+        if (detail == '最新供需') {
             wx.switchTab({
                 url: '/pages/tabbar-pages/supplyAndDemand/index',
             })
+        } else if (detail == '合作商家') {
+            wx.navigateTo({
+                url: '/pages/businessPartner/index',
+            })
         }
     },
     /**
@@ -92,11 +99,36 @@ Page({
                 productList
             })
         });
+        /* 获取合作商家 */
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.tagents.tagents",
+            "method": "query_cooperation",
+            "content": {
+                "getdatafromdbanyway": true,
+                "pageNumber": 1,
+                "pageSize": 9,
+                "where": {
+                    "condition": "",
+                    "ftype": "",
+                    "fstatus": "合作"
+                }
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            const partnerList = handleList.twoDimensionalArr(res.data, 3);
+            this.setData({
+                partnerList
+            })
+        })
         /* 获取轮播图 */
         const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'home_head');
         this.setData({
             swiperBannerList: bannerList[0].banner
-        })
+        });
     },
     /* 一键联系 */
     contact() {

+ 2 - 8
pages/tabbar-pages/home/index.wxml

@@ -41,14 +41,8 @@
     <image slot="display-box-img" class="display-title_image" src="/static/icon-04.png" mode="aspectFit"></image>
     <!-- 轮播 -->
     <swiper class="businessPartnerBanner" indicator-dots autoplay interval="3000" circular>
-        <swiper-item>
-            <My_VerticalBox></My_VerticalBox>
-        </swiper-item>
-        <swiper-item>
-            <My_VerticalBox></My_VerticalBox>
-        </swiper-item>
-        <swiper-item>
-            <My_VerticalBox></My_VerticalBox>
+        <swiper-item wx:for="{{partnerList}}" wx:key="index">
+            <My_VerticalBox list="{{item}}"></My_VerticalBox>
         </swiper-item>
     </swiper>
 </My_DisplayBox>

BIN
static/icon-08.png


+ 12 - 1
utils/processingData.js

@@ -1,3 +1,13 @@
+/* 二维数组 */
+function twoDimensionalArr(data, nub, max = 3) {
+    let list = data,
+        arrList = [];
+    for (let i = 0; max > i && list.length >= 1; i++) {
+        arrList.push(list.splice(0, nub))
+    };
+    return arrList;
+}
+
 /* 格式化时间 */
 function checkdate(data) {
     for (let i = 0; i < data.length; i++) {
@@ -33,5 +43,6 @@ function listOrdering(data) {
 module.exports = {
     checkdate,
     listOrdering,
-    getYTD
+    getYTD,
+    twoDimensionalArr
 }