|
@@ -5,6 +5,11 @@ Page({
|
|
|
frameStyle: { useTop: true, name: '赛程设置', leftArrow: true, useBar: false },
|
|
|
// 赛事列表
|
|
|
matchList: [],
|
|
|
+ matchList1: [],
|
|
|
+ // 赛事组别
|
|
|
+ groupList: [],
|
|
|
+ // 组内项目
|
|
|
+ projectList: [],
|
|
|
match: {},
|
|
|
dialog: { title: '赛程上分', show: false, type: '1' },
|
|
|
form: {},
|
|
@@ -26,16 +31,53 @@ Page({
|
|
|
// 添加
|
|
|
toCommon: function (e) {
|
|
|
const that = this;
|
|
|
- const { item, route } = e.currentTarget.dataset;
|
|
|
- that.setData({ skip: 0, page: 0, list: [] });
|
|
|
- wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
|
|
|
+ that.setData({ dialog: { title: '添加淘汰赛', show: true, type: '1' } })
|
|
|
+ },
|
|
|
+ // 选择赛事
|
|
|
+ matchChange1: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.matchList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({
|
|
|
+ 'form.match_id': data._id, 'form.match_name': data.name,
|
|
|
+ 'form.group_id': '', 'form.group_name': '', 'form.project_id': '', 'form.project_name': ''
|
|
|
+ });
|
|
|
+ const group = await app.$get(`/matchGroup`, { match_id: data._id }, 'race');
|
|
|
+ if (group.errcode == '0') that.setData({ groupList: group.data });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 选择组别
|
|
|
+ groupChange: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.groupList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({ 'form.group_id': data._id, 'form.group_name': data.name });
|
|
|
+ const arr = await app.$get(`/matchProject`, { match_id: data.match_id, group_id: data._id }, 'race');
|
|
|
+ if (arr.errcode == '0') { that.setData({ projectList: arr.data }) }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 选择项目
|
|
|
+ projectChange: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.projectList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({ 'form.project_id': data._id, 'form.project_name': data.name });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toSubmit: function (e) {
|
|
|
+ const { group_id, match_id, project_id } = e.detail.value;
|
|
|
+ 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}` })
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 })
|
|
|
+ }
|
|
|
},
|
|
|
// 赛程上分
|
|
|
toScore: function (e) {
|
|
|
const that = this;
|
|
|
const { item } = e.currentTarget.dataset;
|
|
|
that.setData({ form: item })
|
|
|
- that.setData({ dialog: { title: '赛程上分', show: true, type: '1' } })
|
|
|
+ that.setData({ dialog: { title: '赛程上分', show: true, type: '2' } })
|
|
|
},
|
|
|
// 提交保存
|
|
|
onSubmit: async function (e) {
|
|
@@ -84,16 +126,17 @@ Page({
|
|
|
let data = that.data.matchList[e.detail.value];
|
|
|
if (data) {
|
|
|
that.setData({ 'match.id': data._id, 'match.name': data.name });
|
|
|
- that.setData({ skip: 0, page: 0, list: [] })
|
|
|
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(`/msgs`, { ...info }, 'race');
|
|
|
+ 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)
|
|
@@ -122,7 +165,7 @@ Page({
|
|
|
toClose: function () {
|
|
|
const that = this;
|
|
|
that.setData({ form: {} })
|
|
|
- that.setData({ dialog: { title: '赛程上分', show: false, type: '1' } })
|
|
|
+ that.setData({ dialog: { title: '赛程上分', show: false, type: '2' } })
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
@@ -157,9 +200,9 @@ Page({
|
|
|
key: 'raceuser',
|
|
|
success: async res => {
|
|
|
let arr;
|
|
|
- arr = await app.$get(`/match`, { belong_id: res.data._id }, 'race');
|
|
|
+ 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.data.match.id) that.search();
|
|
|
},
|
|
|
fail: async res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index' })
|