|
@@ -2,10 +2,6 @@ const app = getApp();
|
|
|
Page({
|
|
|
data: {
|
|
|
frameStyle: { useTop: true, name: '赛事信息', leftArrow: true, useBar: false },
|
|
|
- fileUrl: app.globalData.fileUrl,
|
|
|
- id: '',
|
|
|
- info: {},
|
|
|
- user: {},
|
|
|
// 选项卡
|
|
|
tabs: {
|
|
|
active: 'a',
|
|
@@ -17,35 +13,70 @@ Page({
|
|
|
{ title: '成绩册', active: 'e' },
|
|
|
],
|
|
|
},
|
|
|
- // 场地选项卡
|
|
|
- fieldtabs: {
|
|
|
- active: 0,
|
|
|
- menu: [],
|
|
|
+ // 用户信息
|
|
|
+ user: {},
|
|
|
+ // 赛事id
|
|
|
+ id: '',
|
|
|
+ // 赛事信息
|
|
|
+ info: {},
|
|
|
+ // 赛事选手
|
|
|
+ playerList: [],
|
|
|
+ // 第一层手风琴
|
|
|
+ playerIndex: null,
|
|
|
+ // 第二层手风琴
|
|
|
+ playerIndexs: null,
|
|
|
+ // 秩序册
|
|
|
+ cType: '0',
|
|
|
+ cList: [],
|
|
|
+ cSearchname: '',
|
|
|
+ raceteamList: [],
|
|
|
+ raceList: [],
|
|
|
+ // 赛况
|
|
|
+ dTabs: {
|
|
|
+ active: '0',
|
|
|
+ menu: []
|
|
|
},
|
|
|
- // 赛况列表
|
|
|
- matchList: [],
|
|
|
- //成绩册项目列表
|
|
|
- projectList: [],
|
|
|
- active: '',
|
|
|
- // 状态
|
|
|
+ dList: [],
|
|
|
+ // 成绩册
|
|
|
+ achieveList: [],
|
|
|
+ //赛事状态
|
|
|
statusList: [],
|
|
|
- // 赛事类别
|
|
|
+ //赛事类别
|
|
|
typeList: [],
|
|
|
- // 赛制列表
|
|
|
+ //赛制列表
|
|
|
formatList: [],
|
|
|
- // 性别
|
|
|
+ //性别列表
|
|
|
genderList: [],
|
|
|
- // 选手
|
|
|
- player: {},
|
|
|
- showIndex: 10000, //默认不显示
|
|
|
- showIndexs: 10000, //默认不显示
|
|
|
- // 秩序册
|
|
|
- cType: '0',
|
|
|
- cList: [],
|
|
|
- raceList: [],
|
|
|
- raceteamList: [],
|
|
|
- //查询条件
|
|
|
- searchInfo: {},
|
|
|
+
|
|
|
+ // // 场地选项卡
|
|
|
+ // fieldtabs: {
|
|
|
+ // active: 0,
|
|
|
+ // menu: [],
|
|
|
+ // },
|
|
|
+ // // 赛况列表
|
|
|
+ // matchList: [],
|
|
|
+ // //成绩册项目列表
|
|
|
+ // projectList: [],
|
|
|
+ // active: '',
|
|
|
+ // // 状态
|
|
|
+ // statusList: [],
|
|
|
+ // // 赛事类别
|
|
|
+ // typeList: [],
|
|
|
+ // // 赛制列表
|
|
|
+ // formatList: [],
|
|
|
+ // // 性别
|
|
|
+ // genderList: [],
|
|
|
+ // // 选手
|
|
|
+ // player: {},
|
|
|
+ // showIndex: 10000, //默认不显示
|
|
|
+ // showIndexs: 10000, //默认不显示
|
|
|
+ // // 秩序册
|
|
|
+ // cType: '0',
|
|
|
+ // cList: [],
|
|
|
+ // raceList: [],
|
|
|
+ // raceteamList: [],
|
|
|
+ // //查询条件
|
|
|
+ // searchInfo: {},
|
|
|
},
|
|
|
// 返回
|
|
|
back: function () { wx.navigateBack({ delta: 1 }) },
|
|
@@ -54,57 +85,94 @@ Page({
|
|
|
const that = this;
|
|
|
that.setData({ 'tabs.active': e.detail.active });
|
|
|
},
|
|
|
- // 场地选项卡
|
|
|
- fieldtabsChange: async function (e) {
|
|
|
+ // 第一层手风琴
|
|
|
+ onePayer: function (e) {
|
|
|
const that = this;
|
|
|
- let match = that.data.info;
|
|
|
- if (e.detail) var active = e.detail;
|
|
|
- if (e.detail == 0) var active = 0;
|
|
|
- that.setData({ 'fieldtabs.active': active });
|
|
|
- that.setData({ active: active });
|
|
|
- let address = that.data.fieldtabs.menu.find((i) => i.active == active);
|
|
|
- if (address && address.menu != 0) {
|
|
|
- let arr;
|
|
|
- if (address._id == '') arr = await app.$get(`/msgs`, { match_id: match._id }, 'race');
|
|
|
- else arr = await app.$get(`/msgs`, { match_id: match._id, address_id: address._id }, 'race');
|
|
|
- if (arr.errcode == '0') that.setData({ matchList: arr.data });
|
|
|
- else wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 });
|
|
|
- }
|
|
|
- },
|
|
|
- // 赛况详情
|
|
|
- toCommon: function (e) {
|
|
|
- wx.navigateTo({ url: `/pagesMatch/userAdmin/schedule/sinfo?id=${e.detail._id}` })
|
|
|
- },
|
|
|
- //比赛报名
|
|
|
- toSign: function (e) {
|
|
|
- const { item } = e.currentTarget.dataset;
|
|
|
- wx.navigateTo({ url: `/pagesMatch/match/sign?id=${item._id}` })
|
|
|
+ if (e.detail != that.data.playerIndex) that.setData({ playerIndex: e.detail })
|
|
|
+ else that.setData({ playerIndex: null })
|
|
|
},
|
|
|
- // 手风琴1
|
|
|
- panel: function (e) {
|
|
|
+ // 第二层手风琴
|
|
|
+ twoPayer: function (e) {
|
|
|
const that = this;
|
|
|
- if (e.detail != that.data.showIndex) that.setData({ showIndex: e.detail })
|
|
|
- else that.setData({ showIndex: 10000 })
|
|
|
+ if (e.detail != that.data.playerIndexs) that.setData({ playerIndexs: e.detail })
|
|
|
+ else that.setData({ playerIndexs: null })
|
|
|
},
|
|
|
- // 手风琴2
|
|
|
- panels: function (e) {
|
|
|
- const that = this;
|
|
|
- if (e.detail != that.data.showIndexs) that.setData({ showIndexs: e.detail })
|
|
|
- else that.setData({ showIndexs: 10000 })
|
|
|
- },
|
|
|
- // 秩序册
|
|
|
- orderChange: function (e) {
|
|
|
+ // 秩序册选择
|
|
|
+ cChange: function (e) {
|
|
|
const that = this;
|
|
|
const ctype = e.detail;
|
|
|
that.setData({ cType: ctype })
|
|
|
that.setData({ cList: that.data.cType == '0' ? that.data.raceList : that.data.raceteamList })
|
|
|
},
|
|
|
// 秩序册查询
|
|
|
- cSearch: async function (e) {
|
|
|
+ cinputSearch: function (e) {
|
|
|
const that = this;
|
|
|
- that.setData({ 'searchInfo.name': e.detail });
|
|
|
+ that.setData({ 'cSearchname': e.detail });
|
|
|
that.searchOrderBook();
|
|
|
},
|
|
|
+ // 赛况场地选择
|
|
|
+ dtabsChange: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let raceList = that.data.raceList;
|
|
|
+ let data = that.data.dTabs.menu[e.detail];
|
|
|
+ let list = []
|
|
|
+ if (data._id) list = raceList.filter(i => i.address_id == data._id);
|
|
|
+ else list = raceList;
|
|
|
+ that.setData({ dList: list })
|
|
|
+ that.setData({ 'dTabs.active': e.detail })
|
|
|
+
|
|
|
+ },
|
|
|
+ // // 场地选项卡
|
|
|
+ // fieldtabsChange: async function (e) {
|
|
|
+ // const that = this;
|
|
|
+ // let match = that.data.info;
|
|
|
+ // if (e.detail) var active = e.detail;
|
|
|
+ // if (e.detail == 0) var active = 0;
|
|
|
+ // that.setData({ 'fieldtabs.active': active });
|
|
|
+ // that.setData({ active: active });
|
|
|
+ // let address = that.data.fieldtabs.menu.find((i) => i.active == active);
|
|
|
+ // if (address && address.menu != 0) {
|
|
|
+ // let arr;
|
|
|
+ // if (address._id == '') arr = await app.$get(`/msgs`, { match_id: match._id }, 'race');
|
|
|
+ // else arr = await app.$get(`/msgs`, { match_id: match._id, address_id: address._id }, 'race');
|
|
|
+ // if (arr.errcode == '0') that.setData({ matchList: arr.data });
|
|
|
+ // else wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // // 赛况详情
|
|
|
+ // toCommon: function (e) {
|
|
|
+ // wx.navigateTo({ url: `/pagesMatch/userAdmin/schedule/sinfo?id=${e.detail._id}` })
|
|
|
+ // },
|
|
|
+ // //比赛报名
|
|
|
+ // toSign: function (e) {
|
|
|
+ // const { item } = e.currentTarget.dataset;
|
|
|
+ // wx.navigateTo({ url: `/pagesMatch/match/sign?id=${item._id}` })
|
|
|
+ // },
|
|
|
+ // // 手风琴1
|
|
|
+ // panel: function (e) {
|
|
|
+ // const that = this;
|
|
|
+ // if (e.detail != that.data.showIndex) that.setData({ showIndex: e.detail })
|
|
|
+ // else that.setData({ showIndex: 10000 })
|
|
|
+ // },
|
|
|
+ // // 手风琴2
|
|
|
+ // panels: function (e) {
|
|
|
+ // const that = this;
|
|
|
+ // if (e.detail != that.data.showIndexs) that.setData({ showIndexs: e.detail })
|
|
|
+ // else that.setData({ showIndexs: 10000 })
|
|
|
+ // },
|
|
|
+ // // 秩序册
|
|
|
+ // orderChange: function (e) {
|
|
|
+ // const that = this;
|
|
|
+ // const ctype = e.detail;
|
|
|
+ // that.setData({ cType: ctype })
|
|
|
+ // that.setData({ cList: that.data.cType == '0' ? that.data.raceList : that.data.raceteamList })
|
|
|
+ // },
|
|
|
+ // // 秩序册查询
|
|
|
+ // cSearch: async function (e) {
|
|
|
+ // const that = this;
|
|
|
+ // that.setData({ 'searchInfo.name': e.detail });
|
|
|
+ // that.searchOrderBook();
|
|
|
+ // },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
@@ -140,52 +208,52 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: async function () { },
|
|
|
-
|
|
|
// 监听用户是否登录
|
|
|
watchLogin: async function () {
|
|
|
const that = this;
|
|
|
const statusList = that.data.statusList;
|
|
|
+ const typeList = that.data.typeList;
|
|
|
+ const formatList = that.data.formatList;
|
|
|
wx.getStorage({
|
|
|
key: 'user',
|
|
|
success: async res => {
|
|
|
that.setData({ user: res.data })
|
|
|
let arr;
|
|
|
- // 比赛信息
|
|
|
+ // 赛事信息
|
|
|
arr = await app.$get(`/match/${that.data.id}`, {}, 'race');
|
|
|
if (arr.errcode == '0') {
|
|
|
+ let info = arr.data;
|
|
|
// 赛事状态
|
|
|
- let status = statusList.find(i => i.value == arr.data.status)
|
|
|
- if (status) arr.data.zhStatus = status.label;
|
|
|
+ let status = statusList.find(i => i.value == info.status)
|
|
|
+ if (status) info.zhStatus = status.label;
|
|
|
// 赛事类别
|
|
|
- let type = that.data.typeList.find(i => i.value == arr.data.type)
|
|
|
- if (type) arr.data.zhtype = type.label;
|
|
|
+ let type = typeList.find(i => i.value == info.type)
|
|
|
+ if (type) info.zhtype = type.label;
|
|
|
// 赛事赛制
|
|
|
- let format = that.data.formatList.find(i => i.value == arr.data.format)
|
|
|
- if (format) arr.data.zhFormat = format.label;
|
|
|
+ let format = formatList.find(i => i.value == info.format)
|
|
|
+ if (format) info.zhFormat = format.label;
|
|
|
let regular = arr.data.regular.replace(/\<img/gi, '<img style="width:100%;height:auto;margin: 5px 0"');
|
|
|
- if (regular) arr.data.zhRegular = regular;
|
|
|
- that.setData({ info: arr.data })
|
|
|
- // 选手
|
|
|
- let getAll = await app.$get(`/match/getAll/${arr.data._id}`, {}, 'race');
|
|
|
- if (getAll.errcode == '0') that.setData({ player: getAll.data })
|
|
|
- // 秩序册
|
|
|
- that.searchOrderBook();
|
|
|
- // 场地
|
|
|
- let address = await app.$get(`/matchAddress`, { is_use: '0', belong_id: arr.data.belong_id }, 'race');
|
|
|
- if (address.errcode == '0') {
|
|
|
- let groundList = []
|
|
|
- address.data.unshift({ _id: '', title: '全部场地', active: 0 });
|
|
|
- for (const [index, val] of address.data.entries()) {
|
|
|
- groundList.push({ _id: val._id, title: val.title || val.name, active: index })
|
|
|
- }
|
|
|
- that.setData({ 'fieldtabs.menu': groundList })
|
|
|
- }
|
|
|
- // 成绩册项目列表
|
|
|
- let project = await app.$get(`/matchProject`, { match_id: arr.data._id }, 'race');
|
|
|
- if (project.errcode == '0') {
|
|
|
- that.setData({ projectList: project.data })
|
|
|
+ if (regular) info.zhRegular = regular;
|
|
|
+ that.setData({ info })
|
|
|
+ } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 }); }
|
|
|
+ // 赛事选手
|
|
|
+ arr = await app.$get(`/match/getAll/${arr.data._id}`, {}, 'race');
|
|
|
+ if (arr.errcode == '0') that.setData({ playerList: arr.data })
|
|
|
+ // 秩序册
|
|
|
+ that.searchOrderBook();
|
|
|
+ // 场地
|
|
|
+ arr = await app.$get(`/matchAddress`, { is_use: '0', belong_id: that.data.info.belong_id }, 'race');
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ let addressList = []
|
|
|
+ arr.data.unshift({ _id: '', title: '全部场地', active: 0 });
|
|
|
+ for (const [index, val] of arr.data.entries()) {
|
|
|
+ addressList.push({ _id: val._id, title: val.title || val.name, active: index })
|
|
|
}
|
|
|
- } else { wx.showToast({ title: `${res.errmsg}`, icon: 'fail', duration: 2000 }); }
|
|
|
+ that.setData({ 'dTabs.menu': addressList })
|
|
|
+ }
|
|
|
+ // 成绩册列表
|
|
|
+ arr = await app.$get(`/matchProject`, { match_id: that.data.info._id }, 'race');
|
|
|
+ if (arr.errcode == '0') { that.setData({ achieveList: arr.data }) }
|
|
|
|
|
|
},
|
|
|
fail: async res => {
|
|
@@ -195,38 +263,35 @@ Page({
|
|
|
},
|
|
|
// 查询秩序册
|
|
|
searchOrderBook: async function (e) {
|
|
|
- wx.showLoading({ title: '加载中', mask: true })
|
|
|
const that = this;
|
|
|
+ let genderList = that.data.genderList;
|
|
|
let type = that.data.cType;
|
|
|
let match = that.data.info;
|
|
|
- let searchInfo = that.data.searchInfo;
|
|
|
- let info = { match_id: match._id, };
|
|
|
- if (type == '0') if (searchInfo && searchInfo.name) info.user_name = searchInfo.name;
|
|
|
- if (type == '1') if (searchInfo && searchInfo.name) info.project_name = searchInfo.name;
|
|
|
+ let cSearch = that.data.cSearchname;
|
|
|
+ let info = { match_id: match._id };
|
|
|
+ if (type == '0') { if (cSearch) info.user_name = cSearch; }
|
|
|
+ else { if (cSearch) info.project_name = cSearch; }
|
|
|
let arr;
|
|
|
//小组赛组--场次表
|
|
|
arr = await app.$get(`/matchTeamGroup`, { ...info }, 'race');
|
|
|
if (arr.errcode == '0') {
|
|
|
- for (const val of arr.data) {
|
|
|
- const project = await app.$get(`/matchProject`, { id: val.project_id, group_id: val.group_id, match_id: match._id }, 'race');
|
|
|
- if (project.errcode == '0' && project.total > 0) {
|
|
|
- // 年龄限制
|
|
|
- let age = project.data.find(i => i._id == val.project_id)
|
|
|
- if (age) val.age = age.age;
|
|
|
- // 性别限制
|
|
|
- let genders = project.data.find(i => i._id == val.project_id)
|
|
|
- if (genders) val.gender = genders.gender;
|
|
|
- let gender = that.data.genderList.find(i => i.value == genders.gender)
|
|
|
- if (gender) val.zhGender = gender.label;
|
|
|
- }
|
|
|
- for (const p1 of val.person) {
|
|
|
- p1.one = p1.name.split("-")[0];
|
|
|
- p1.two = p1.name.split("-")[1];
|
|
|
+ let list = arr.data;
|
|
|
+ for (const val of list) {
|
|
|
+ // 查询组
|
|
|
+ const group = await app.$get(`/matchGroup/${val.group_id}`, {}, 'race');
|
|
|
+ if (group.errcode == '0') { val.age = group.data.age; }
|
|
|
+ // 查询项目
|
|
|
+ const project = await app.$get(`/matchProject/${val.project_id}`, {}, 'race');
|
|
|
+ if (project.errcode == '0') {
|
|
|
+ val.projectAge = project.data.age;
|
|
|
+ let gender = genderList.find(i => i.value == project.data.gender)
|
|
|
+ if (gender) val.pojectGender = gender.label;
|
|
|
}
|
|
|
+ // 名字分割
|
|
|
+ for (const p1 of val.person) { p1.one = p1.name.split("-")[0]; p1.two = p1.name.split("-")[1]; }
|
|
|
}
|
|
|
- that.setData({ raceteamList: arr.data });
|
|
|
+ that.setData({ raceteamList: list })
|
|
|
}
|
|
|
- else wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 });
|
|
|
//小组赛赛程--对阵表
|
|
|
arr = await app.$get(`/msgs`, { ...info }, 'race');
|
|
|
if (arr.errcode == '0') {
|
|
@@ -236,12 +301,10 @@ Page({
|
|
|
val.two_one = val.player_two_name.split("-")[0];
|
|
|
val.two_two = val.player_two_name.split("-")[1];
|
|
|
}
|
|
|
- that.setData({ raceList: arr.data, matchList: arr.data });
|
|
|
+ that.setData({ raceList: arr.data });
|
|
|
+ that.setData({ dList: that.data.raceList })
|
|
|
}
|
|
|
- else wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 });
|
|
|
- // 合并信息
|
|
|
- that.setData({ cList: type == '0' ? that.data.raceList : that.data.raceteamList })
|
|
|
- wx.hideLoading();
|
|
|
+ that.setData({ cList: that.data.cType == '0' ? that.data.raceList : that.data.raceteamList })
|
|
|
},
|
|
|
|
|
|
/**
|