From de1e0c5a2e1ef8cf6abbe995d249a8831ea46a83 Mon Sep 17 00:00:00 2001 From: lyc Date: Mon, 22 Jul 2024 11:24:36 +0800 Subject: [PATCH] window-tools --- .../src/components/window-tools/index.vue | 61 +++++++++++++++++++ src/renderer/src/layout/components/Header.vue | 45 +------------- src/renderer/src/views/login/index.vue | 7 +-- 3 files changed, 67 insertions(+), 46 deletions(-) create mode 100644 src/renderer/src/components/window-tools/index.vue diff --git a/src/renderer/src/components/window-tools/index.vue b/src/renderer/src/components/window-tools/index.vue new file mode 100644 index 0000000..f32fe27 --- /dev/null +++ b/src/renderer/src/components/window-tools/index.vue @@ -0,0 +1,61 @@ + + + + + \ No newline at end of file diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue index 4e4b31b..54c773e 100644 --- a/src/renderer/src/layout/components/Header.vue +++ b/src/renderer/src/layout/components/Header.vue @@ -14,12 +14,7 @@
-
- - {{ isMaxSize ? '' : - '' }} - -
+
@@ -46,11 +41,11 @@ import { ref, watch } from 'vue' import { useRouter } from 'vue-router' import { ElMessageBox } from 'element-plus' +import WindowTools from '@/components/window-tools/index.vue' import useUserStore from '@/store/modules/user' + const userStore = useUserStore() -const { ipcRenderer } = window.electron || {} -const isMaxSize = ref(false) const router = useRouter() const currentRoute = ref('') @@ -81,19 +76,6 @@ watch( { immediate: true } ) -// 最小化 -const minimizeWindow = () => { - ipcRenderer.send('minimize-window') -} -//最大化 -const maximizeWindow = () => { - ipcRenderer?.send('maximize-window') - isMaxSize.value = !isMaxSize.value -} -//关闭 -const closeWindow = () => { - ipcRenderer.send('close-window') -} const changePage = (url) => { router.push(url) @@ -118,11 +100,9 @@ function logout() { type: 'warning' }).then(() => { userStore.logOut().then(() => { - // location.href = '/index#/login'; router.replace('/login') }).catch(()=>{ router.replace('/login') - // location.href = '/index#/login'; }) }).catch(() => { }); } @@ -213,25 +193,6 @@ watch(()=> userStore.avatar,() => { padding-bottom: 5px; flex-direction: column; - .header-tool { - -webkit-app-region: no-drag; - span { - border-radius: 3px; - cursor: pointer; - padding: 2px 10px; - &:hover { - background-color: #c4c4c4; - } - } - .close{ - &:hover{ - background-color: #fb4a3e; - .iconfont{ - color: #fff; - } - } - } - } .user { .user-info { diff --git a/src/renderer/src/views/login/index.vue b/src/renderer/src/views/login/index.vue index 9478a18..ffabd98 100644 --- a/src/renderer/src/views/login/index.vue +++ b/src/renderer/src/views/login/index.vue @@ -7,10 +7,7 @@