Quellcode durchsuchen

fix 安装依赖countTo 定时刷新智能门禁和在线沟通

1711193168@qq.com vor 5 Jahren
Ursprung
Commit
4ae1d4bf2f

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
     "element-ui": "^2.12.0",
     "reset.css": "^2.0.2",
     "vue": "^2.6.10",
+    "vue-count-to": "^1.0.13",
     "vue-router": "^3.0.3",
     "vuex": "^3.0.1"
   },

+ 12 - 6
src/views/index/components/communication/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-25 14:10:08
  * @LastEditors: mozhuangru
- * @LastEditTime: 2019-10-09 14:21:37
+ * @LastEditTime: 2019-10-11 17:45:38
  * @Description: 在线沟通
  -->
 <template>
@@ -45,13 +45,19 @@ export default {
     TagCom
   },
   mounted () {
-    api.getDialogRecord().then(res => {
-      this.dialogData = res.data.data.list
-    })
-    this.circleProportionMap()
-    this.createSatisfactionMap()
+    this.init()
+    setInterval(() => {
+      this.init()
+    }, 30000)
   },
   methods: {
+    init () {
+      api.getDialogRecord().then(res => {
+        this.dialogData = res.data.data.list
+      })
+      this.circleProportionMap()
+      this.createSatisfactionMap()
+    },
     /**
      * 占比
      */

+ 15 - 7
src/views/index/components/entrance-guard/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-25 10:20:36
  * @LastEditors: mozhuangru
- * @LastEditTime: 2019-10-09 11:43:35
+ * @LastEditTime: 2019-10-11 17:44:07
  * @Description: 智能门禁
  -->
 <template>
@@ -43,12 +43,20 @@ export default {
     TagCom
   },
   mounted () {
-    api.getFacePassRecord({
-      pageSize: 30,
-      pageNum: 1
-    }).then(res => {
-      this.faceData = res.data.data
-    })
+    this.init()
+    setInterval(() => {
+      this.init()
+    }, 30000)
+  },
+  methods: {
+    init () {
+      api.getFacePassRecord({
+        pageSize: 30,
+        pageNum: 1
+      }).then(res => {
+        this.faceData = res.data.data
+      })
+    }
   }
 }
 </script>

+ 4 - 1
src/views/index/components/income/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-26 10:57:30
  * @LastEditors: mozhuangru
- * @LastEditTime: 2019-10-11 10:05:50
+ * @LastEditTime: 2019-10-11 16:24:41
  * @Description: 收入统计
  -->
 <template>
@@ -53,6 +53,9 @@ export default {
     api.getBillSum().then(res => {
       res.data.data.forEach(item => {
         this.billSum[item.type] = item.total
+        if (item.type === 'billRate') {
+          this.percentage = JSON.parse(item.total)
+        }
       })
       this.createIncomeMap()
     })

+ 1 - 1
src/views/index/components/statistical/index.scss

@@ -16,7 +16,7 @@
       padding-top: halfH(14);
       font-size:halfH(28);
       color:#fff;
-      animation: bubble 10s infinite;
+      // animation: bubble 10s infinite;
     }
     &:last-child{
       margin-right: 0;

+ 34 - 14
src/views/index/components/statistical/index.vue

@@ -2,59 +2,63 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-24 18:56:59
  * @LastEditors: mozhuangru
- * @LastEditTime: 2019-10-09 11:26:11
+ * @LastEditTime: 2019-10-11 17:23:08
  * @Description:
  -->
 <template>
   <div class="statistical">
-    <TipsCardCom :class="['item', item.cls]" v-for="(item, idx) in list" :key="idx">
+    <TipsCardCom :class="['item', item.cls]" v-for="item in list" :key="item.value">
       <h3 class="item-label">{{item.label}}</h3>
-      <p class="item-txt">{{item.value | numberFormat}}</p>
+      <p class="item-txt" ref="num">
+        <countTo ref="countTo" :startVal='item.start' :endVal='item.value' :duration='3000'></countTo>
+      </p>
     </TipsCardCom>
   </div>
 </template>
 <script>
 import TipsCardCom from '@/components/tips-card'
 import { api } from '@/api'
+import countTo from 'vue-count-to'
 export default {
   data () {
     return {
       list: [
         {
-          label: '物业面积(m^2)',
+          label: '物业面积(㎡)',
           cls: 'mianzhi',
           key: 'propertyArea',
-          value: '434123452'
+          value: null
         },
         {
-          label: '物业项目(个)',
+          label: '物业项目(个)',
           cls: 'xiangmu',
           key: 'propertyProject',
-          value: '521331'
+          value: null
         },
         {
-          label: '房屋(套)',
+          label: '房屋(套)',
           cls: 'fangwu',
           key: 'house',
-          value: '6342531'
+          value: null
         },
         {
-          label: '住户(人)',
+          label: '住户(人)',
           cls: 'zhuhu',
           key: 'resident',
-          value: '93834123'
+          value: null
         },
         {
-          label: '车辆(辆)',
+          label: '车辆(辆)',
           cls: 'cheliang',
           key: 'car',
-          value: '7431243'
+          value: null
         }
       ]
     }
   },
   components: {
-    TipsCardCom
+    TipsCardCom,
+    countTo
   },
   mounted () {
     api.getAssetInfo().then(res => {
@@ -62,11 +66,27 @@ export default {
         this.list.map(val => {
           if (val.key === item.type) {
             val.value = item.total
+            if (String(val.value).length > 6) {
+              val.start = parseInt(val.value / 100000) * 100000
+            } else {
+              val.start = 0
+            }
           }
           return val
         })
       })
     })
+    setInterval(() => {
+      this.onAgain()
+    }, 10000)
+  },
+  methods: {
+    onAgain () {
+      let countTo = this.$refs.countTo
+      countTo.forEach(item => {
+        item.start()
+      })
+    }
   }
 }
 </script>