yuanyuan 3 năm trước cách đây
mục cha
commit
a7a01b12e0
1 tập tin đã thay đổi với 41 bổ sung13 xóa
  1. 41 13
      src/views/user/Ranking.vue

+ 41 - 13
src/views/user/Ranking.vue

@@ -162,19 +162,47 @@ export default {
         };
     },
     mounted() {
-        this.$http
-            .post('/domainOrder/topTen')
-            .then(res => {
-                this.loading = false;
-                this.domainList = res;
-                this.newList = res.slice(3, 60);
-                this.newList.forEach(item => {
-                    if (item.userName.length > 6) {
-                        item.userName = item.userName.slice(0, 6) + '...';
-                    }
-                });
-            })
-            .catch(e => {});
+        this.totalPositions();
+    },
+    methods: {
+        changeRanking(ranking) {
+            this.ranking = ranking;
+            if (ranking == 'TOTAL') {
+                this.totalPositions();
+            } else {
+                this.purchaseRanking();
+            }
+        },
+        totalPositions() {
+            this.$http
+                .post('/domainOrder/topTen')
+                .then(res => {
+                    this.loading = false;
+                    this.domainList = res;
+                    this.newList = res.slice(3, 20);
+                    this.newList.forEach(item => {
+                        if (item.userName.length > 6) {
+                            item.userName = item.userName.slice(0, 6) + '...';
+                        }
+                    });
+                })
+                .catch(e => {});
+        },
+        purchaseRanking() {
+            this.$http
+                .post('/domainOrder/domainTop')
+                .then(res => {
+                    this.loading = false;
+                    this.domainList = res;
+                    this.newList = res.slice(3, 20);
+                    this.newList.forEach(item => {
+                        if (item.userName.length > 6) {
+                            item.userName = item.userName.slice(0, 6) + '...';
+                        }
+                    });
+                })
+                .catch(e => {});
+        }
     }
 };
 </script>