|
@@ -6,6 +6,9 @@ Page({
|
|
|
id: '',
|
|
|
info: {},
|
|
|
user: {},
|
|
|
+ // 选手
|
|
|
+ player: {},
|
|
|
+ showIndex: 10000, //默认不显示
|
|
|
// 选项卡
|
|
|
tabs: {
|
|
|
active: 'a',
|
|
@@ -32,22 +35,23 @@ Page({
|
|
|
const { item } = e.currentTarget.dataset;
|
|
|
wx.navigateTo({ url: `/pagesMatch/match/sign?id=${item._id}` })
|
|
|
},
|
|
|
+ panel: function (e) {
|
|
|
+ //获取到当前点击元素的下标
|
|
|
+ let index = e.currentTarget.dataset.index;
|
|
|
+ //当前显示隐藏内容的元素
|
|
|
+ let showIndex = this.data.showIndex;
|
|
|
+ if (index != showIndex) {
|
|
|
+ this.setData({ showIndex: index })
|
|
|
+ } else {
|
|
|
+ this.setData({ showIndex: 10000 })
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- onLoad: function (options) {
|
|
|
+ onLoad: async function (options) {
|
|
|
const that = this;
|
|
|
that.setData({ id: options.id || '' });
|
|
|
- },
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady: function () { },
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow: async function () {
|
|
|
- const that = this;
|
|
|
// 查询其他信息
|
|
|
await that.searchOther();
|
|
|
// 监听用户是否登录
|
|
@@ -60,12 +64,21 @@ Page({
|
|
|
arr = await app.$get(`/dict`, { code: "match_status" });
|
|
|
if (arr.errcode == '0' && arr.total > 0) { that.setData({ statusList: arr.data[0].list }); }
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady: function () { },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow: async function () { },
|
|
|
+
|
|
|
// 监听用户是否登录
|
|
|
watchLogin: async function () {
|
|
|
const that = this;
|
|
|
const statusList = that.data.statusList;
|
|
|
wx.getStorage({
|
|
|
- key: 'raceuser',
|
|
|
+ key: 'user',
|
|
|
success: async res => {
|
|
|
that.setData({ user: res.data })
|
|
|
let arr;
|
|
@@ -78,9 +91,13 @@ Page({
|
|
|
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 })
|
|
|
+ }
|
|
|
},
|
|
|
fail: async res => {
|
|
|
- wx.redirectTo({ url: '/pages/index/index' })
|
|
|
+ // wx.redirectTo({ url: '/pages/index/index' })
|
|
|
}
|
|
|
})
|
|
|
},
|