// pages/leader_board/index.js
import {
    getLeaderBoard
} from '../../api/api.js'

const app = getApp();

Page({
    data: {
        parameter: {
            'navbar': '1',
            'return': '1',
            'title': '排行榜',
            'color': false,
            'class': '0'
        },
        banner: "http://twongstatic.shotshock.shop/banner_bargin.jpg",
        name: "",
        board: []
    },

    onLoad: function (options) {},

    loadLeaderBoard: function () {
        var that = this
        getLeaderBoard().then(res => {
                if (res.data) {
                    that.setData({
                        banner: res.data.banner,
                        name: res.data.name,
                        board: res.data.board,
                    })
                    console.log(res.data)
                }
            },
            err => {
                console.log(err)
            })
    },

    onShow: function () {
        this.loadLeaderBoard()
    },
})