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 | 90 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 68 insertions(+), 22 deletions(-) diff --git a/src/pages/desktop/index/components/ToolsEntry.vue b/src/pages/desktop/index/components/ToolsEntry.vue index 2e38c2b..c25e428 100644 --- a/src/pages/desktop/index/components/ToolsEntry.vue +++ b/src/pages/desktop/index/components/ToolsEntry.vue @@ -1,9 +1,15 @@ <template> <div class="tools-entry"> <div class="entry-wrap"> - <el-carousel :height="rowSize==3?'600px':'770px'" :autoplay="false" arrow="never"> + <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"> --> <div v-for="item in carousel" :key="item.id"> <div class="app" v-if="item.url" @click="dockClick(item)"> <div class="wrap"> @@ -29,7 +35,7 @@ </div> </div> </div> - + <!-- </draggable> --> <!-- <div class="app" v-for="dock in stateDocks" :key="dock.id" @click="dockClick(dock)"> <div class="wrap"> <div class="app-icon"> @@ -61,10 +67,13 @@ </template> <script> +import draggable from "vuedraggable" import { findAllSdk } from '@/api/taskMange'; +import { chunkArr } from '@/scripts/util'; +import bus from '@/plugin/bus' export default { name: 'toolsEntry', - data () { + data() { return { publicPath: process.env.BASE_URL, loading: true, @@ -81,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; + if (window.innerHeight >= 930) { + //this.rowSize = 4; arr = this.chunk(tempArr, 24); - }else{ - this.rowSize = 3; + //arr = chunkArr(tempArr,24); + } else { + //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 => { @@ -124,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) { @@ -143,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) { @@ -180,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++) { @@ -191,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) { @@ -218,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) } } }; @@ -264,8 +310,8 @@ } .badge { position: absolute; - top: 12px; - right: 5px; + top: 13px; + right: 8px; width: 22px; height: 22px; font-size: 14px; @@ -309,7 +355,7 @@ text-align: right; padding-right: 50px; user-select: none; - margin-top: -80px; + margin-top: -74px; img { user-select: none; -webkit-user-drag: none; -- Gitblit v1.8.0