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 |   85 +++++++++++++++++++++++++-----------------
 1 files changed, 50 insertions(+), 35 deletions(-)

diff --git a/src/pages/desktop/index/components/ToolsEntry.vue b/src/pages/desktop/index/components/ToolsEntry.vue
index aa26486..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,12 +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,
@@ -87,19 +91,17 @@
         }
       ],
       //rowSize: 3,
-      badgeNum: 0,
-      curDock: {}
+      // 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) {
@@ -114,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 => {
@@ -139,21 +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)
+        }
       }
     });
-    this.$nextTick( () =>{
-       bus.$on("open-app", (val)=> {
-        debugger
-        const cur = this.stateDocks.find( (item)=> {
-          return item.id == val
-        })
-        this.dockClick(cur)
-        this.curDock = cur
-    })
-    })
+
   },
   methods: {
-    chunk (arr, size) {
+    chunk(arr, size) {
       size = Math.max(size, 0);
       const len = arr == null ? 0 : arr.length;
       if (!len || size < 1) {
@@ -167,15 +174,15 @@
       }
       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);
@@ -206,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++) {
@@ -217,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) {
@@ -244,13 +250,22 @@
         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)
     }
-  },
-  watch:{
-    curDock:function (val) {
-      this.dockClick(val)
-    }
-  },
+  }
 };
 </script>
 

--
Gitblit v1.8.0