|
@@ -10,8 +10,11 @@ Page({
|
|
|
groupList: [],
|
|
|
// 组内项目
|
|
|
projectList: [],
|
|
|
+ // 比赛
|
|
|
match: {},
|
|
|
- dialog: { title: '赛程上分', show: false, type: '1' },
|
|
|
+ // 按钮
|
|
|
+ btn: '',
|
|
|
+ dialog: { title: '选择赛事', show: false, type: '1' },
|
|
|
form: {},
|
|
|
list: [],
|
|
|
total: 0,
|
|
@@ -29,9 +32,16 @@ Page({
|
|
|
// 返回
|
|
|
back: function () { wx.navigateBack({ delta: 1 }) },
|
|
|
// 添加
|
|
|
+ toAdd: function (e) {
|
|
|
+ const that = this;
|
|
|
+ that.setData({ btn: e.currentTarget.dataset.btn })
|
|
|
+ that.setData({ dialog: { title: '选择赛事', show: true, type: '1' } })
|
|
|
+ },
|
|
|
+ //添加信息,信息维护
|
|
|
toCommon: function (e) {
|
|
|
const that = this;
|
|
|
- that.setData({ dialog: { title: '添加淘汰赛', show: true, type: '1' } })
|
|
|
+ const { item, route } = e.currentTarget.dataset;
|
|
|
+ wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
|
|
|
},
|
|
|
// 选择赛事
|
|
|
matchChange1: async function (e) {
|
|
@@ -65,13 +75,33 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
toSubmit: function (e) {
|
|
|
+ const that = this
|
|
|
const { group_id, match_id, project_id } = e.detail.value;
|
|
|
+ that.setData({ 'match.match_id': match_id, 'match.group_id': group_id, 'match.project_id': project_id, })
|
|
|
if (match_id && group_id && project_id) {
|
|
|
- wx.navigateTo({ url: `/pagesMatch/matchAdmin/elimmatch/add?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}` })
|
|
|
+ if (that.data.btn == '2') {
|
|
|
+ wx.navigateTo({ url: `/pagesMatch/matchAdmin/elimmatch/add?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}` }); that.toClose();
|
|
|
+ } else that.search(e.detail.value); that.toClose();
|
|
|
} else {
|
|
|
wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 })
|
|
|
}
|
|
|
},
|
|
|
+ search: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let match = that.data.match;
|
|
|
+ let arr;
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit, match_id: match.match_id, group_id: match.group_id, project_id: match.project_id };
|
|
|
+ arr = await app.$get(`http://192.168.1.197:15001/newCourt/race/v2/api/eliminate`, { ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ let list = [...that.data.list, ...arr.data]
|
|
|
+ for (const val of list) {
|
|
|
+ let status = that.data.statusList.find(i => i.value == val.status)
|
|
|
+ if (status) val.zhStatus = status.label;
|
|
|
+ }
|
|
|
+ that.setData({ list })
|
|
|
+ that.setData({ total: arr.total })
|
|
|
+ } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
+ },
|
|
|
// 赛程上分
|
|
|
toScore: function (e) {
|
|
|
const that = this;
|
|
@@ -89,63 +119,16 @@ Page({
|
|
|
wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
return false
|
|
|
} else {
|
|
|
- let arr = await app.$post(`/msgs/${form.id}`, params, 'race');
|
|
|
+ let arr = await app.$post(`/eliminate/${form.id}`, params,'race');
|
|
|
if (arr.errcode == '0') {
|
|
|
wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
|
|
|
that.toClose();
|
|
|
that.setData({ skip: 0, page: 0, list: [] })
|
|
|
- that.watchLogin()
|
|
|
+ that.search()
|
|
|
}
|
|
|
else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
|
}
|
|
|
},
|
|
|
- // 删除
|
|
|
- toDel: function (e) {
|
|
|
- const that = this;
|
|
|
- const { item } = e.currentTarget.dataset;
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '是否确认删除该条数据?',
|
|
|
- async success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- const arr = await app.$delete(`/msgs/${item._id}`, {}, 'race');
|
|
|
- if (arr.errcode == '0') {
|
|
|
- wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
|
|
|
- that.setData({ skip: 0, page: 0, list: [] })
|
|
|
- that.watchLogin()
|
|
|
- } else {
|
|
|
- wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 选择赛事
|
|
|
- matchChange: function (e) {
|
|
|
- const that = this;
|
|
|
- let data = that.data.matchList[e.detail.value];
|
|
|
- if (data) {
|
|
|
- that.setData({ 'match.id': data._id, 'match.name': data.name });
|
|
|
- that.search(data);
|
|
|
- that.setData({ skip: 0, page: 0, list: [] })
|
|
|
- }
|
|
|
- },
|
|
|
- search: async function (e) {
|
|
|
- const that = this;
|
|
|
- let match = that.data.match;
|
|
|
- let info = { skip: that.data.skip, limit: that.data.limit, match_id: match.id };
|
|
|
- let arr = await app.$get(`/http://192.168.1.197:15001/newCourt/race/v2/api/eliminate`, { ...info });
|
|
|
- if (arr.errcode == '0') {
|
|
|
- // console.log(arr.data);
|
|
|
- let list = [...that.data.list, ...arr.data]
|
|
|
- for (const val of list) {
|
|
|
- let status = that.data.statusList.find(i => i.value == val.status)
|
|
|
- if (status) val.zhStatus = status.label;
|
|
|
- }
|
|
|
- that.setData({ list })
|
|
|
- that.setData({ total: arr.total })
|
|
|
- } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
- },
|
|
|
// 分页
|
|
|
toPage: function () {
|
|
|
const that = this;
|
|
@@ -202,7 +185,7 @@ Page({
|
|
|
let arr;
|
|
|
arr = await app.$get(`/match`, { belong_id: res.data._id }, 'race');
|
|
|
if (arr.errcode == '0') { that.setData({ matchList: arr.data }) }
|
|
|
- if (that.data.match && that.data.match.id) that.search();
|
|
|
+ // if (that.data.match) that.search();
|
|
|
},
|
|
|
fail: async res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index' })
|