|
@@ -1,6 +1,5 @@
|
|
|
// pages/login/login.js
|
|
|
import WxValidate from '../../utils/wxValidate'
|
|
|
-import * as httpUtil from "../../utils/httpUtil";
|
|
|
const app = getApp()
|
|
|
Page({
|
|
|
/**
|
|
@@ -12,7 +11,6 @@ Page({
|
|
|
// 主体高度
|
|
|
infoHeight: '',
|
|
|
teamlist: [],
|
|
|
- schedule: []
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
tabPath(e) {
|
|
@@ -46,58 +44,21 @@ Page({
|
|
|
if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
|
},
|
|
|
// 监听用户是否登录
|
|
|
- watchLogin: function () {
|
|
|
+ watchLogin: async function () {
|
|
|
const that = this;
|
|
|
wx.getStorage({
|
|
|
key: 'token',
|
|
|
- success: res => {
|
|
|
- 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;
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ success: async res => {
|
|
|
+ const arr = await app.$get('/courtAdmin/api/match');
|
|
|
+ if (arr.errcode === 0) {
|
|
|
+ for (const val of arr.data) {
|
|
|
+ if (val.status == '3') {
|
|
|
+ const aee = await app.$get('/courtAdmin/api/schedule', { match_id: val._id });
|
|
|
+ if (aee.errcode === 0) val.schedulelist = aee.data;
|
|
|
}
|
|
|
- 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 })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
+ that.setData({ teamlist: arr.data })
|
|
|
+ }
|
|
|
},
|
|
|
fail: res => {
|
|
|
return wx.redirectTo({ url: '/pages/login/index', })
|