From dd99143ce38b1db0bc43faddc21baa08a904187c Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Tue, 25 Jul 2023 16:57:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E4=BB=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9C=80=E5=90=8E=E4=B8=80=E6=AC=A1=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/index.ts | 4 ++++ frontend/src/store/interface/index.ts | 1 + frontend/src/views/host/file-management/index.vue | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts index 7159b3bec8a9..f8dffc1efa9a 100644 --- a/frontend/src/store/index.ts +++ b/frontend/src/store/index.ts @@ -26,6 +26,7 @@ export const GlobalStore = defineStore({ hasNewVersion: false, ignoreCaptcha: true, device: DeviceType.Desktop, + lastFilePath: '', }), getters: {}, actions: { @@ -60,6 +61,9 @@ export const GlobalStore = defineStore({ isMobile() { return this.device === DeviceType.Mobile; }, + setLastFilePath(path: string) { + this.lastFilePath = path; + }, }, persist: piniaPersistConfig('GlobalState'), }); diff --git a/frontend/src/store/interface/index.ts b/frontend/src/store/interface/index.ts index b5fb7a80cb90..5637977057bc 100644 --- a/frontend/src/store/interface/index.ts +++ b/frontend/src/store/interface/index.ts @@ -21,6 +21,7 @@ export interface GlobalState { hasNewVersion: boolean; ignoreCaptcha: boolean; device: DeviceType; + lastFilePath: string; } export interface MenuState { diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index dfc315008d2a..5c39d08b8999 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -363,6 +363,8 @@ const jump = async (url: string) => { req.containSub = false; req.search = ''; let searchResult = await searchFile(); + + globalStore.setLastFilePath(req.path); // check search result,the file is exists? if (!searchResult.data.path) { req.path = oldUrl; @@ -636,6 +638,12 @@ onMounted(() => { if (router.currentRoute.value.query.path) { req.path = String(router.currentRoute.value.query.path); getPaths(req.path); + globalStore.setLastFilePath(req.path); + } else { + if (globalStore.lastFilePath && globalStore.lastFilePath != '') { + req.path = globalStore.lastFilePath; + getPaths(req.path); + } } pathWidth.value = pathRef.value.offsetWidth * 0.7; search();