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 | 77 ++++++++++++++++++++++++++++++-------- 1 files changed, 60 insertions(+), 17 deletions(-) diff --git a/src/pages/desktop/index/components/ToolsEntry.vue b/src/pages/desktop/index/components/ToolsEntry.vue index cbc5e4f..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,10 +69,11 @@ <script> import draggable from "vuedraggable" import { findAllSdk } from '@/api/taskMange'; +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, @@ -84,33 +90,45 @@ title: '浜哄憳璺熻釜' } ], - rowSize: 3, - badgeNum: 0, + //rowSize: 3, + // 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) { - this.rowSize = 4; + //this.rowSize = 4; arr = this.chunk(tempArr, 24); + //arr = chunkArr(tempArr,24); } else { - this.rowSize = 3; + //this.rowSize = 3; arr = this.chunk(tempArr, 18); + //arr = chunkArr(tempArr, 18); } console.log(arr) return arr + }, + badgeNum() { + let tempArr = this.stateDocks.concat(this.installedSdk); + return tempArr.filter(item => item.isUpgrade).length; + }, + rowSize() { + if (window.innerHeight >= 930) { + return 4; + } else { + return 3; + } } }, - mounted () { + mounted() { this.getAllSdk(); //this.carousels = window.addEventListener('message', e => { @@ -127,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) { @@ -146,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) { @@ -183,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++) { @@ -194,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) { @@ -221,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