panhui 3 vuotta sitten
vanhempi
commit
92fd43add7
1 muutettua tiedostoa jossa 30 lisäystä ja 12 poistoa
  1. 30 12
      src/views/user/Rank.vue

+ 30 - 12
src/views/user/Rank.vue

@@ -73,18 +73,7 @@ export default {
         };
     },
     mounted() {
-        this.$toast.loading({
-            message: '加载中...',
-            forbidClick: true
-        });
-        this.$http.get('/userHold/app/top').then(res => {
-            this.$toast.clear();
-            this.list = res
-                .filter(item => {
-                    return item.userId !== '1435297' && item.userId !== '4273750';
-                })
-                .slice(0, 20);
-        });
+        this.getOwners();
         // this.$http
         //     .get('sysConfig/get/fixed_top')
         //     .then(res => {
@@ -99,8 +88,37 @@ export default {
         //     });
     },
     methods: {
+        getOwners() {
+            this.$toast.loading({
+                message: '加载中...',
+                forbidClick: true
+            });
+            this.$http.get('/userHold/app/top').then(res => {
+                this.$toast.clear();
+                this.list = res
+                    .filter(item => {
+                        return item.userId !== '1435297' && item.userId !== '4273750';
+                    })
+                    .slice(0, 20);
+            });
+        },
+        getTop() {
+            this.$toast.loading({
+                message: '加载中...',
+                forbidClick: true
+            });
+            return this.$http.get('/user/topTen').then(res => {
+                this.$toast.clear();
+                this.list = res.slice(0, 20);
+            });
+        },
         changeRare(active) {
             this.active = active;
+            if (active == 0) {
+                this.getOwners();
+            } else if (active === 1) {
+                this.getTop();
+            }
         },
         getActive1() {
             this.$http.get('/userHold/app/top').then(res => {