瀏覽代碼

我的页面

YY 3 年之前
父節點
當前提交
0fe485a689
共有 3 個文件被更改,包括 93 次插入67 次删除
  1. 79 53
      pages/me/index.js
  2. 11 12
      pages/me/index.wxml
  3. 3 2
      pages/me/index.wxss

+ 79 - 53
pages/me/index.js

@@ -17,10 +17,7 @@ Page({
     infoHeight: '',
     total: '4',
     //上传比分
-    item: {
-      id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', week: '星期五', time: '13:00',
-      state: '已结束', date: '01.15', start: '未开始'
-    },
+    match: [],
     //个人信息详情
     item1: {},
     //团队列表
@@ -113,62 +110,91 @@ Page({
     wx.getStorage({
       key: 'token',
       success: res => {
-        //数据请求
-        //用户详情
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
-          method: "get",//请求方法
-          data: {},//请求参数
-          header: {},
-          success: res => {
-            that.setData({ item1: res.data.data })
-            let type = res.data.data.type;
-            let icon = res.data.data.icon[0];
-            if (icon) this.setData({ icon: icon.url })
-            else this.setData({ icon: '/image/tou.png' });
-            // 判断用户身份显示不同功能按钮
-            let jump = btn.filter((i) => i.type.includes(type));
-            if (jump) that.setData({ jumpList: jump });
-          },
-          error: err => {
-          }
-        })
-        let type = res.data.type
-        if (type == 1) {
-          //团队管理员-团队列表
-          wx.request({
-            url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
-            method: "get",//请求方法
-            data: {},//请求参数
-            header: {},
-            success: res => {
-              that.setData({ list: res.data.data })
-            },
-            error: err => {
-            }
-          })
-        } else if (type == 2) {
-          //个人用户-所在团队列表
-          wx.request({
-            url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`, //接口地址
-            method: "get",//请求方法
-            data: { user_id: res.data.id },//请求参数
-            header: {},
-            success: res => {
-              console.log(res);
-              that.setData({ list: res.data.data })
-            },
-            error: err => {
-            }
-          })
-        }
+        //查询用户信息
+        that.searchUser(res.data);
+        //查询团队列表
+        that.searchTeam(res.data);
       },
       fail: res => {
         wx.redirectTo({ url: '/pages/login/index', })
       }
     })
   },
+  //查询用户信息
+  searchUser: function (e) {
+    const that = this;
+    var id = e.id;
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/user/${id}`,
+      method: "get",
+      data: {},
+      header: {},
+      success: res => {
+        that.setData({ item1: res.data.data })
+        let type = res.data.data.type;
+        let icon = res.data.data.icon[0];
+        if (icon) this.setData({ icon: icon.url })
+        else this.setData({ icon: '/image/tou.png' });
+        // 判断用户身份显示不同功能按钮
+        let jump = btn.filter((i) => i.type.includes(type));
+        if (jump) that.setData({ jumpList: jump });
+      },
+      error: err => {
+      }
+    })
+  },
+  //查询团队列表
+  searchTeam: function (e) {
+    let id = e.id;
+    let type = e.type
+    if (type == 1) {
+      //团队管理员-团队列表
+      wx.request({
+        url: `${app.globalData.publicUrl}/courtAdmin/api/team`,
+        method: "get",
+        data: {},
+        header: {},
+        success: res => {
+          this.setData({ list: res.data.data })
+          //查询比赛列表
+          this.searchMatch(res.data.data);
+        },
+        error: err => {
+        }
+      })
+    } else if (type == 2) {
+      //个人用户-所在团队列表
+      wx.request({
+        url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`,
+        method: "get",
+        data: { user_id: id },
+        header: {},
+        success: res => {
+          this.setData({ list: res.data.data })
 
+        },
+        error: err => {
+        }
+      })
+    }
+  },
+  //查询比赛列表
+  searchMatch: function (e) {
+    let id = e[0]._id
+    console.log(e[0]._id);
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
+      method: "get",
+      data: { blue_id: id , red_id :id},
+      header: {},
+      success: res => {
+        console.log(res.data.data);
+        this.setData({ match: res.data.data })
+      },
+      error: err => {
+      }
+    })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 11 - 12
pages/me/index.wxml

@@ -35,8 +35,8 @@
       </view>
     </view>
     <!-- 上传比分 -->
-    <view class="four" wx:if="{{item1.type=='1'}}">
-      <view class="thr">
+    <view class="four" wx:if="{{item1.type=='1'}}" wx:for="{{match}}" wx:key="item">
+      <view class="thr" wx:if="{{item.status=='1'}}">
         <view class="left2">
           <text class="text4">可对正在进行的比赛上次比分</text>
         </view>
@@ -47,11 +47,10 @@
       <image src="{{src3}}" class="huang"></image>
       <view class="list1">
         <view class="left3">
-          <text class="text5">{{item.start}}</text>
+          <text class="text5">{{item.status=='1'?'进行中':item.status=='0'?'未开始':'已结束'}}</text>
         </view>
         <view class="right3">
-          <text class="text6">{{item.date}}</text>
-          <text class="text6">{{item.time}}</text>
+          <text class="text6">{{item.match_time}}</text>
         </view>
         <view class="right4">
           <view class="right1_1">
@@ -60,24 +59,24 @@
           </view>
           <view class="right1_2">
             <view class="right1_2o">
-              <image class="head1" src="{{item.head1}}"></image>
+              <image class="head1" src="{{item.red_logo[0].url}}"></image>
             </view>
-            <view class="right1_2t"><text>{{item.groupname1}}</text></view>
+            <view class="right1_2t"><text>{{item.red_name}}</text></view>
             <view class="right1_2i">
-              <text class="text6-1">{{item.fraction1}}</text>
+              <text class="text6-1">{{item.red_branch||0}}</text>
               <text class="text8-1">:</text>
-              <text class="text7-1">{{item.fraction2}}</text>
+              <text class="text7-1">{{item.blue_branch||0}}</text>
             </view>
-            <view class="right1_2t"><text>{{item.groupname2}}</text></view>
+            <view class="right1_2t"><text>{{item.blue_name}}</text></view>
             <view class="right1_2o">
-              <image class="head2" src="{{item.head2}}"></image>
+              <image class="head2" src="{{item.blue_logo[0].url}}"></image>
             </view>
           </view>
         </view>
       </view>
     </view>
     <!-- 上传比分-无比赛 -->
-    <view class="four-zan" wx:if="{{listbisai.length==0}}" wx:key="item" wx:for="{{listbisai}}">
+    <view class="four-zan" wx:if="{{item.length==0}}" >
       <view class="zan-left">
         <text>暂无比赛</text>
       </view>

+ 3 - 2
pages/me/index.wxss

@@ -136,7 +136,8 @@
   /* position: relative;
   top: -30px; */
   width: 100%;
-  height: 105px;
+  /* height: 105px; */
+  margin: 0 0 16px 0;
 }
 
 .left3 {
@@ -360,7 +361,7 @@
   margin-top: 12px;
   margin-left: 3px;
   float: left;
-  width: 55%;
+  width: 47%;
 }
 
 .date {