|
@@ -1,5 +1,6 @@
|
|
|
import {
|
|
|
- getRankingData
|
|
|
+ getRankingData,
|
|
|
+ getRankedDay
|
|
|
} from '~/api/global'
|
|
|
import event from '~/mixins/event'
|
|
|
Page({
|
|
@@ -8,20 +9,25 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- ranking: '',
|
|
|
userList: [],
|
|
|
//2:邀新榜,3:热播榜,4:挑战pk榜
|
|
|
rankingType: '',
|
|
|
icon: '',
|
|
|
podiumBoxBg: '',
|
|
|
- explain: ''
|
|
|
+ historyList: []
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- onLoad(options) {
|
|
|
- this.getRankInfo(options)
|
|
|
+ async onLoad(options) {
|
|
|
+ let historyList = await getRankedDay()
|
|
|
+ console.log(historyList);
|
|
|
+ this.setData({
|
|
|
+ historyList
|
|
|
+ },()=>{
|
|
|
+ this.getRankInfo(options)
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
async getRankInfo(options) {
|
|
|
this.setData({
|
|
@@ -33,21 +39,21 @@ Page({
|
|
|
frontColor: '#ffffff',
|
|
|
backgroundColor: options.type == '2' ? '#50AE75' : options.type == '3' ? '#FF7E6C' : '#8468FA',
|
|
|
})
|
|
|
+ console.log(this.data.historyList);
|
|
|
let {
|
|
|
- ranking,
|
|
|
userList,
|
|
|
- explain
|
|
|
- } = await getRankingData(options.id)
|
|
|
+ } = await getRankingData({
|
|
|
+ type: options.type,
|
|
|
+ day: this.data.historyList[this.data.historyList.length - 1]
|
|
|
+ })
|
|
|
+
|
|
|
this.setData({
|
|
|
- ranking,
|
|
|
userList,
|
|
|
- explain
|
|
|
})
|
|
|
},
|
|
|
switchType({
|
|
|
target
|
|
|
}) {
|
|
|
- console.log(target.dataset);
|
|
|
let rankingType = target.dataset.type
|
|
|
if (rankingType && rankingType != this.data.rankingType) {
|
|
|
this.getRankInfo({
|