heyujie
2021-03-05 3613f5414bef610d8486c01eea3a795d62dabb16
src/pages/desktop/index/components/ToolsEntry.vue
@@ -1,9 +1,10 @@
<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 +30,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,9 +62,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',
  components: { draggable },
  data () {
    return {
      publicPath: process.env.BASE_URL,
@@ -81,7 +86,7 @@
          title: '人员跟踪'
        }
      ],
      rowSize: 3,
      //rowSize: 3,
      badgeNum: 0,
    }
  },
@@ -96,15 +101,24 @@
      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
    },
    rowSize (){
      if (window.innerHeight >= 930) {
        return 4;
      }else{
        return 3;
      }
    }
  },
  mounted () {
@@ -123,6 +137,12 @@
        if (msg.indexOf("toSearch") >= 0) {
          let params = msg.substring(7);
          this.addFrameByName("search", params)
        }
        if (msg.indexOf("toOpenApp") >= 0) {
          let id = msg.substring(10);
          console.log(id);
          this.addFrameByID(id)
        }
      }
    });
@@ -150,7 +170,9 @@
        console.log(e)
      })
    },
    dockClick (dock) {
      if (dock.type === '1') {
        window.open(dock.url);
      } else if (dock.type === '2' && !dock.isOpen) {
@@ -192,7 +214,6 @@
      dockMask.style.width = dockItems.length * 60 + 40 + 'px';
    },
    addFrameByName (name, params) {
      let dock = null;
      this.$store.state.desktop.docks.forEach(app => {
        if (app.name === name) {
@@ -218,6 +239,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 +299,8 @@
            }
            .badge {
              position: absolute;
              top: 12px;
              right: 5px;
              top: 13px;
              right: 8px;
              width: 22px;
              height: 22px;
              font-size: 14px;
@@ -309,7 +344,7 @@
      text-align: right;
      padding-right: 50px;
      user-select: none;
      margin-top: -80px;
      margin-top: -74px;
      img {
        user-select: none;
        -webkit-user-drag: none;