const app = getApp() Page({ data: { id: "", info: {}, user: {}, statusList: [], list: [] }, // 报名 async toAdd() { const that = this; if (that.data.user._id) wx.navigateTo({ url: '/pagesMatch/enroll/index?match=' + that.data.info._id }); else wx.navigateTo({ url: '/pagesCommon/login/index' }) }, // 排名 toRank() { const that = this; wx.navigateTo({ url: '/pagesMy/ranking/index?id=' + that.data.info._id }) }, // 赛程信息 toCourse(e) { const that = this; wx.navigateTo({ url: '/pagesMy/course/index?id=' + that.data.info._id }) }, // 参赛团队 toTeam(e) { const that = this; wx.navigateTo({ url: '/pagesMatch/team/index?id=' + that.data.info._id }) }, // 字典 getDict(value, model) { const that = this; if (model == 'status') { if (value) { let data = that.data.statusList.find(i => i.value == value) if (data) return data.label else return '暂无' } } }, /** * 生命周期函数--监听页面加载 */ async onLoad(options) { const that = this; that.setData({ id: options.id }); }, /** * 生命周期函数--监听页面显示 */ async onShow() { const that = this; wx.showLoading({ title: '加载中', mask: true }) await that.searchUser() await that.searchOther() await that.search() wx.hideLoading() }, async searchUser() { const that = this; wx.getStorage({ key: 'user', async success(res) { that.setData({ user: res.data }) }, fail(err) { // console.log(err); } }) }, // 查询其他信息 async searchOther() { const that = this; let res; res = await app.$api('dictData', 'GET', { type: 'match_status', is_use: '0' }) if (res.errcode == '0') that.setData({ statusList: res.data }) }, // 查询通知 async search() { const that = this; let res = await app.$api(`match/${that.data.id}`, 'GET', {}) if (res.errcode == '0') { res.data.status_name = that.getDict(res.data.status, 'status') if (res.data.information) res.data.information = res.data.information.replace(/\