liyongli 3 年之前
父节点
当前提交
346073116f
共有 1 个文件被更改,包括 46 次插入40 次删除
  1. 46 40
      src/views/Activity/views/defaultComponent.vue

+ 46 - 40
src/views/Activity/views/defaultComponent.vue

@@ -188,6 +188,8 @@ import {
 } from "echarts/components";
 import { LabelLayout, UniversalTransition } from "echarts/features";
 import { CanvasRenderer } from "echarts/renderers";
+const ElLoading = require("element-plus/lib/el-loading/index");
+import "element-plus/lib/theme-chalk/el-loading.css";
 echarts.use([
   GridComponent,
   LineChart,
@@ -216,6 +218,7 @@ export default {
       chart1: undefined,
       chart2: undefined,
       chart3: undefined,
+      load: undefined,
       T: [],
       select: "",
       shujuTotal: {
@@ -236,16 +239,12 @@ export default {
       oYear = oD.getFullYear(),
       oMonth = oD.getMonth() + 1,
       oDay = oD.getDate();
-    Month > 9 ? "" : Month = '0' + Month;
-    Day > 9 ? "" : Day = '0' + Day;
-    oMonth > 9 ? "" : oMonth = '0' + oMonth;
-    oDay > 9 ? "" : oDay = '0' + oDay;
-    this.T = [
-      [oYear, oMonth, oDay].join("-"),
-      [Year, Month, Day].join("-"),
-    ];
-    console.log(this.T);
-
+    Month > 9 ? "" : (Month = "0" + Month);
+    Day > 9 ? "" : (Day = "0" + Day);
+    oMonth > 9 ? "" : (oMonth = "0" + oMonth);
+    oDay > 9 ? "" : (oDay = "0" + oDay);
+    this.T = [[oYear, oMonth, oDay].join("-"), [Year, Month, Day].join("-")];
+    this.load = ElLoading.default.service();
     Promise.all([
       guijiTopic({
         activityId: this.item.activityId,
@@ -264,28 +263,31 @@ export default {
         topic: this.item.realName,
       }),
       guijiBumenList(),
-    ]).then(li => {
-      this.huati = li[0] || [];
-      this.shujuTotal = li[1][0] || {};
-      let shuju = {};
-      for (let i = 1; i < (li[1] || []).length; i++) {
-        const v = (li[1] || [])[i] || {};
-        if (!shuju[v.platform]) {
-          shuju[v.platform] = v.playCount || 0;
-        } else {
-          shuju[v.platform] += v.playCount || 0;
+    ])
+      .then(li => {
+        this.load.close();
+        this.huati = li[0] || [];
+        this.shujuTotal = li[1][0] || {};
+        let shuju = {};
+        for (let i = 1; i < (li[1] || []).length; i++) {
+          const v = (li[1] || [])[i] || {};
+          if (!shuju[v.platform]) {
+            shuju[v.platform] = v.playCount || 0;
+          } else {
+            shuju[v.platform] += v.playCount || 0;
+          }
         }
-      }
-      this.shuju = shuju;
-      this.hotList = li[4] || [];
-      this.selectOption = li[5] || [];
-      this.selectOption = [{ depName: "全部", id: 0 }, ...this.selectOption];
-      this.select = this.selectOption[0].depName;
-      this.trendChart(li[2] || []);
-      this.platformChar(shuju || {});
-      this.departmentChar(li[3] || []);
-      this.getRult();
-    });
+        this.shuju = shuju;
+        this.hotList = li[4] || [];
+        this.selectOption = li[5] || [];
+        this.selectOption = [{ depName: "全部", id: 0 }, ...this.selectOption];
+        this.select = this.selectOption[0].depName;
+        this.trendChart(li[2] || []);
+        this.platformChar(shuju || {});
+        this.departmentChar(li[3] || []);
+        this.getRult();
+      })
+      .catch(() => this.load.close());
   },
   computed: {},
   methods: {
@@ -482,14 +484,18 @@ export default {
         startTime: this.T[0],
         title: this.item.realName,
       };
-      this.T[0] && (p.startTime = this.T[0] + ' 00:00:00');
-      this.T[1] && (p.endTime = this.T[1] + ' 23:59:59');
+      this.T[0] && (p.startTime = this.T[0] + " 00:00:00");
+      this.T[1] && (p.endTime = this.T[1] + " 23:59:59");
       this.select && this.select !== "全部" && (p.depName = this.select);
-      guijiFagao(p).then(res => {
-        const { total, data } = res;
-        this.userlist = data || [];
-        this.total = total;
-      });
+      this.load = ElLoading.default.service();
+      guijiFagao(p)
+        .then(res => {
+          const { total, data } = res;
+          this.userlist = data || [];
+          this.total = total;
+          this.load.close();
+        })
+        .catch(() => this.load.close());
     },
     changeselect() {
       this.getRult();
@@ -562,7 +568,7 @@ export default {
   color: #3b3b3b;
 }
 .defaultComponent .el-pagination .btn-prev .el-icon,
-.defaultComponent .el-pagination .btn-next .el-icon{
-    width: 100%
+.defaultComponent .el-pagination .btn-next .el-icon {
+  width: 100%;
 }
 </style>