From 98a44e94ecc76abd72b9817648ca4b91469b936a Mon Sep 17 00:00:00 2001 From: hanbaoshan <hanbaoshan@aiotlink.com> Date: 星期六, 08 八月 2020 16:04:16 +0800 Subject: [PATCH] 添加退出登录,布局调整 --- src/pages/desktop/index/components/Tools.vue | 91 +++++++++++++++++++++++++++++++++++++++------ 1 files changed, 79 insertions(+), 12 deletions(-) diff --git a/src/pages/desktop/index/components/Tools.vue b/src/pages/desktop/index/components/Tools.vue index b02a46b..2cda1d5 100644 --- a/src/pages/desktop/index/components/Tools.vue +++ b/src/pages/desktop/index/components/Tools.vue @@ -7,15 +7,16 @@ > <img class="system" :src="`${publicPath}images/desktop/header-icon/system.png`" /> </div> - <div class="tools-icon"> + <div class="tools-icon no-hover-style"> <img class="smart-ai" :src="`${publicPath}images/desktop/header-icon/SmartAI.png`" alt /> </div> </div> <div class="tools-middle"> - <div v-for="dock in this.$store.state.desktop.minDocks" :key="dock.id" class="dock-item-wrap"> + <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" :alt="dock.name" /> + <img class="dock-shot" :src="dock.screenshot" v-if="dock.screenshot"/> + </a> </div> </div> @@ -30,21 +31,34 @@ <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 {logout} from "@/api/login"; export default { name: "Tools", data() { return { publicPath: process.env.BASE_URL, notificationCenterVisible: false, - notificationCenterMessageCount: 0 + notificationCenterMessageCount: 0, + maxOrder: 0, + maxOrderOne: '' }; }, created() { @@ -58,6 +72,23 @@ }, 600) ]; }, + // watch:{ + // '$store.state.desktop.frames':{ + // handler(n,o){ + // if(n){ + // debugger; + // n.forEach((item,index) => { + // if(item.order >= this.maxOrder){ + // this.maxOrderOne = item.id; + // } + // }); + // } + // }, + // deep: true + // } + // }, + + methods: { notificationCenterClick: function () { this.notificationCenterVisible = !this.notificationCenterVisible; @@ -85,11 +116,13 @@ id: frame.id, src: frame.icon, alt: frame.title, - type: "3" + type: "3", + screenshot: '' }); }) }, dockClick(dock) { + debugger if (dock.type === "1") { window.open(dock.url); } else if (dock.type === "2") { @@ -101,7 +134,37 @@ }); } else if (dock.type === "3") { this.$store.commit("desktop/resetMinFrame", dock.id); + //鐐瑰嚮鐨刬frame缃《骞堕珮浜� + debugger + this.$store.commit("desktop/refreshFrame", 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("閫�鍑哄け璐�"); + }); } } }; @@ -152,12 +215,13 @@ border-bottom: 2px solid transparent; position: relative; } -.tools .tools-middle .dock-item-wrap:hover, -.tools .tools-middle .dock-item-wrap.clicked { +.tools .tools-middle .dock-item-wrap:hover{ color: white; background-color: #98aabe; +} +.tools-middle .dock-item-wrap.actived{ border-color: #40c3ff; - cursor: pointer; + background-color: #98aabe; } .dock-item-wrap a { height: 100%; @@ -187,8 +251,8 @@ padding: 0 15px; } -.tools .tools-icon:hover, -.tools .tools-icon.clicked { +.tools .tools-icon:not(.no-hover-style):hover, +.tools .tools-icon:not(.no-hover-style).clicked { color: white; background-color: #98aabe; cursor: pointer; @@ -199,4 +263,7 @@ height: 100%; margin-right: 14px; } +.el-dropdown-menu{ + top: 40px !important; +} </style> \ No newline at end of file -- Gitblit v1.8.0