diff --git a/src/config/style.config.less b/src/config/style.config.less index 6167aec2..f1ee3652 100644 --- a/src/config/style.config.less +++ b/src/config/style.config.less @@ -1,2 +1,2 @@ -@md-width: 1366px; +@md-width: 1024px; @md-height: 700px; diff --git a/src/electron/event/ipc-main/index.ts b/src/electron/event/ipc-main/index.ts index 4a7c5636..7fe17ccd 100644 --- a/src/electron/event/ipc-main/index.ts +++ b/src/electron/event/ipc-main/index.ts @@ -64,16 +64,16 @@ export const onIpcMainEvent = (win: BrowserWindow) => { store.set('downloadPath', arg) downloadPath = arg }) - ipcMain.on(Action.MINIMIZE_WINDOW, (event: IpcMainEvent, arg) => { + ipcMain.on(Action.MINIMIZE_WINDOW, (event: IpcMainEvent) => { win.minimize() }) - ipcMain.on(Action.MAXIMIZE_WINDOW, (event: IpcMainEvent, arg) => { + ipcMain.on(Action.MAXIMIZE_WINDOW, (event: IpcMainEvent) => { win.maximize() }) - ipcMain.on(Action.RESTORE_WINDOW, (event: IpcMainEvent, arg) => { + ipcMain.on(Action.RESTORE_WINDOW, (event: IpcMainEvent) => { win.restore() }) - ipcMain.on(Action.CLOSE_WINDOW, (event: IpcMainEvent, arg) => { + ipcMain.on(Action.CLOSE_WINDOW, (event: IpcMainEvent) => { win.close() syrice && syrice.close() }) diff --git a/src/layout/container.less b/src/layout/container.less index 46a5c50f..639c591c 100644 --- a/src/layout/container.less +++ b/src/layout/container.less @@ -18,6 +18,9 @@ width: 100%; height: 80px; transform: matrix(1, 0, 0, 1, 0, 0) !important; + & .schedule { + display: none; + } } &-md { width: @md-width; diff --git a/src/layout/container.tsx b/src/layout/container.tsx index c8ecee32..93e78bb2 100644 --- a/src/layout/container.tsx +++ b/src/layout/container.tsx @@ -34,13 +34,15 @@ export const Container = defineComponent({ const { screenSize } = toRefs(useState()) - watch(screenSize, v => { - if (v === LayoutSize.MD) { - startDrag.value() - } else { - stopDrag.value() - } - }) + if (VUE_APP_PLATFORM === Platform.BROWSER) { + watch(screenSize, v => { + if (v === LayoutSize.MD) { + startDrag.value() + } else { + stopDrag.value() + } + }) + } onMounted(() => { if (VUE_APP_PLATFORM === Platform.BROWSER) { diff --git a/src/pages/header/view/index.tsx b/src/pages/header/view/index.tsx index deedd746..57b2473f 100644 --- a/src/pages/header/view/index.tsx +++ b/src/pages/header/view/index.tsx @@ -1,11 +1,11 @@ -import { defineComponent, ref } from 'vue' +import { computed, defineComponent, ref } from 'vue' import { Action } from '@/electron/event/action-types' import { importIpc } from '@/electron/event/ipc-browser' import { Logo } from '../component/logo' import { PushShift } from '../component/push-shift' import { Setting } from '../component/setting' import { Search } from '../component/search' -import { LayoutActions } from '@/interface' +import { LayoutActions, LayoutSize } from '@/interface' import { useLayoutModule } from '@/modules/index' import { Platform } from '@/config/build' import './index.less' @@ -21,9 +21,8 @@ const actionToClass = { export const Header = defineComponent({ name: 'Header', setup() { - const windowSize = ref('enlarge') - - const { useMutations } = useLayoutModule() + const { useState, useMutations } = useLayoutModule() + const state = useState() const handleWindowControl = (action: Action) => { if (VUE_APP_PLATFORM === Platform.BROWSER) { @@ -36,12 +35,14 @@ export const Header = defineComponent({ } } + const windowSize = computed(() => { + return state.screenSize === LayoutSize.MD ? 'enlarge' : 'shrink' + }) + const windowsChangeSize = () => { if (windowSize.value === 'shrink') { - windowSize.value = 'enlarge' handleWindowControl(Action.RESTORE_WINDOW) } else { - windowSize.value = 'shrink' handleWindowControl(Action.MAXIMIZE_WINDOW) } } @@ -52,9 +53,8 @@ export const Header = defineComponent({ const win = event.getWindow() if (win) { const isMax = win.isMaximized() - isMax - ? (windowSize.value = 'shrink') - : (windowSize.value = 'enlarge') + const size = isMax ? LayoutSize.LG : LayoutSize.MD + useMutations(LayoutActions.CHANGE_WINDOW_SIZE, size) } }) }) diff --git a/src/pages/main/view/index.less b/src/pages/main/view/index.less index a312f405..7070e201 100644 --- a/src/pages/main/view/index.less +++ b/src/pages/main/view/index.less @@ -15,11 +15,3 @@ } } } - -.container { - &-sm { - .main-container { - display: none; - } - } -} diff --git a/src/store/index.ts b/src/store/index.ts index a7e903c4..a5ad1493 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -80,6 +80,7 @@ plugins.push( paths: [ 'Auth.user', 'Header.themeColor', + 'Layout', 'Footer.musicStack', 'Footer.musciHistory', 'Footer.volume',