|
@@ -0,0 +1,97 @@
|
|
|
+const app = getApp();
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ frameStyle: { useTop: true, name: '赛事信息', leftArrow: true, useBar: false },
|
|
|
+ options: {},
|
|
|
+ // 选项卡
|
|
|
+ tabs: {
|
|
|
+ active: 'a',
|
|
|
+ menu: [
|
|
|
+ { title: '小组赛', active: 'a' },
|
|
|
+ { title: '淘汰赛', active: 'b' },
|
|
|
+ { title: '名次', active: 'c' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ // 赛事信息
|
|
|
+ info: {},
|
|
|
+ // 名次
|
|
|
+ cList: [
|
|
|
+ { num: 1, name: '顾红伟' },
|
|
|
+ { num: 2, name: '顾红伟' },
|
|
|
+ { num: 3, name: '顾红伟' },
|
|
|
+ { num: 4, name: '顾红伟' },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ // 返回
|
|
|
+ back: function () { wx.navigateBack({ delta: 1 }) },
|
|
|
+ // 选项卡
|
|
|
+ tabsChange: function (e) {
|
|
|
+ const that = this;
|
|
|
+ that.setData({ 'tabs.active': e.detail.active });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad: async function (options) {
|
|
|
+ const that = this;
|
|
|
+ that.setData({ options: { match_id: options && options.match_id || '630ec4700a92b0a015ccfd14', group_id: options && options.group_id || '631060da75c1cd7fa923b8df', project_id: options && options.project_id || '631060f775c1cd7fa923b8ef' } });
|
|
|
+ // 监听用户是否登录
|
|
|
+ await that.watchLogin();
|
|
|
+ },
|
|
|
+ watchLogin: async function () {
|
|
|
+ const that = this;
|
|
|
+ const { match_id, group_id, project_id } = that.data.options
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'user',
|
|
|
+ success: async res => {
|
|
|
+ // 赛事信息
|
|
|
+ let arr = await app.$get(`/match/${match_id}`, {}, 'race');
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ that.setData({ info: arr.data });
|
|
|
+ that.setData({ 'frameStyle.name': arr.data.name })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: async res => {
|
|
|
+ wx.redirectTo({ url: '/pages/index/index' })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady: function () { },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow: function () { },
|
|
|
+ /**
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面隐藏
|
|
|
+ */
|
|
|
+ onHide: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面卸载
|
|
|
+ */
|
|
|
+ onUnload: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
+ */
|
|
|
+ onPullDownRefresh: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户点击右上角分享
|
|
|
+ */
|
|
|
+ onShareAppMessage: function () {
|
|
|
+
|
|
|
+ }
|
|
|
+})
|