|
@@ -3,22 +3,24 @@ import WxValidate from '../../../utils/wxValidate';
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
frameStyle: { useTop: true, name: '小组赛管理', leftArrow: true, useBar: false },
|
|
frameStyle: { useTop: true, name: '小组赛管理', leftArrow: true, useBar: false },
|
|
- dialog: { title: '赛程上分', show: false, type: '1' },
|
|
|
|
- form: {},
|
|
|
|
- //查询
|
|
|
|
- searchInfo: {},
|
|
|
|
|
|
+ // 用户信息
|
|
|
|
+ raceuser: {},
|
|
// 赛事列表
|
|
// 赛事列表
|
|
matchList: [],
|
|
matchList: [],
|
|
// 组别列表
|
|
// 组别列表
|
|
groupList: [],
|
|
groupList: [],
|
|
// 组内项目列表
|
|
// 组内项目列表
|
|
projectList: [],
|
|
projectList: [],
|
|
|
|
+ statusList: [],
|
|
list: [],
|
|
list: [],
|
|
total: 0,
|
|
total: 0,
|
|
page: 0,
|
|
page: 0,
|
|
skip: 0,
|
|
skip: 0,
|
|
limit: 5,
|
|
limit: 5,
|
|
- statusList: []
|
|
|
|
|
|
+ dialog: { title: '赛程上分', show: false, type: '1' },
|
|
|
|
+ //查询
|
|
|
|
+ searchInfo: {},
|
|
|
|
+ form: {},
|
|
},
|
|
},
|
|
initValidate() {
|
|
initValidate() {
|
|
const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
|
|
const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
|
|
@@ -27,7 +29,7 @@ Page({
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
},
|
|
},
|
|
// 返回
|
|
// 返回
|
|
- back: function () { wx.navigateBack({ delta: 1 }) },
|
|
|
|
|
|
+ back: function () { wx.navigateBack({ delta: 1 }); wx.removeStorage({ key: 'searchInfo' }) },
|
|
// 详细信息
|
|
// 详细信息
|
|
toCommon: function (e) {
|
|
toCommon: function (e) {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -77,10 +79,38 @@ Page({
|
|
},
|
|
},
|
|
toSubmit: function (e) {
|
|
toSubmit: function (e) {
|
|
const that = this
|
|
const that = this
|
|
- const params = e.detail.value;
|
|
|
|
- if (params) { that.setData({ skip: 0, page: 0, list: [] }); that.toClose(); that.watchLogin(); }
|
|
|
|
|
|
+ let searchInfo = that.data.searchInfo;
|
|
|
|
+ if (searchInfo) {
|
|
|
|
+ that.setData({ skip: 0, page: 0, list: [] });
|
|
|
|
+ wx.setStorage({ key: "searchInfo", data: searchInfo })
|
|
|
|
+ that.toClose();
|
|
|
|
+ that.search();
|
|
|
|
+ }
|
|
else { wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 }) }
|
|
else { wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 }) }
|
|
},
|
|
},
|
|
|
|
+ search: async function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ let raceuser = that.data.raceuser;
|
|
|
|
+ let statusList = that.data.statusList;
|
|
|
|
+ wx.getStorage({
|
|
|
|
+ key: 'searchInfo',
|
|
|
|
+ success: async res => {
|
|
|
|
+ if (res.data.group_id && res.data.match_id && res.data.project_id) {
|
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit, referee_id: raceuser._id, group_id: res.data.group_id, match_id: res.data.match_id, project_id: res.data.project_id }
|
|
|
|
+ let arr = await app.$get(`/msgs`, { ...info }, 'race');
|
|
|
|
+ if (arr.errcode == '0') {
|
|
|
|
+ let list = [...that.data.list, ...arr.data]
|
|
|
|
+ for (const val of list) {
|
|
|
|
+ let status = 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 }) }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 提交保存
|
|
// 提交保存
|
|
onSubmit: async function (e) {
|
|
onSubmit: async function (e) {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -95,13 +125,13 @@ Page({
|
|
if (arr.errcode == '0') {
|
|
if (arr.errcode == '0') {
|
|
wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
|
|
wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
|
|
that.setData({ skip: 0, page: 0, list: [], form: {} })
|
|
that.setData({ skip: 0, page: 0, list: [], form: {} })
|
|
- that.watchLogin();
|
|
|
|
|
|
+ that.search();
|
|
that.toClose();
|
|
that.toClose();
|
|
}
|
|
}
|
|
else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 删除
|
|
|
|
|
|
+ // 交换场地
|
|
toChange: function (e) {
|
|
toChange: function (e) {
|
|
const that = this;
|
|
const that = this;
|
|
const { item } = e.currentTarget.dataset;
|
|
const { item } = e.currentTarget.dataset;
|
|
@@ -114,7 +144,7 @@ Page({
|
|
if (arr.errcode == '0') {
|
|
if (arr.errcode == '0') {
|
|
wx.showToast({ title: `交换场地成功`, icon: 'success', duration: 2000 });
|
|
wx.showToast({ title: `交换场地成功`, icon: 'success', duration: 2000 });
|
|
that.setData({ skip: 0, page: 0, list: [] })
|
|
that.setData({ skip: 0, page: 0, list: [] })
|
|
- that.watchLogin();
|
|
|
|
|
|
+ that.search();
|
|
}
|
|
}
|
|
else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
}
|
|
}
|
|
@@ -132,7 +162,7 @@ Page({
|
|
that.setData({ page: page })
|
|
that.setData({ page: page })
|
|
let skip = page * limit;
|
|
let skip = page * limit;
|
|
that.setData({ skip: skip })
|
|
that.setData({ skip: skip })
|
|
- that.watchLogin();
|
|
|
|
|
|
+ that.search();
|
|
wx.hideLoading()
|
|
wx.hideLoading()
|
|
} else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
|
|
} else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
|
|
},
|
|
},
|
|
@@ -170,25 +200,13 @@ Page({
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: async function () {
|
|
watchLogin: async function () {
|
|
const that = this;
|
|
const that = this;
|
|
- let searchInfo = that.data.searchInfo;
|
|
|
|
wx.getStorage({
|
|
wx.getStorage({
|
|
key: 'raceuser',
|
|
key: 'raceuser',
|
|
success: async res => {
|
|
success: async res => {
|
|
- let match = await app.$get(`/match`, {}, 'race');
|
|
|
|
|
|
+ that.setData({ raceuser: res.data })
|
|
|
|
+ let match = await app.$get(`/match`, { belong_id: res.data.parent_id }, 'race');
|
|
if (match.errcode == '0') { that.setData({ matchList: match.data }) }
|
|
if (match.errcode == '0') { that.setData({ matchList: match.data }) }
|
|
- if (searchInfo.group_id && searchInfo.match_id && searchInfo.project_id) {
|
|
|
|
- let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id, group_id: searchInfo.group_id, match_id: searchInfo.match_id, project_id: searchInfo.project_id }
|
|
|
|
- let arr = await app.$get(`/msgs`, { ...info }, 'race');
|
|
|
|
- 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 }) }
|
|
|
|
- }
|
|
|
|
|
|
+ that.search();
|
|
},
|
|
},
|
|
fail: async res => {
|
|
fail: async res => {
|
|
wx.redirectTo({ url: '/pages/index/index' })
|
|
wx.redirectTo({ url: '/pages/index/index' })
|