From a88314bd5d59f1dde2d430899555a3a5730f2ef9 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期五, 25 九月 2020 09:37:00 +0800
Subject: [PATCH] 优化card时间显示和摄像机音频试听功能

---
 src/components/subComponents/CardItem.vue |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/components/subComponents/CardItem.vue b/src/components/subComponents/CardItem.vue
index ea7c753..9261c4e 100644
--- a/src/components/subComponents/CardItem.vue
+++ b/src/components/subComponents/CardItem.vue
@@ -88,7 +88,7 @@
         @mouseleave="cardMouseleave($event)"
       >
         <p>
-          <span class="fontStyle color222">{{ data.picDate }}</span>
+          <span class="fontStyle color222">{{ data.picDate | formatTime}}</span>
         </p>
         <p style="margin-bottom: 8px;">
           <span class="fontStyle color222">{{ data.cameraAddr }}</span>
@@ -226,7 +226,7 @@
         @mouseleave="cardMouseleave($event)"
       >
         <p :title="data.picDate">
-          <span class="fontStyle color222">{{ data.picDate }}</span>
+          <span class="fontStyle color222">{{ data.picDate | formatTime }}</span>
         </p>
         <p :title="data.cameraAddr" style="margin-bottom: 8px;">
           <span class="fontStyle color222">{{ data.cameraAddr }}</span>
@@ -316,7 +316,7 @@
           <span v-else>{{ data.baseInfo[0].compareScore | percentage}}</span>
         </p>
         <p :title="data.picDate">
-          <span class="fontStyle color222">{{ data.picDate }}</span>
+          <span class="fontStyle color222">{{ data.picDate | formatTime }}</span>
         </p>
         <p :title="data.cameraAddr" style="margin-bottom: 8px;">
           <span class="fontStyle color222">{{ data.cameraAddr }}</span>
@@ -465,7 +465,7 @@
         >
           <div>
             <p :title="data.picDate">
-              <span class="fontStyle color222">{{ data.picDate }}</span>
+              <span class="fontStyle color222">{{ data.picDate | formatTime }}</span>
             </p>
             <p :title="data.cameraAddr" style="margin-bottom: 8px;">
               <span class="fontStyle color222">{{ data.cameraAddr }}</span>
@@ -484,6 +484,22 @@
 </template>
 
 <script>
+Date.prototype.Format = function (fmt) {
+  var o = {
+    "M+": this.getMonth() + 1, //鏈堜唤 
+    "d+": this.getDate(), //鏃� 
+    "H+": this.getHours(), //灏忔椂 
+    "m+": this.getMinutes(), //鍒� 
+    "s+": this.getSeconds(), //绉� 
+    "q+": Math.floor((this.getMonth() + 3) / 3), //瀛e害 
+    "S": this.getMilliseconds() //姣 
+  };
+  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
+  for (var k in o)
+    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+  return fmt;
+}
+
 export default {
   mounted() {
     window.addEventListener("resize", this.watchWindow);
@@ -504,6 +520,9 @@
     }
   },
   filters: {
+    formatTime(t) {
+      return new Date(t).Format("yyyy-MM-dd HH:mm:ss")
+    },
     percentage(score) {
       return score.toFixed(2) + "%"
     }
@@ -520,7 +539,6 @@
   watch: {
     data: {
       handler(val, oldVal) {
-        console.log('鏁版嵁鍙戠敓鍙樺寲')
         this.$forceUpdate()
       },
       deep: true
@@ -559,19 +577,16 @@
       this.$emit("detailsClick", ev);
     },
     toAdd(item) {
-      console.log("瑙﹀彂鍔犲叆搴曞簱")
       this.$emit("addToBase", item);
     },
     tosearch(item) {
-      console.log('search')
-      console.log(location.href)
       let captureId = item.id == "" ? item.baseInfo[0].targetId : item.id
       let imgUrl = item.targetInfo ? item.targetInfo[0].picSmUrl : item.baseInfo[0].targetPicUrl
       let compType = 1 //  鏁版嵁鏉ヨ嚜浜巈s
       if (!item.id || item.id == "") {
         compType = 0 // 鏁版嵁鏉ヨ嚜浜庡簳搴�
       }
-      
+
       let message = 'toSearch?showType=findByPic&targetId=' + captureId + '&picSmUrl=' + imgUrl + '&compType=' + compType + '&timestamp=' + new Date().getTime();
       //let message = 'toSearch?showType=findByPic&targetId=' + captureId + '&picSmUrl=' + imgUrl + '&compType=' + compType;
       window.parent.postMessage({

--
Gitblit v1.8.0