const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        frameStyle: { useTop: true, name: '赛事信息', leftArrow: true, useBar: false },
        tabs: {
            active: 'c',
            list: [
                { title: '小组赛', name: 'a' },
                { title: '淘汰赛', name: 'b' },
                { title: '名次', name: 'c' },
                { title: '个人积分', name: 'd' },
                { title: '团体积分', name: 'e' },
            ],
        },
        options: {},
        info: {},
        // 个人积分
        ownintegralList: [
            {
                person: [{ name: '李四' }, { name: '张三' }, { name: '刘二' }],
                integral: '48',
                rank: '1'
            },
            {
                person: [{ name: '李四' }, { name: '张三' }, { name: '刘二' }],
                integral: '28',
                rank: '2'
            }
        ],
        // 团体积分
        teamintegralList: [
            {
                address: '龙伟羽校',
                integral: '488',
                rank: '1'
            },
            {
                address: '龙伟羽校',
                integral: '200',
                rank: '2'
            }
        ],
        list: [
            { name: '张三' },
            { name: '李四' },
            { name: '王二麻子' },
            { name: '孙二' },
            { name: '赵五' },
        ]
    },
    // 跳转菜单
    back(e) {
        wx.navigateBack({ delta: 1 })
    },
    // 选项卡
    tabsChange: function (e) {
        const that = this;
        const { name } = e.detail;
        that.setData({ 'tabs.active': name });
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        const that = this;
        that.setData({ options: { match_id: options.match_id || '62e388d4fd61d871861b80af', grouping_id: options.grouping_id || '62e601db2dc7343e137fff76', project_id: options.project_id || '62e5ffba2dc7343e137ffee9' } })
        that.search()
    },
    search: async function () {
        const that = this;
        const options = that.data.options;
        let arr;
        arr = await app.$get(`/newCourt/api/match/${options.match_id}`);
        if (arr.errcode == '') { that.setData({ info: arr.data }) }
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})