|
@@ -22,7 +22,11 @@ Page({
|
|
|
],
|
|
|
},
|
|
|
// 状态
|
|
|
- statusList: []
|
|
|
+ statusList: [],
|
|
|
+ // 赛事类别
|
|
|
+ typeList: [],
|
|
|
+ // 赛制列表
|
|
|
+ formatList: [],
|
|
|
},
|
|
|
// 返回
|
|
|
back: function () { wx.navigateBack({ delta: 1 }) },
|
|
@@ -38,18 +42,17 @@ Page({
|
|
|
},
|
|
|
// 手风琴1
|
|
|
panel: function (e) {
|
|
|
+ const that = this;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
- let showIndex = this.data.showIndex;
|
|
|
- if (index != showIndex) this.setData({ showIndex: index })
|
|
|
- else this.setData({ showIndex: 10000 })
|
|
|
+ if (index != that.data.showIndex) that.setData({ showIndex: index })
|
|
|
+ else that.setData({ showIndex: 10000 })
|
|
|
},
|
|
|
// 手风琴2
|
|
|
panels: function (e) {
|
|
|
+ const that = this;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
- let showIndexs = this.data.showIndexs;
|
|
|
- if (index != showIndexs) this.setData({ showIndexs: index })
|
|
|
- else this.setData({ showIndexs: 10000 })
|
|
|
-
|
|
|
+ if (index != that.data.showIndexs) that.setData({ showIndexs: index })
|
|
|
+ else that.setData({ showIndexs: 10000 })
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
@@ -65,9 +68,15 @@ Page({
|
|
|
searchOther: async function () {
|
|
|
const that = this;
|
|
|
let arr;
|
|
|
- // 状态
|
|
|
+ // 赛事状态
|
|
|
arr = await app.$get(`/dict`, { code: "match_status" });
|
|
|
- if (arr.errcode == '0' && arr.total > 0) { that.setData({ statusList: arr.data[0].list }); }
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
|
|
|
+ // 赛事类别
|
|
|
+ arr = await app.$get(`/dict`, { code: "match_type" });
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) that.setData({ typeList: arr.data[0].list });
|
|
|
+ // 赛制列表
|
|
|
+ arr = await app.$get(`/dict`, { code: "match_format" });
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) that.setData({ formatList: arr.data[0].list });
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
@@ -90,16 +99,22 @@ Page({
|
|
|
// 比赛信息
|
|
|
arr = await app.$get(`/match/${that.data.id}`, {}, 'race');
|
|
|
if (arr.errcode == '0') {
|
|
|
+ // 赛事状态
|
|
|
let status = statusList.find(i => i.value == arr.data.status)
|
|
|
if (status) arr.data.zhStatus = status.label;
|
|
|
+ // 赛事类别
|
|
|
+ let type = that.data.typeList.find(i => i.value == arr.data.type)
|
|
|
+ if (type) arr.data.zhtype = type.label;
|
|
|
+ // 赛事赛制
|
|
|
+ let format = that.data.formatList.find(i => i.value == arr.data.format)
|
|
|
+ if (format) arr.data.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 })
|
|
|
} else { wx.showToast({ title: `${res.errmsg}`, icon: 'fail', duration: 2000 }); }
|
|
|
+ // 选手
|
|
|
arr = await app.$get(`/match/getAll/${that.data.id}`, {}, 'race');
|
|
|
- if (arr.errcode == '0') {
|
|
|
- that.setData({ player: arr.data })
|
|
|
- }
|
|
|
+ if (arr.errcode == '0') that.setData({ player: arr.data })
|
|
|
},
|
|
|
fail: async res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index' })
|