fanghuisheng преди 4 години
родител
ревизия
38d4be838f
променени са 2 файла, в които са добавени 19 реда и са изтрити 17 реда
  1. 18 16
      src/views/home/components/lineChart.vue
  2. 1 1
      src/views/home/index.vue

+ 18 - 16
src/views/home/components/lineChart.vue

@@ -33,27 +33,29 @@ export default {
   methods: {
     //次数分布折线图
     initChart() {
+      var _this = this;
       var chart = echarts.init(this.$refs.lineChart);
       var option;
 
       var timeLine = new Array();
-       timeLine = this.ftrendIcoCount[0].listDate;
+      timeLine = this.ftrendIcoCount[0].listDate;
+      var time = this.$store.state.Time_Data;
+      this.$store.commit("getAll", [
+        time[0].split(" ")[0],
+        time[1].split(" ")[0],
+      ]); //将time变量中的开始时间和结束时间传给getAll方法
+      var timeall = this.$store.state.timearr; //将getAll已便利好的时间区间数组存入变量timeall
 
-
-      // var arr = new Array();
-      // for (var i = 0; i < 32; i++) {
-      //   timeLine.push(i);
-      // }
-
-      // if (this.ftrendIcoCount[0].listDate.length) {
-      //   console.log("有数据");
-      //   timeLine = this.ftrendIcoCount[0].listDate;
-      // } else {
-      //   console.log("无数据");
-      //   for (var i = 0; i < 32; i++) {
-      //     timeLine.push(i);
-      //   }
-      // }
+      if (this.ftrendIcoCount[0].listDate.length) {
+        timeLine = this.ftrendIcoCount[0].listDate;
+      } else {
+        timeLine = [parseInt(timeall[0].split("-")[2])];
+        timeLine.map(() => {
+          _this.ftrendIcoCount[0].list.push(0);
+          _this.ftrendIcoCount[1].list.push(0);
+          return;
+        });
+      }
 
       option = {
         color: ["#00F4FD", "#FD8F00"],

+ 1 - 1
src/views/home/index.vue

@@ -238,7 +238,7 @@ export default {
       var _this = this;
       _this.$store.commit("TimeAll_function", this.fDefaultTime);
       var time = _this.$store.state.Time_Data;
-
+      
       api
         .trendIco_api({
           startTime: time[0],