zhaoxiaohai 3 years ago
parent
commit
834eb2d52e

+ 16 - 14
app.js

@@ -4,25 +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",
-      "method": "query_bannerlocationlist",
-      "content": {
-        "siteid": "BWJ",
-        "fclienttype": "MOBILE"
-      }
-    }).then(res => {
-      that.globalData.bannerDataList = res.data;
-    })
-
+    //获取轮播图
+    this.getBanner();
     wx.getSystemInfo({
       success(res) {
         //计算底部安全距离高度
@@ -37,6 +25,20 @@ App({
     })
 
   },
+  getBanner() {
+    //轮播图
+    _Http.basic({
+      "classname": "publicmethod.bannermag.bannermag",
+      "method": "query_bannerlocationlist",
+      "content": {
+        "siteid": "BWJ",
+        "fclienttype": "MOBILE"
+      }
+    }).then(res => {
+      if (res.msg != '成功') return this.getBanner();
+      this.globalData.bannerDataList = res.data;
+    })
+  },
   globalData: {
     myNavBorHeight: 0, //自定义头部导航高度
     safeAreaBottom: 0, //底部安全距离

+ 16 - 3
pages/tabbar-pages/supplyAndDemand/index.js

@@ -34,11 +34,24 @@ Page({
             "method": "query_typeselectList",
             "content": {}
         }).then(res => {
-            console.log("分类", res)
-            if (res.msg != '成功') return;
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            for (let i = 0; i < res.data.length; i++) {
+                let attinfos = [];
+                for (let k = 0; k < res.data[i].attinfos.length; k++) {
+                    if (res.data[i].attinfos[k].ftype == 'default') {
+                        attinfos.unshift(res.data[i].attinfos[k])
+                    } else if (res.data[i].attinfos[k].ftype == 'click') {
+                        attinfos.push(res.data[i].attinfos[k])
+                    }
+                };
+                res.data[i].attinfos = attinfos;
+            };
             this.setData({
                 ftypeList: res.data
-            })
+            });
         });
         /* 获取轮播图 */
         const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'supplyanddemand_head');

+ 5 - 2
pages/tabbar-pages/supplyAndDemand/index.wxml

@@ -10,8 +10,11 @@
             <!-- 宫格 -->
             <view class="grid_box">
                 <view class="grid_item" wx:key="index" wx:for="{{ftypeList}}" data-type="{{item.ftype}}" bindtap="switchScreenType">
-                    <view class="grid_item_image {{ftype==item.ftype?'grid_item_pitchOn':''}}">
-                        <!-- <image></image> -->
+                    <view class="grid_item_image" wx:if="{{ftype==item.ftype}}">
+                        <image src="{{item.attinfos[1].fobsurl}}"></image>
+                    </view>
+                    <view wx:else class="grid_item_image">
+                        <image src="{{item.attinfos[0].fobsurl}}"></image>
                     </view>
                     <view class="grid_item_title u-line-1">{{item.ftype}}</view>
                 </view>

+ 3 - 4
pages/tabbar-pages/supplyAndDemand/index.wxss

@@ -202,14 +202,13 @@
 .grid_item_image {
     width: 80rpx;
     height: 80rpx;
-    border-radius: 50%;
-    background: #D8D8D8;
     margin-bottom: 10rpx;
     box-sizing: border-box;
 }
 
-.grid_item_pitchOn {
-    border: 2rpx solid #4CBECF;
+.grid_item_image image {
+    width: 100%;
+    height: 100%;
 }
 
 .grid_item_title {

+ 0 - 1
utils/Http.js

@@ -17,7 +17,6 @@ class HTTP {
             title: '加载中...',
             mask: true
         })
-        console.log("发送请求")
         wx.request({
             url: baseUrl + url,
             data: data,