From 5058e8d5fc8220a4fa31d160935c1aafd6074fb3 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期三, 07 四月 2021 15:46:45 +0800
Subject: [PATCH] 修复以图搜图底库图片显示的问题

---
 src/pages/desktop/index/components/ToolsEntry.vue |   67 +++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/src/pages/desktop/index/components/ToolsEntry.vue b/src/pages/desktop/index/components/ToolsEntry.vue
index 6d329c8..c25e428 100644
--- a/src/pages/desktop/index/components/ToolsEntry.vue
+++ b/src/pages/desktop/index/components/ToolsEntry.vue
@@ -1,7 +1,12 @@
 <template>
   <div class="tools-entry">
     <div class="entry-wrap">
-      <el-carousel :height="rowSize==3?'600px':'770px'" :autoplay="false" arrow="never" :indicator-position="carousels.length==1?'none':''">
+      <el-carousel
+        :height="rowSize==3?'600px':'770px'"
+        :autoplay="false"
+        arrow="never"
+        :indicator-position="carousels.length==1?'none':''"
+      >
         <el-carousel-item v-for="(carousel,index) in carousels" :key="index">
           <div class="app-list clearFix sdk-list">
             <!-- <draggable v-model="carousel" @start="drag=true" @end="drag=false"> -->
@@ -64,11 +69,11 @@
 <script>
 import draggable from "vuedraggable"
 import { findAllSdk } from '@/api/taskMange';
-import {chunkArr} from '@/scripts/util';
+import { chunkArr } from '@/scripts/util';
+import bus from '@/plugin/bus'
 export default {
   name: 'toolsEntry',
-  components: { draggable },
-  data () {
+  data() {
     return {
       publicPath: process.env.BASE_URL,
       loading: true,
@@ -86,18 +91,17 @@
         }
       ],
       //rowSize: 3,
-      badgeNum: 0,
+      // badgeNum: 0,
     }
   },
   computed: {
-    stateDocks () {
+    stateDocks() {
       return this.$store.state.desktop.docks
     },
-    carousels () {
+    carousels() {
       let pages = 0;
       let tempArr = this.stateDocks.concat(this.installedSdk);
       let upgradeArr = tempArr.filter(item => item.isUpgrade);
-      this.badgeNum = upgradeArr.length;
       let arr = null;
       //鏍规嵁灞忓箷楂樺害鏉ュ垽鏂槸灞曠ず3鎺掕繕鏄�4鎺� 闃堝��:970
       if (window.innerHeight >= 930) {
@@ -112,15 +116,19 @@
       console.log(arr)
       return arr
     },
-    rowSize (){
+    badgeNum() {
+      let tempArr = this.stateDocks.concat(this.installedSdk);
+      return tempArr.filter(item => item.isUpgrade).length;
+    },
+    rowSize() {
       if (window.innerHeight >= 930) {
         return 4;
-      }else{
+      } else {
         return 3;
       }
     }
   },
-  mounted () {
+  mounted() {
     this.getAllSdk();
     //this.carousels = 
     window.addEventListener('message', e => {
@@ -137,12 +145,22 @@
           let params = msg.substring(7);
           this.addFrameByName("search", params)
         }
+        if (msg.indexOf("toCluster") >= 0) {
+          let params = msg.substring(8);
+          this.addFrameByName("searchForCluster", params)
+        }
+
+        if (msg.indexOf("toOpenApp") >= 0) {
+          let id = msg.substring(10);
+          console.log(id);
+          this.addFrameByID(id)
+        }
       }
     });
 
   },
   methods: {
-    chunk (arr, size) {
+    chunk(arr, size) {
       size = Math.max(size, 0);
       const len = arr == null ? 0 : arr.length;
       if (!len || size < 1) {
@@ -156,14 +174,16 @@
       }
       return result
     },
-    getAllSdk () {
+    getAllSdk() {
       findAllSdk().then(res => {
         this.installedSdk = res.data.filter(item => item.installed)
       }).catch(e => {
         console.log(e)
       })
     },
-    dockClick (dock) {
+
+    dockClick(dock) {
+
       if (dock.type === '1') {
         window.open(dock.url);
       } else if (dock.type === '2' && !dock.isOpen) {
@@ -193,7 +213,7 @@
         this.$store.commit('desktop/resetMinFrame', dock.id);
       }
     },
-    resetDockItem () {
+    resetDockItem() {
       const dockItems = document.getElementsByClassName('dock-item');
       const dockMask = document.getElementsByClassName('dock-mask')[0];
       for (let i = 0; i < dockItems.length; i++) {
@@ -204,8 +224,7 @@
       }
       dockMask.style.width = dockItems.length * 60 + 40 + 'px';
     },
-    addFrameByName (name, params) {
-
+    addFrameByName(name, params) {
       let dock = null;
       this.$store.state.desktop.docks.forEach(app => {
         if (app.name === name) {
@@ -231,6 +250,20 @@
         url: dock.url,
         screenshot: ''
       });
+    },
+    addFrameByID(id, params) {
+
+      let dock = null;
+      let toClose = null
+      this.$store.state.desktop.docks.forEach(app => {
+        if (app.id == id) {
+          dock = app;
+        }
+        if (app.name == "algorithmManage") {
+          toClose = app
+        }
+      });
+      this.dockClick(dock)
     }
   }
 };

--
Gitblit v1.8.0