diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index a47646532..ceacf5601 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1155,6 +1155,10 @@ const message = { clashDitNotSupport: 'File names are prohibited from containing .1panel_clash', clashDeleteAlert: 'The Recycle Bin folder cannot be deleted', clashOpenAlert: 'Please click the [Recycle Bin] button to open the recycle bin directory', + right: 'Forward', + back: 'Back', + top: 'Go Back', + refresh: 'Refresh', }, ssh: { autoStart: 'Auto Start', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 6e6987084..1d6229689 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1099,6 +1099,10 @@ const message = { clashDitNotSupport: '檔名禁止包含 .1panel_clash', clashDleteAlert: '回收站資料夾不能刪除', clashOpenAlert: '回收站目錄請點選【回收站】按鈕開啟', + right: '前進', + back: '後退', + top: '返回上一層', + refresh: '重新整理', }, ssh: { autoStart: '開機自啟', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index d082f39f1..0ded33ed9 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1100,6 +1100,10 @@ const message = { clashDitNotSupport: '文件名禁止包含 .1panel_clash', clashDleteAlert: '回收站文件夹不能删除', clashOpenAlert: '回收站目录请点击【回收站】按钮打开', + right: '前进', + back: '后退', + top: '返回上一级', + refresh: '刷新', }, ssh: { autoStart: '开机自启', diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index d6252c957..e11163ee9 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -2,8 +2,18 @@
- - + + + + + + + + + + + +
([]); let pathWidth = ref(0); +const history: string[] = []; +let pointer = -1; const fileCreate = reactive({ path: '/', isDir: false, mode: 0o755 }); const fileCompress = reactive({ files: [''], name: '', dst: '', operate: 'compress' }); @@ -461,7 +473,6 @@ const open = async (row: File.File) => { url: req.path, name: name, }); - jump(req.path); } else { openCodeEditor(row.path, row.extension); @@ -491,7 +502,23 @@ const handlePath = () => { } }; +const right = () => { + if (pointer < history.length - 1) { + pointer++; + let url = history[pointer]; + backForwardJump(url); + } +}; + const back = () => { + if (pointer > 0) { + pointer--; + let url = history[pointer]; + backForwardJump(url); + } +}; + +const top = () => { if (paths.value.length > 0) { let url = '/'; if (paths.value.length >= 2) { @@ -502,6 +529,10 @@ const back = () => { }; const jump = async (url: string) => { + history.splice(pointer + 1); + history.push(url); + pointer = history.length - 1; + const oldUrl = req.path; const oldPageSize = req.pageSize; // reset search params before exec jump @@ -526,6 +557,22 @@ const jump = async (url: string) => { }); }; +const backForwardJump = async (url: string) => { + const oldPageSize = req.pageSize; + // reset search params before exec jump + Object.assign(req, initData()); + req.path = url; + req.containSub = false; + req.search = ''; + req.pageSize = oldPageSize; + let searchResult = await searchFile(); + handleSearchResult(searchResult); + getPaths(req.path); + nextTick(function () { + handlePath(); + }); +}; + const getPaths = (reqPath: string) => { const pathArray = reqPath.split('/'); paths.value = [];