diff --git a/frontend/app.html b/frontend/app.html
index 21cb2f9..7900fc4 100644
--- a/frontend/app.html
+++ b/frontend/app.html
@@ -662,6 +662,27 @@
+
+
diff --git a/frontend/app.js b/frontend/app.js
index 59a0391..d26277a 100644
--- a/frontend/app.js
+++ b/frontend/app.js
@@ -740,7 +740,8 @@ handleDragLeave(e) {
async loadFiles(path) {
this.loading = true;
- this.currentPath = path;
+ // 确保路径不为undefined
+ this.currentPath = path || '/';
try {
const response = await axios.get(`${this.apiBase}/api/files`, {
@@ -802,6 +803,15 @@ handleDragLeave(e) {
this.loadFiles(path);
},
+ // 返回上一级目录
+ navigateUp() {
+ if (this.currentPath === '/') return;
+ const parts = this.currentPath.split('/').filter(p => p !== '');
+ parts.pop();
+ const newPath = parts.length === 0 ? '/' : '/' + parts.join('/');
+ this.loadFiles(newPath);
+ },
+
downloadFile(file) {
console.log("[DEBUG] 下载文件:", file);
if (file.httpDownloadUrl) {
@@ -885,7 +895,7 @@ handleDragLeave(e) {
this.showToast('success', '成功', '文件夹创建成功');
this.showCreateFolderModal = false;
this.createFolderForm.folderName = '';
- await this.loadFiles(); // 刷新文件列表
+ await this.loadFiles(this.currentPath); // 刷新文件列表
}
} catch (error) {
console.error('[创建文件夹失败]', error);
@@ -895,7 +905,7 @@ handleDragLeave(e) {
confirmDeleteFile(file) {
const fileType = file.isDirectory ? '文件夹' : '文件';
- const warning = file.isDirectory ? "\n注意:只能删除空文件夹!" : "";
+ const warning = file.isDirectory ? "\n⚠️ 警告:文件夹内所有文件将被永久删除!" : "";
if (confirm(`确定要删除${fileType} "${file.name}" 吗?此操作无法撤销!${warning}`)) {
this.deleteFile(file);
}