|
@@ -23,6 +23,8 @@ Page({
|
|
|
// 弹框
|
|
|
dialog: { title: '上传比分', show: false, type: '1' },
|
|
|
form: {},
|
|
|
+ // 上传比分
|
|
|
+ scoreList: []
|
|
|
|
|
|
},
|
|
|
initValidate() {
|
|
@@ -36,21 +38,19 @@ Page({
|
|
|
if (route) wx.redirectTo({ url: `/${route}` })
|
|
|
},
|
|
|
// 上传比分
|
|
|
- toScore: function () {
|
|
|
+ toScore: async function () {
|
|
|
const that = this;
|
|
|
+ const arr = await app.$get(`/courtAdmin/api/schedule/getByTeamCreater`, { user_id: that.data.userInfo._id, status: '1' });
|
|
|
+ if (arr.errcode == '0') that.setData({ scoreList: arr.data })
|
|
|
that.setData({ dialog: { title: '上传比分', show: true, type: '1' } })
|
|
|
},
|
|
|
// 选择比赛
|
|
|
ismatchChange: function (e) {
|
|
|
const that = this;
|
|
|
- const list = that.data.ismatchList;
|
|
|
+ const list = that.data.scoreList;
|
|
|
const { value } = e.detail;
|
|
|
const data = list[value];
|
|
|
- if (data) {
|
|
|
- that.setData({ 'form._id': data._id })
|
|
|
- that.setData({ 'form.red_name': data.red_name })
|
|
|
- that.setData({ 'form.blue_name': data.blue_name })
|
|
|
- }
|
|
|
+ if (data) that.setData({ form: data })
|
|
|
},
|
|
|
// 提交上传比分
|
|
|
async onSubmit(e) {
|
|
@@ -108,8 +108,8 @@ Page({
|
|
|
this.initValidate();
|
|
|
// 计算高度
|
|
|
this.searchHeight();
|
|
|
- // // 监听用户是否登录
|
|
|
- // this.watchLogin();
|
|
|
+ // 监听用户是否登录
|
|
|
+ this.watchLogin();
|
|
|
},
|
|
|
// 监听用户是否登录
|
|
|
watchLogin: function () {
|
|
@@ -139,15 +139,8 @@ Page({
|
|
|
that.setData({ userInfo: user })
|
|
|
} else { wx.showToast({ title: `${err.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
// 查询正在比赛的赛事
|
|
|
- let ismatchList = [];
|
|
|
- // 红方
|
|
|
- arr = await app.$get(`/courtAdmin/api/schedule`, { red_id: team[0]._id });
|
|
|
- // arr = await app.$get(`/courtAdmin/api/schedule`, { red_id: team[0]._id });
|
|
|
- // if (arr.errcode == '0') ismatchList.push(...arr.data);
|
|
|
- // // 蓝方
|
|
|
- // arr = await app.$get(`/courtAdmin/api/schedule`, { blue_id: team[0]._id });
|
|
|
- // if (arr.errcode == '0') ismatchList.push(...arr.data);
|
|
|
- // that.setData({ ismatchList: ismatchList })
|
|
|
+ arr = await app.$get(`/courtAdmin/api/schedule/getByTeamCreater`, { user_id: res.data._id });
|
|
|
+ if (arr.errcode == '0') that.setData({ ismatchList: arr.data })
|
|
|
} else if (user.type == '2') {
|
|
|
arr = await app.$get(`/courtAdmin/api/team/userteams`, { user_id: user._id });
|
|
|
if (arr.errcode == '0') {
|