|
@@ -1,58 +1,61 @@
|
|
|
import {
|
|
|
- getRankingData
|
|
|
+ getRankingData
|
|
|
} from '~/api/global'
|
|
|
Page({
|
|
|
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
- ranking: '',
|
|
|
- userList: [],
|
|
|
- //2:邀新榜,3:热播榜,4:挑战pk榜
|
|
|
- rankingType: '',
|
|
|
- icon: '',
|
|
|
- podiumBoxBg: ''
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ ranking: '',
|
|
|
+ userList: [],
|
|
|
+ //2:邀新榜,3:热播榜,4:挑战pk榜
|
|
|
+ rankingType: '',
|
|
|
+ icon: '',
|
|
|
+ podiumBoxBg: '',
|
|
|
+ explain: ''
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
- onLoad(options) {
|
|
|
- this.setData({
|
|
|
- rankingType: options.type,
|
|
|
- icon: options.type == '2' ? '/static/yx.png' : options.type == '3' ? '/static/play.png' : '/static/win.png',
|
|
|
- podiumBoxBg: options.type == '2' ? 'invitation' : options.type == '3' ? 'hot' : 'pk',
|
|
|
- })
|
|
|
- wx.setNavigationBarTitle({
|
|
|
- title: options.title
|
|
|
- })
|
|
|
- wx.setNavigationBarColor({
|
|
|
- frontColor: '#ffffff',
|
|
|
- backgroundColor: options.type == '2' ? '#ff7f6c' : options.type == '3' ? '#6D9FFE' : '#967DFF',
|
|
|
- })
|
|
|
- this.getRankingData()
|
|
|
- },
|
|
|
- async getRankingData() {
|
|
|
- let {
|
|
|
- ranking,
|
|
|
- userList
|
|
|
- } = await getRankingData(this.data.rankingType)
|
|
|
- this.setData({
|
|
|
- ranking,
|
|
|
- userList
|
|
|
- })
|
|
|
- },
|
|
|
- jumpIntro() {
|
|
|
- wx.navigateTo({
|
|
|
- url: `/pages/rankIntro/index?type=${this.data.rankingType}`,
|
|
|
- })
|
|
|
- },
|
|
|
- jumpUserInfo({
|
|
|
- currentTarget
|
|
|
- }) {
|
|
|
- wx.navigateTo({
|
|
|
- url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=${this.data.rankingType==4?'pk':'user'}`,
|
|
|
- })
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ rankingType: options.type,
|
|
|
+ icon: options.type == '2' ? '/static/yx.png' : options.type == '3' ? '/static/play.png' : '/static/win.png',
|
|
|
+ podiumBoxBg: options.type == '2' ? 'invitation' : options.type == '3' ? 'hot' : 'pk',
|
|
|
+ })
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
+ title: options.title
|
|
|
+ })
|
|
|
+ wx.setNavigationBarColor({
|
|
|
+ frontColor: '#ffffff',
|
|
|
+ backgroundColor: options.type == '2' ? '#ff7f6c' : options.type == '3' ? '#6D9FFE' : '#967DFF',
|
|
|
+ })
|
|
|
+ this.getRankingData()
|
|
|
+ },
|
|
|
+ async getRankingData() {
|
|
|
+ let {
|
|
|
+ ranking,
|
|
|
+ userList,
|
|
|
+ explain
|
|
|
+ } = await getRankingData(this.data.rankingType)
|
|
|
+ this.setData({
|
|
|
+ ranking,
|
|
|
+ userList,
|
|
|
+ explain
|
|
|
+ })
|
|
|
+ },
|
|
|
+ jumpIntro() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/pages/rankIntro/index?title=榜单说明&img=${this.data.explain}`,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ jumpUserInfo({
|
|
|
+ currentTarget
|
|
|
+ }) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=${this.data.rankingType==4?'pk':'user'}`,
|
|
|
+ })
|
|
|
+ },
|
|
|
})
|