Bladeren bron

Merge branch 'master' of http://git.cc-lotus.info/ball-court/court-mobile

zs 3 jaren geleden
bovenliggende
commit
99fa40e1c2
1 gewijzigde bestanden met toevoegingen van 8 en 28 verwijderingen
  1. 8 28
      pages/me/index.js

+ 8 - 28
pages/me/index.js

@@ -18,7 +18,6 @@ Page({
     total: '4',
     //上传比分
     match: [],
-    match_blue: [],
     //个人信息详情
     item1: {},
     //团队列表
@@ -181,34 +180,15 @@ Page({
     }
   },
   //查询比赛列表
-  searchMatch: function (e) {
+  searchMatch: async function (e) {
     const that = this;
-    let id = e[0]._id
-    wx.request({
-      url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
-      method: "get",
-      data: { red_id: id },
-      header: {},
-      success: res => {
-        that.setData({ match: res.data.data })
-      },
-      error: err => {
-      }
-    })
-    wx.request({
-      url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
-      method: "get",
-      data: { blue_id: id },
-      header: {},
-      success: res => {
-        that.setData({ match_blue: res.data.data })
-      },
-      error: err => {
-      }
-    })
-    let match_blue = that.data.match_blue;
-    let match = that.data.match;
-    match = [...match_blue, ...match];
+    let id = e[0]._id;
+    let data = [];
+    const res = await app.$get('/courtAdmin/api/schedule', { red_id: id });
+    if (res.errcode === 0) data = res.data;
+    const arr = await app.$get('/courtAdmin/api/schedule', { blue_id: id });
+    if (arr.errcode === 0) data = [...data, ...arr.data];
+    that.setData({ match: data })
   },
   // 计算高度
   searchHeight: function () {