liyongli 3 năm trước cách đây
mục cha
commit
1c14b0d85a
3 tập tin đã thay đổi với 22 bổ sung3 xóa
  1. 20 2
      src/components/maincomponents.vue
  2. 1 0
      src/view/login.vue
  3. 1 1
      src/view/main.vue

+ 20 - 2
src/components/maincomponents.vue

@@ -42,6 +42,7 @@
             id="piechart"
             style="width: 100%; height: 100%"
             class=""
+            :height="height + 'px'"
           ></canvas>
         </div>
       </el-col>
@@ -122,7 +123,7 @@
         >
         </el-date-picker>
       </div>
-      <div style="padding: 10px">
+      <div style="padding: 20px">
         <el-table v-loading="loading" :data="userlist" style="width: 100%">
           <el-table-column prop="depName" label="部门"> </el-table-column>
           <el-table-column prop="name" label="账号"> </el-table-column>
@@ -174,6 +175,7 @@ export default {
       options: [],
       pageSize: 10,
       usertotal: 0,
+      height: 0,
       c: ["#FB6161", "#EC72DC", "#F98E53", "#49BED0", "#4BCA8B"],
     };
   },
@@ -194,6 +196,13 @@ export default {
     },
   },
   mounted() {
+    this.height = (this.$refs.main.offsetWidth / 24) * 6.9;
+    linechart && linechart.destroy();
+    barchart && barchart.destroy();
+    piechart && piechart.destroy();
+    linechart = null;
+    barchart = null;
+    piechart = null;
     platformData(this.topic).then(r => {
       let platform = {},
         pli = [];
@@ -368,6 +377,7 @@ export default {
       barchart = new F2.Chart({
         id: "barChart",
         pixelRatio: window.devicePixelRatio,
+        padding: [10, 50, 30, 110],
       });
 
       barchart.source(li, {
@@ -421,7 +431,6 @@ export default {
       piechart = new F2.Chart({
         id: "piechart",
         pixelRatio: window.devicePixelRatio,
-        height: (this.$refs.main.offsetWidth / 24) * 7.5,
       });
       let lis = [];
       for (let i = 0; i < li.length; i++) {
@@ -479,6 +488,15 @@ export default {
       });
     },
   },
+  beforeDestroy() {
+    console.log("---");
+    linechart && linechart.destroy();
+    barchart && barchart.destroy();
+    piechart && piechart.destroy();
+    linechart = null;
+    barchart = null;
+    piechart = null;
+  },
   components: {},
 };
 </script>

+ 1 - 0
src/view/login.vue

@@ -66,6 +66,7 @@ export default {
           from.append("password", this.form.password)
           login(from).then(r=>{
               localStorage.token = r.token || "";
+              localStorage.login = this.form.username || "";
               this.$router.replace({path: "/main" })
           })
       }

+ 1 - 1
src/view/main.vue

@@ -12,7 +12,7 @@
         @click="layout"
       />
 
-      <div style="float: right;height:19px;line-height:19px;padding-right: 5px">{{username}}</div>
+      <div style="float: right;height:23px;line-height:23px;padding-right: 5px">{{username}}</div>
     </div>
     <div class="mainRight">
       <com-main v-if="hd" :hd="hd" :topic="hdName"></com-main>