Sfoglia il codice sorgente

联调新排行榜

bayi 1 anno fa
parent
commit
2ad3b5078e
5 ha cambiato i file con 23 aggiunte e 20 eliminazioni
  1. 2 0
      api/global.js
  2. 1 4
      pages/activity/index.js
  3. 18 12
      pages/ranking/index.js
  4. 1 2
      pages/ranking/index.less
  5. 1 2
      pages/ranking/index.wxss

+ 2 - 0
api/global.js

@@ -14,6 +14,8 @@ module.exports = {
     getActivities: data => request('/v3/activity', 'get', data),
     // 获取排行榜详情
     getRankingData: data => request('/v3/activity/rank', 'get', data),
+    // 获取排行榜可选日期 
+    getRankedDay: data => request('/v3/rank/statistics/day', 'get', data),
     // 获取朗读赛详情
     getActivityInfo: data => request(`/v3/activity/info/${data}`, 'get', data),
     // 获取朗读赛范文

+ 1 - 4
pages/activity/index.js

@@ -57,12 +57,9 @@ Page({
     }) {
         let {
             type,
-            id,
-            title,
-            explain
         } = currentTarget.dataset.info
         wx.navigateTo({
-            url: `/pages/ranking/index?id=${id}&type=${type}`,
+            url: `/pages/ranking/index?type=${type}`,
         })
     },
     jumpUserInfo({

+ 18 - 12
pages/ranking/index.js

@@ -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({

+ 1 - 2
pages/ranking/index.less

@@ -203,7 +203,7 @@
     background: url('https://reader-wx.ai160.com/images/reader/v3/yx-bg.png')no-repeat;
 
     .tips2 {
-        color: #2DCE66;
+        color: #50AE75 !important;
     }
 }
 
@@ -225,5 +225,4 @@
 
 .iconPk {
     width: 42rpx !important;
-    color: #50AE75 !important;
 }

+ 1 - 2
pages/ranking/index.wxss

@@ -171,7 +171,7 @@
   background: url('https://reader-wx.ai160.com/images/reader/v3/yx-bg.png') no-repeat;
 }
 .invitation .tips2 {
-  color: #2DCE66;
+  color: #50AE75 !important;
 }
 .hot {
   background: url('https://reader-wx.ai160.com/images/reader/v3/rb-bg.png') no-repeat;
@@ -187,5 +187,4 @@
 }
 .iconPk {
   width: 42rpx !important;
-  color: #50AE75 !important;
 }