Selaa lähdekoodia

修改 比赛管理 团队排名

zs 2 vuotta sitten
vanhempi
commit
8dde8ba72d
2 muutettua tiedostoa jossa 8 lisäystä ja 22 poistoa
  1. 1 1
      pages/administration/index.js
  2. 7 21
      pages/teamrank/index.js

+ 1 - 1
pages/administration/index.js

@@ -62,7 +62,7 @@ Page({
         wx.getStorage({
             key: 'token',
             success: async res => {
-                const arr = await app.$get(`/courtAdmin/api/match`, {})
+                const arr = await app.$get(`/courtAdmin/api/match`, { status: status })
                 if (arr.errcode == '0') that.setData({ list: arr.data })
             },
             fail: res => {

+ 7 - 21
pages/teamrank/index.js

@@ -40,31 +40,17 @@ Page({
     },
     // 监听用户是否登录
     watchLogin: function () {
+        const that = this;
         wx.getStorage({
             key: 'token',
-            success: res => {
-                var that = this;
-                wx.request({
-                    url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
-                    method: 'get',
-                    data: {},
-                    success(res) {
-                        if (res.data.errcode == 0) {
-                            that.setData({
-                                ranking: res.data.data,
-                            });
-                        } else {
-                            wx.showToast({
-                                title: res.data.errmsg,
-                                icon: 'none',
-                                duration: 2000
-                            })
-                        }
-                    }
-                })
+            success: async res => {
+                let arr;
+                // 参赛团队
+                arr = await app.$get(`/courtAdmin/api/matchteam`);
+                if (arr.errcode == '0') that.setData({ ranking: arr.data });
             },
             fail: res => {
-                return wx.redirectTo({ url: '/pages/login/index', })
+                wx.redirectTo({ url: '/pages/index/index', })
             }
         })
     },