|
@@ -1,4 +1,5 @@
|
|
|
const app = getApp()
|
|
|
+import { race_status } from '../../utils/dict';
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -6,6 +7,7 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
|
|
|
+ list: [],
|
|
|
dialog: { title: '赛程信息', show: false, type: '1' },
|
|
|
form: {},
|
|
|
// 赛事信息
|
|
@@ -14,11 +16,56 @@ Page({
|
|
|
groupingList: [],
|
|
|
//组内项目
|
|
|
projectList: [],
|
|
|
+ statusList: race_status,
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
back(e) {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1,
|
|
|
+ wx.navigateBack({ delta: 1 })
|
|
|
+ },
|
|
|
+ // 赛事管理
|
|
|
+ toScore: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
+ const arr = await app.$get(`/newCourt/api/eliminateRace/${item._id}`);
|
|
|
+ if (arr.errcode == '0') { that.setData({ form: arr.data }) }
|
|
|
+ that.setData({ dialog: { title: '赛事管理', show: true, type: '2' } });
|
|
|
+ },
|
|
|
+ // 选择比赛状态
|
|
|
+ statusChange: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.statusList[e.detail.value];
|
|
|
+ if (data) { that.setData({ 'form.status': data.value }) }
|
|
|
+ },
|
|
|
+ // 提交保存
|
|
|
+ scoreSubmit: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ const params = e.detail.value;
|
|
|
+ const arr = await app.$post(`/newCourt/api/eliminateRace/${params._id}`, params);
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ wx.showToast({ title: `上分成功`, icon: 'error', duration: 2000 })
|
|
|
+ that.toClose()
|
|
|
+ } 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(`/newCourt/api/eliminateRace/${item._id}`);
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
|
|
|
+ that.watchLogin()
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
// 添加
|
|
@@ -30,7 +77,7 @@ Page({
|
|
|
toClose: function () {
|
|
|
const that = this;
|
|
|
that.setData({ form: {} })
|
|
|
- that.setData({ dialog: { title: '赛程信息', show: true, type: '1' } })
|
|
|
+ that.setData({ dialog: { title: '赛程信息', show: false, type: '1' } })
|
|
|
|
|
|
},
|
|
|
// 选择赛事
|
|
@@ -85,10 +132,7 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- onLoad: function (options) {
|
|
|
- const that = this;
|
|
|
-
|
|
|
- },
|
|
|
+ onLoad: function (options) { },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
@@ -111,9 +155,11 @@ Page({
|
|
|
success: async res => {
|
|
|
let arr;
|
|
|
// 比赛信息
|
|
|
- arr = await app.$get(`/newCourt/api/match`, { status: '0' });//2
|
|
|
- if (arr.errcode == '0') { that.setData({ matchList: arr.data }) }
|
|
|
-
|
|
|
+ arr = await app.$get(`/newCourt/api/match`, { status: '0' });
|
|
|
+ if (arr.errcode == '0') { that.setData({ matchList: arr.data }) };
|
|
|
+ // 淘汰赛信息
|
|
|
+ arr = await app.$get(`/newCourt/api/eliminateRace`);
|
|
|
+ if (arr.errcode == '0') { that.setData({ list: arr.data }) };
|
|
|
},
|
|
|
fail: res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index', })
|