From 929cf4c7be11bfd1e134d0cb0d7cbbe94772ebdf Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@iotlink.com> Date: 星期一, 07 九月 2020 15:35:14 +0800 Subject: [PATCH] 摄像机树增加导入功能 --- src/components/subComponents/CardItem.vue | 85 +++++++++++++++++------------------------- 1 files changed, 35 insertions(+), 50 deletions(-) diff --git a/src/components/subComponents/CardItem.vue b/src/components/subComponents/CardItem.vue index e6abb97..ea7c753 100644 --- a/src/components/subComponents/CardItem.vue +++ b/src/components/subComponents/CardItem.vue @@ -37,7 +37,7 @@ background: getUrl(data.baseInfo[initialIndex].bwType) }" > - <b>{{ `${data.baseInfo[initialIndex].compareScore}%` }}</b> + <b>{{ data.baseInfo[initialIndex].compareScore | percentage }}</b> </div> </div> </div> @@ -87,10 +87,6 @@ @mouseenter="cardMouseenter($event)" @mouseleave="cardMouseleave($event)" > - <!-- <p :title="data.baseInfo[0].compareScore" class="score"> - <span v-if="data.id">{{ data.compareScore }}%</span> - <span v-else>{{ data.baseInfo[0].compareScore }}%</span> - </p>--> <p> <span class="fontStyle color222">{{ data.picDate }}</span> </p> @@ -200,7 +196,7 @@ class="score" style="font-family: PingFangSC-Medium;font-size: 20px;color: #3D68E1;letter-spacing: 0.4px;" > - <span>{{ data.baseInfo[0].compareScore }}%</span> + <span>{{ data.baseInfo[0].compareScore | percentage}}</span> </p> <p :style="data.baseInfo[0].bwType == '0' ? 'font-size:12px;line-height:20px' : 'color:red;font-size:12px;line-height:20px'" @@ -316,8 +312,8 @@ v-if="VideoPhotoData.uploadType" style="font-family: PingFangSC-Medium;font-size: 20px;color: #3D68E1;letter-spacing: 0.4px;" > - <span v-if="data.id">{{ data.compareScore }}%</span> - <span v-else>{{ data.baseInfo[0].compareScore }}%</span> + <span v-if="data.id">{{ data.compareScore | percentage}}</span> + <span v-else>{{ data.baseInfo[0].compareScore | percentage}}</span> </p> <p :title="data.picDate"> <span class="fontStyle color222">{{ data.picDate }}</span> @@ -488,14 +484,8 @@ </template> <script> -import cardType from "../../mockData/cardType.ts"; -import bus from "@/main"; - export default { mounted() { - bus.$on('refreshCompareImg', () => { - // this.tempShowType = false - }) window.addEventListener("resize", this.watchWindow); }, props: { @@ -508,6 +498,25 @@ default: "search" } }, + computed: { + isId() { + return this.data.id + } + }, + filters: { + percentage(score) { + return score.toFixed(2) + "%" + } + }, + data() { + return { + tempShowType: true, + initialIndex: 0, + carouselIndex: 0, + dialogVisible: false, + overflowState: true + }; + }, watch: { data: { handler(val, oldVal) { @@ -517,32 +526,7 @@ deep: true } }, - computed: { - isId() { - return this.data.id - } - }, - data() { - return { - tempShowType: true, - initialIndex: 0, - cardType, - carouselIndex: 0, - dialogVisible: false, - overflowState: true - }; - }, methods: { - watchWindow() { - // console.log('height') - // this.$nextTick(() => { - // document.querySelectorAll('.compareScore111').forEach(ele => { - // ele.style.bottom = this.getBottom() - // console.log("鍏冪礌鐨勬牱寮忓�硷細",ele.style.bottom) - // }); - // this.$forceUpdate() - // }) - }, getBottom() { // let imgDom = document.getElementById(str) let imgDom = this.$refs.firstImg @@ -554,9 +538,9 @@ }, getUrl(bwtype) { if (bwtype == 1) { - return `url(${require("@/assets/bg/red.png")})` + return `url(${require("@/assets/img/red.png")})` } else { - return `url(${require("@/assets/bg/green.png")})` + return `url(${require("@/assets/img/green.png")})` } }, changeInitialIndex(index) { @@ -579,19 +563,20 @@ this.$emit("addToBase", item); }, tosearch(item) { - var curWwwPath = window.document.location.href; - var pathname = window.document.location.pathname; - var pos = curWwwPath.indexOf(pathname); - var localhostPath = curWwwPath.substring(0, pos); //ip+port - var href = localhostPath + "/Layout/Searching" + console.log('search') + console.log(location.href) let captureId = item.id == "" ? item.baseInfo[0].targetId : item.id - var url = item.targetInfo ? item.targetInfo[0].picSmUrl : item.baseInfo[0].targetPicUrl - console.log("璺宠浆鍦板潃", href, "url", url) - var compType = 1 // 鏁版嵁鏉ヨ嚜浜巈s + let imgUrl = item.targetInfo ? item.targetInfo[0].picSmUrl : item.baseInfo[0].targetPicUrl + let compType = 1 // 鏁版嵁鏉ヨ嚜浜巈s if (!item.id || item.id == "") { compType = 0 // 鏁版嵁鏉ヨ嚜浜庡簳搴� } - window.open(href + '?showType=findByPic&targetId=' + captureId + '&picSmUrl=' + url + '&compType=' + compType) + + let message = 'toSearch?showType=findByPic&targetId=' + captureId + '&picSmUrl=' + imgUrl + '&compType=' + compType + '×tamp=' + new Date().getTime(); + //let message = 'toSearch?showType=findByPic&targetId=' + captureId + '&picSmUrl=' + imgUrl + '&compType=' + compType; + window.parent.postMessage({ + msg: message + }, "*") } } }; -- Gitblit v1.8.0