diff --git a/app/Models/File.php b/app/Models/File.php
index 2c782f07d..0ae0d9a6f 100644
--- a/app/Models/File.php
+++ b/app/Models/File.php
@@ -230,13 +230,10 @@ class File extends AbstractModel
} else {
// 根目录:按板块拆分
$array = [];
- // 我的文件(mine 仅私有 share=0;all 含全部我的)
+ // 我的文件:我拥有的全部(含已共享出去的),mine 与 all 一致
if ($scope === 'mine' || $scope === 'all') {
$mine = File::wherePid(0)
->whereUserid($user->userid)
- ->when($scope === 'mine', function ($q) {
- $q->where('share', 0);
- })
->when($type == 'dir', function ($q) {
$q->whereType('folder');
})
diff --git a/resources/ai-kb/zh/menu-map/file/entry.md b/resources/ai-kb/zh/menu-map/file/entry.md
index 829a41e4d..03f4cad35 100644
--- a/resources/ai-kb/zh/menu-map/file/entry.md
+++ b/resources/ai-kb/zh/menu-map/file/entry.md
@@ -17,7 +17,7 @@ prerequisites: []
negative:
- 文件入口不在「应用」二级页面,是左侧栏一级菜单
- 移动端目前没有专门的「文件」Tabbar,需要从「更多」进
-last_verified: v1.8.64
+last_verified: v1.8.69
---
# 文件入口在哪
@@ -31,8 +31,9 @@ DooTask 的「文件」是一级导航,相当于个人网盘 + 团队共享盘
## 默认视图
- 顶部一行是板块 Tab:「我的文件」/「共享文件」,同一行最右是视图切换(宫格 / 列表),窄屏自动换行
-- 「我的文件」:自己创建的私有文件(未共享)
+- 「我的文件」:我拥有的全部文件(含已共享出去的,共享不会让它从这里消失)
- 「共享文件」:双向共享——包含「我共享出去的」和「别人共享给我的」,可用「全部 / 我共享的 / 共享给我的」二次筛选
+- 我共享出去的文件会同时出现在「我的文件」和「共享文件」两个板块
- 进入子文件夹后,Tab 下方出现面包屑路径(以板块名为起点,可点击回到板块根目录);根目录不显示重复标题
- 主区域列出当前文件夹下的文件与文件夹(最多 500 条,超出滚动加载)
- 板块选择会记住上次停留的 Tab
diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue
index 491235b6b..5c89e4c7a 100644
--- a/resources/assets/js/pages/manage/file.vue
+++ b/resources/assets/js/pages/manage/file.vue
@@ -41,12 +41,12 @@
{{$L('我的文件')}}
{{$L('共享文件')}}
+
{{$L('全部')}}
{{$L('我共享的')}}
{{$L('共享给我的')}}
-
@@ -896,13 +896,13 @@ export default {
if (file.pid != pid) {
return false;
}
- // 根目录按板块区分:我的=我的私有文件(share=0),共享=其余(双向共享)
+ // 根目录按板块区分:我的=我拥有的全部(含已共享),共享=其余(双向共享)
if (pid == 0) {
- const isMinePrivate = file.userid == userId && !file.share;
if (board === 'mine') {
- return isMinePrivate;
+ return file.userid == userId;
}
- if (isMinePrivate) {
+ // 共享板块:排除“我的私有”,即他人共享给我的 + 我共享出去的
+ if (file.userid == userId && !file.share) {
return false;
}
// 共享板块二次筛选:我共享的(我拥有) / 共享给我的(他人拥有)
@@ -1173,6 +1173,7 @@ export default {
return;
}
this.loadIng++;
+ // 按当前板块拉取(拉多少缓存多少);已有缓存时 fileList 会先渲染缓存,接口回来再静态刷新
this.$store.dispatch("getFiles", {pid: this.pid, scope: this.board}).then(async () => {
this.loadIng--;
this.openFileJudge()
@@ -1513,9 +1514,10 @@ export default {
this.selectedItems = [];
this.clearShear();
if (this.pid > 0) {
- // 退回板块根目录,由 pid 变化触发重载
+ // 从子目录切板块时退回根目录(pid 变化触发加载)
this.browseFolder(0);
} else {
+ // 已在根目录:先由 fileList 渲染本板块缓存,再拉接口静态刷新
this.getFileList();
}
},
diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js
index 716a1862d..a18c08dd3 100644
--- a/resources/assets/js/store/actions.js
+++ b/resources/assets/js/store/actions.js
@@ -1500,7 +1500,28 @@ export default {
data: scope ? {pid, scope} : {pid},
}).then((result) => {
const ids = result.data.map(({id}) => id)
- commit("file/save", state.fileLists.filter((item) => item.pid != pid || ids.includes(item.id)));
+ const myId = state.userId
+ // 静态刷新:仅清理"本次拉取该管、但结果里已没有"的过期行,按 scope 限定清理范围,
+ // 避免刷新一个板块把另一个板块(同为 pid=0 根目录)的缓存误删
+ commit("file/save", state.fileLists.filter((item) => {
+ if (item.pid != pid) {
+ return true // 其他目录:保留缓存
+ }
+ if (ids.includes(item.id)) {
+ return true // 本次结果内:保留(随后 saveFile 覆盖更新)
+ }
+ if (pid > 0) {
+ return false // 子目录内容归本次拉取管:清理过期
+ }
+ // 根目录:仅清理本板块 scope 归属的过期行
+ if (scope === 'mine') {
+ return item.userid != myId // 保留"别人共享给我的"
+ }
+ if (scope === 'shared') {
+ return !(item.userid != myId || item.share) // 保留"我的私有"
+ }
+ return false // scope=all 或未指定:清理全部过期(原行为)
+ }));
//
dispatch("saveFile", result.data);
resolve(result)
diff --git a/resources/assets/sass/pages/page-file.scss b/resources/assets/sass/pages/page-file.scss
index fd9de13fd..291e6ab8c 100644
--- a/resources/assets/sass/pages/page-file.scss
+++ b/resources/assets/sass/pages/page-file.scss
@@ -123,7 +123,7 @@
align-items: center;
gap: 8px;
> span {
- font-size: 12.5px;
+ font-size: 12px;
color: $primary-text-color;
padding: 3px 12px;
border-radius: 14px;
@@ -202,7 +202,7 @@
align-items: center;
height: 24px;
line-height: 24px;
- margin: 0 32px 0;
+ margin: 8px 32px 0;
> ul {
display: flex;
align-items: center;
@@ -811,7 +811,7 @@ body.window-portrait {
}
}
.file-navigator {
- margin: 0 16px 0;
+ margin: 4px 16px 0;
.flex-full {
margin-right: 10px;
}