Sfoglia il codice sorgente

update:首页统计

ct 1 giorno fa
parent
commit
967c1c4724
1 ha cambiato i file con 19 aggiunte e 10 eliminazioni
  1. 19 10
      src/views/index.vue

+ 19 - 10
src/views/index.vue

@@ -111,7 +111,7 @@
         </el-col>
       </el-row>
 
-      <le-row :gutter="20">
+      <el-row :gutter="20">
         <el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
           <div class="operatetitle">
             经营数据
@@ -163,8 +163,10 @@
                   <count-to :start-val="0" :end-val="versionLimit" :duration="3600" class="card-panel-num" />
                 </span>
               </div>
-              <el-progress :percentage="todayWatchUserCount/versionLimit" :show-text="false"
-                           color="#409EFF"></el-progress>
+              <el-progress
+                :percentage="versionLimit ? Math.min(100, Math.round(todayWatchUserCount / versionLimit * 100)) : 0"
+                :show-text="false"
+              />
             </div>
             <div class="operatetitle-card">
               <div class="card-title">
@@ -227,7 +229,7 @@
             </div>
           </div>
         </el-col>
-      </le-row>
+      </el-row>
     </el-card>
     <!-- 分析概览 (Analysis Overview) -->
     <div class="analysis-section" shadow="never">
@@ -1042,14 +1044,21 @@ export default {
   watch: {
     queryTime(newVal, oldVal) {
       if (newVal === '自定义' && oldVal !== '自定义') {
-        this.$nextTick(() => {
-          const end = dayjs().format('YYYY-MM-DD');
-          const start = dayjs().subtract(6, 'day').format('YYYY-MM-DD');
-          this.customRange = [start, end];
-        });
+        const end = dayjs().format('YYYY-MM-DD');
+        const start = dayjs().subtract(6, 'day').format('YYYY-MM-DD');
+        this.customRange = [start, end];
+        return;
       }
+    },
 
-      this.handleAnalysis();
+    customRange(val) {
+      if (
+        this.queryTime === '自定义' &&
+        Array.isArray(val) &&
+        val.length === 2
+      ) {
+        this.safeHandleAnalysis();
+      }
     }
   },
   mounted() {