|
@@ -1,5 +1,6 @@
|
|
|
// pages/login/login.js
|
|
|
import WxValidate from '../../utils/wxValidate'
|
|
|
+import * as httpUtil from "../../utils/httpUtil";
|
|
|
const app = getApp()
|
|
|
Page({
|
|
|
/**
|
|
@@ -50,39 +51,53 @@ Page({
|
|
|
wx.getStorage({
|
|
|
key: 'token',
|
|
|
success: res => {
|
|
|
- // 查询赛程列表
|
|
|
- wx.request({
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
|
|
|
- method: 'get',
|
|
|
- data: {},
|
|
|
- success(res) {
|
|
|
- if (res.data.errcode == 0) {
|
|
|
- that.setData({ schedule: res.data.data })
|
|
|
- } else {
|
|
|
- wx.showToast({ title: res.data.errmsg, icon: 'none', duration: 2000 })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- // 查询比赛列表
|
|
|
- wx.request({
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/match`,
|
|
|
- method: 'get',
|
|
|
- data: {},
|
|
|
- success(res) {
|
|
|
- if (res.data.errcode == 0) {
|
|
|
- let data = res.data.data;
|
|
|
- for (const val of data) {
|
|
|
- if (val.status == '3') {
|
|
|
- let schedulelist = that.data.schedule.filter((i) => i.match_id == val._id);
|
|
|
- val.schedulelist = schedulelist;
|
|
|
- }
|
|
|
+ httpUtil.$get('/courtAdmin/api/match').then(res => {
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ for (const val of res.data) {
|
|
|
+ if (val.status == '3') {
|
|
|
+ httpUtil.$get('/courtAdmin/api/schedule', { match_id: val._id }).then(res => {
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ val.schedulelist = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- if (data) that.setData({ teamlist: data })
|
|
|
- } else {
|
|
|
- wx.showToast({ title: res.data.errmsg, icon: 'none', duration: 2000 })
|
|
|
}
|
|
|
+ that.setData({ teamlist: res.data })
|
|
|
}
|
|
|
})
|
|
|
+ // // 查询赛程列表
|
|
|
+ // wx.request({
|
|
|
+ // url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
|
|
|
+ // method: 'get',
|
|
|
+ // data: {},
|
|
|
+ // success(res) {
|
|
|
+ // if (res.data.errcode == 0) {
|
|
|
+ // that.setData({ schedule: res.data.data })
|
|
|
+ // } else {
|
|
|
+ // wx.showToast({ title: res.data.errmsg, icon: 'none', duration: 2000 })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // // 查询比赛列表
|
|
|
+ // wx.request({
|
|
|
+ // url: `${app.globalData.publicUrl}/courtAdmin/api/match`,
|
|
|
+ // method: 'get',
|
|
|
+ // data: {},
|
|
|
+ // success(res) {
|
|
|
+ // if (res.data.errcode == 0) {
|
|
|
+ // let data = res.data.data;
|
|
|
+ // for (const val of data) {
|
|
|
+ // if (val.status == '3') {
|
|
|
+ // let schedulelist = that.data.schedule.filter((i) => i.match_id == val._id);
|
|
|
+ // val.schedulelist = schedulelist;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (data) that.setData({ teamlist: data })
|
|
|
+ // } else {
|
|
|
+ // wx.showToast({ title: res.data.errmsg, icon: 'none', duration: 2000 })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
fail: res => {
|
|
|
return wx.redirectTo({ url: '/pages/login/index', })
|