|
@@ -43,7 +43,7 @@ Page({
|
|
|
const that = this;
|
|
|
const { item } = e.currentTarget.dataset;
|
|
|
if (item._id) {
|
|
|
- that.setData({ 'form.id': item._id })
|
|
|
+ that.setData({ form: item })
|
|
|
that.setData({ dialog: { title: '添加信息', show: true, type: '1' } })
|
|
|
}
|
|
|
},
|
|
@@ -71,10 +71,12 @@ Page({
|
|
|
//提交查询
|
|
|
onSubmit: async function (e) {
|
|
|
const that = this;
|
|
|
- const form = that.data.form;
|
|
|
+ let form = that.data.form;
|
|
|
+ let player = that.data.schList.find(i => i.id == form.id)
|
|
|
+ form = { ...form, player_one: player.player_one, player_two: player.player_two }
|
|
|
let arr;
|
|
|
if (form.id) { arr = await app.$post(`http://192.168.1.197:15001/newCourt/race/v2/api/eliminate/${form.id}`, form, 'race'); }
|
|
|
- if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.toClose(); that.search();}
|
|
|
+ if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.toClose(); that.search(); }
|
|
|
else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
|
},
|
|
|
// 关闭弹框
|
|
@@ -88,38 +90,56 @@ Page({
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
this.search();
|
|
|
+ this.searchUser();
|
|
|
},
|
|
|
/**
|
|
|
* 查询函数
|
|
|
*/
|
|
|
async search() {
|
|
|
+ const that = this;
|
|
|
const match_id = '630ec4700a92b0a015ccfd14';
|
|
|
const group_id = "6318277947be96470e849b6a";
|
|
|
- const project_id = '631827f047be96470e849bc1'
|
|
|
+ const project_id = '631827f047be96470e849bc1';
|
|
|
+ let arr;
|
|
|
wx.request({
|
|
|
url: `http://192.168.1.197:15001/newCourt/race/v2/api/eliminate/graphData?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}`,
|
|
|
success: (res) => {
|
|
|
let data = res?.data?.data
|
|
|
- const { winData, loseData } = this.groupData(data);
|
|
|
- const schList = this.schData(data)
|
|
|
- this.setData({ winData, loseData, schList })
|
|
|
+ const { winData, loseData } = that.groupData(data);
|
|
|
+ const schList = that.schData(data)
|
|
|
+ that.setData({ winData, loseData, schList })
|
|
|
}
|
|
|
})
|
|
|
wx.request({
|
|
|
url: `http://192.168.1.197:15001/newCourt/race/v2/api/eliminate/playerList?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}`,
|
|
|
success: (res) => {
|
|
|
const playerList = res?.data?.data
|
|
|
- this.setData({ playerList })
|
|
|
+ that.setData({ playerList })
|
|
|
}
|
|
|
})
|
|
|
- wx.request({
|
|
|
- url: `http://192.168.1.197:15001/newCourt/race/v2/api/eliminate?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}`,
|
|
|
- success: (res) => {
|
|
|
- const schList = res?.data?.data
|
|
|
- this.setData({ schList })
|
|
|
+ that.searchUser();
|
|
|
+ },
|
|
|
+ // 查询赛事赛程
|
|
|
+ searchUser: async function () {
|
|
|
+ const that = this;
|
|
|
+ const match_id = '630ec4700a92b0a015ccfd14';
|
|
|
+ const group_id = "6318277947be96470e849b6a";
|
|
|
+ const project_id = '631827f047be96470e849bc1';
|
|
|
+ let arr;
|
|
|
+ arr = await app.$get(`http://192.168.1.197:15001/newCourt/race/v2/api/eliminate`, { match_id: match_id, group_id: group_id, project_id: project_id }, 'race');
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ for (const val of arr.data) {
|
|
|
+ if (val.player_one) {
|
|
|
+ let one = that.data.playerList.find(i => i._id == val.player_one)
|
|
|
+ if (one) val.player_one_name = one.name;
|
|
|
+ }
|
|
|
+ if (val.player_two) {
|
|
|
+ let two = that.data.playerList.find(i => i._id == val.player_two)
|
|
|
+ if (two) val.player_two_name = two.name;
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ that.setData({ schList: arr.data });
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 选中选手的处理
|
|
@@ -261,7 +281,8 @@ Page({
|
|
|
key: 'raceuser',
|
|
|
success: async res => {
|
|
|
// 场地
|
|
|
- let arr = await app.$get(`/matchAddress`, { belong_id: res.data._id, is_use: '0' }, 'race');
|
|
|
+ let arr;
|
|
|
+ arr = await app.$get(`/matchAddress`, { belong_id: res.data._id, is_use: '0' }, 'race');
|
|
|
if (arr.errcode == '0') { that.setData({ addressList: arr.data }) }
|
|
|
// 裁判
|
|
|
const aee = await app.$get(`/user`, { parent_id: res.data._id, type: '2' }, 'race')
|
|
@@ -269,7 +290,6 @@ Page({
|
|
|
for (const val of aee.data) { val.name = val.user_id.name }
|
|
|
that.setData({ refereeList: aee.data })
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
fail: async res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index' })
|