fix: 修复文件夹功能的多个严重bug
问题修复:
1. 【文件夹无法重命名和删除】
- 原因: showFileContextMenu 函数中 `if (file.isDirectory) return` 阻止了文件夹显示右键菜单
- 修复: 移除这个限制,允许文件夹显示右键菜单
- 效果: 文件夹现在可以右键重命名和删除
2. 【进入文件夹后无法返回上一页】
- 原因: 页面没有路径导航条(面包屑导航)
- 修复: 在文件列表上方添加完整的路径导航组件
- 功能:
* 显示当前路径层级
* 点击路径中的任意层级可快速跳转
* "返回上一级"按钮
* "返回根目录"按钮
- 新增 navigateUp() 方法处理返回上一级
3. 【上传文件到子文件夹路径错误(undefined文件夹)】
- 原因: loadFiles() 调用时未传递 path 参数,导致 currentPath 变为 undefined
- 修复:
* loadFiles 开头添加安全检查: `this.currentPath = path || '/'`
* createFolder 成功后调用 loadFiles 时传递 currentPath
- 效果: 路径不会变成undefined,文件正确上传到当前目录
4. 【优化删除确认提示】
- 旧提示: "只能删除空文件夹"(错误信息)
- 新提示: "⚠️ 警告:文件夹内所有文件将被永久删除!"(准确描述行为)
技术改动:
- frontend/app.html: +15行 (路径导航条UI)
- frontend/app.js: +10行 (navigateUp方法 + 安全检查)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -662,6 +662,27 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 路径导航 (面包屑) -->
|
||||
<div v-if="currentPath !== '/'" style="margin-bottom: 15px; padding: 10px 15px; background: #f5f5f5; border-radius: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
||||
<button class="btn-icon" @click="loadFiles('/')" title="返回根目录" style="padding: 5px 10px;">
|
||||
<i class="fas fa-home"></i>
|
||||
</button>
|
||||
<span style="color: #999;">/</span>
|
||||
<template v-for="(part, index) in pathParts">
|
||||
<span v-if="index < pathParts.length - 1"
|
||||
@click="navigateToIndex(index)"
|
||||
style="color: #667eea; cursor: pointer; font-weight: 500;"
|
||||
:title="'进入 ' + part">
|
||||
{{ part }}
|
||||
</span>
|
||||
<span v-else style="color: #333; font-weight: 600;">{{ part }}</span>
|
||||
<span v-if="index < pathParts.length - 1" style="color: #999;">/</span>
|
||||
</template>
|
||||
<button class="btn-icon" @click="navigateUp()" title="返回上一级" style="margin-left: auto; padding: 5px 10px;">
|
||||
<i class="fas fa-level-up-alt"></i> 返回上一级
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<div style="margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
|
||||
Reference in New Issue
Block a user