From b23a2a35a14b010a3b97a1b61a02ec179dfab924 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期五, 04 九月 2020 17:25:14 +0800
Subject: [PATCH] feat: sort camera tree

---
 src/pages/desktop/index/components/Tools.vue |   68 +++++++++++++++++++++++++++++----
 1 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/src/pages/desktop/index/components/Tools.vue b/src/pages/desktop/index/components/Tools.vue
index 8bcadc0..8bc66e7 100644
--- a/src/pages/desktop/index/components/Tools.vue
+++ b/src/pages/desktop/index/components/Tools.vue
@@ -12,11 +12,11 @@
       </div>
     </div>
     <div class="tools-middle">
-      <div v-for="dock in $store.state.desktop.minDocks" :key="dock.id" class="dock-item-wrap" :class="{'actived':dock.highlight}">
+      <div v-for="dock in $store.state.desktop.minDocks" :key="dock.id" class="dock-item-wrap" :class="{'actived':dock.highlight}" >
         <a @click="dockClick(dock)">
           <img class="dock-item" :src="dock.src" :alt="dock.alt" />
           <img class="dock-shot" :src="dock.screenshot" v-if="dock.screenshot"/>
-          
+          <!-- <iframe class="dock-shot" :src="dock.url"  ></iframe> -->
         </a>
       </div>
     </div>
@@ -31,14 +31,26 @@
         <img :src="`${publicPath}images/desktop/header-icon/notice.png`" alt />
       </div>
       <div class="tools-icon">
-        <img :src="`${publicPath}images/desktop/header-icon/user.png`" alt />
+        <el-dropdown size="small" placement="bottom">
+          <span class="el-dropdown-link">
+            <img :src="`${publicPath}images/desktop/header-icon/user.png`" alt />
+            <!-- <i class="el-icon-arrow-down el-icon--right"></i> -->
+          </span>
+          <el-dropdown-menu slot="dropdown" style='top: 44px;'>
+            <el-dropdown-item @click.native='toLogout'>
+              閫�鍑虹櫥褰�
+            </el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+        
       </div>
     </div>
   </div>
 </template>
 
 <script>
-
+import html2canvas from 'html2canvas';
+import {logout} from "@/api/login";
 export default {
   name: "Tools",
   data() {
@@ -65,7 +77,7 @@
   //   '$store.state.desktop.frames':{
   //     handler(n,o){
   //       if(n){
-  //         debugger;
+  //         ;
   //         n.forEach((item,index) => {
   //           if(item.order >= this.maxOrder){
   //             this.maxOrderOne = item.id;
@@ -99,7 +111,7 @@
     togglePreference() {
       //this.$store.commit("desktop/togglePreference");
       //鏄剧ず妗岄潰,鏈�灏忓寲宸叉墦寮�鐨勫簲鐢�
-      debugger;
+      ;
       this.$store.state.desktop.frames.forEach(frame => {
         this.$store.commit('desktop/addMinDock', {
           id: frame.id,
@@ -111,7 +123,7 @@
       })
     },
     dockClick(dock) {
-      debugger
+      
       if (dock.type === "1") {
         window.open(dock.url);
       } else if (dock.type === "2") {
@@ -124,9 +136,39 @@
       } else if (dock.type === "3") {
         this.$store.commit("desktop/resetMinFrame", dock.id);
         //鐐瑰嚮鐨刬frame缃《骞堕珮浜�
-        debugger
         this.$store.commit("desktop/refreshFrame", dock);
       }
+    },
+    toolHover(dock){
+      //this.$parent.screenShot(dock)
+    },
+
+    toLogout(){
+      this.$confirm("鎻愮ず锛氱‘瀹氶��鍑哄悧锛�", {
+        center: true,
+        cancelButtonClass: "comfirm-class-cancle",
+        confirmButtonClass: "comfirm-class-sure"
+      }).then(_ => {
+        logout().then(res => {
+          if (res === "閫�鍑烘垚鍔�") {
+            sessionStorage.removeItem("userInfo");
+            location.assign('/view/index');
+            this.$notify({
+              title: "鎻愮ず",
+              type: "success",
+              message: "閫�鍑烘垚鍔燂紒"
+            });
+          } else {
+            this.$notify({
+              title: "鎻愮ず",
+              type: "success",
+              message: "閫�鍑哄け璐�!"
+            });
+          }
+        });
+      }).catch(_ => {
+        console.log("閫�鍑哄け璐�");
+      });
     }
   }
 };
@@ -159,6 +201,7 @@
   float: left;
   position: relative;
 }
+
 .tools .tools-middle::before {
   width: 1px;
   height: 20px;
@@ -194,6 +237,7 @@
 }
 .dock-item-wrap .dock-shot {
   visibility: hidden;
+  /* transform: scale(0.5); */
   width: 100px;
   height: 46px;
   position: absolute;
@@ -211,8 +255,11 @@
   vertical-align: top;
   line-height: 56px;
   padding: 0 15px;
+  
 }
-
+.tools-icon img{
+  -webkit-user-drag: none;
+}
 .tools .tools-icon:not(.no-hover-style):hover,
 .tools .tools-icon:not(.no-hover-style).clicked {
   color: white;
@@ -225,4 +272,7 @@
   height: 100%;
   margin-right: 14px;
 }
+.el-dropdown-menu{
+  top: 40px !important;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0