Skip to content

Commit 1ee311a

Browse files
authored
Merge pull request #95 from jamebal/dev
perf: 优化收藏页和标签页的右键菜单
2 parents 1d979b9 + 8fed254 commit 1ee311a

File tree

3 files changed

+56
-10
lines changed

3 files changed

+56
-10
lines changed

src/components/ShowFile/ShowFile.vue

+24-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
></svg-icon>
2020
{{ item.label }}
2121
</v-contextmenu-item>
22-
<v-contextmenu-submenu v-if="item.child" :title="item.label">
22+
<v-contextmenu-submenu v-if="item.child" :disabled="item.homeDisable && (!path || path.length < 2)" :title="item.label">
2323
<!-- 二级菜单 -->
2424
<div v-for="itemSecond of item.child" :key="itemSecond.operation">
2525
<v-contextmenu-item
@@ -2268,7 +2268,9 @@ export default {
22682268
goBack() {
22692269
if (this.pathList.length <= 1) {
22702270
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
2271-
this.$router.push(`/?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryTagId}`);
2271+
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
2272+
const basePath = this.getBasePath()
2273+
this.$router.push(`/?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryTagId}${basePath}${keyword}`);
22722274
return;
22732275
}
22742276
this.lastLink();
@@ -2309,10 +2311,12 @@ export default {
23092311
23102312
if (!unPushLink) {
23112313
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
2314+
const basePath = this.getBasePath()
2315+
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
23122316
if (!this.$route.query.path) {
2313-
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}`);
2317+
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keyword}`);
23142318
} else {
2315-
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}`);
2319+
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keyword}`);
23162320
}
23172321
}
23182322
if (!unRefresh) {
@@ -2321,6 +2325,13 @@ export default {
23212325
}
23222326
}
23232327
},
2328+
getBasePath() {
2329+
let basePath = this.$route.query.basePath ? `&basePath=${this.$route.query.basePath}` : ''
2330+
if (!this.path || this.path.length < 2) {
2331+
return ''
2332+
}
2333+
return basePath
2334+
},
23242335
// 新建文档
23252336
newDocument() {
23262337
window.open(`/setting/website/manager-articles?operation=new`, "_blank");
@@ -2541,7 +2552,9 @@ export default {
25412552
}
25422553
this.editingIndex = -1;
25432554
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
2544-
this.$router.push(`?vmode=${this.vmode}&path=${this.path}${this.$route.query.folder ? '&folder='+this.$route.query.folder : ''}${queryTagId}`);
2555+
const basePath = this.getBasePath()
2556+
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
2557+
this.$router.push(`?vmode=${this.vmode}&path=${this.path}${this.$route.query.folder ? '&folder='+this.$route.query.folder : ''}${queryTagId}${basePath}${keyword}`);
25452558
// 改变拖拽目标
25462559
this.rowDrop();
25472560
// 画矩形选取
@@ -2713,9 +2726,10 @@ export default {
27132726
this.pathList.push(item1);
27142727
}
27152728
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
2729+
const basePath = this.getBasePath()
27162730
const keyword = key ? `&keyword=${key}` : ''
27172731
const path = this.path ? encodeURI(this.path) : "/";
2718-
this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}`);
2732+
this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}`);
27192733
api.searchFile({
27202734
userId: this.$store.state.user.userId,
27212735
username: this.$store.state.user.name,
@@ -4049,6 +4063,7 @@ export default {
40494063
if (row.isFolder) {
40504064
this.editingIndex = -1;
40514065
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
4066+
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
40524067
// 打开文件夹
40534068
if (this.listModeSearch) {
40544069
const item = {};
@@ -4057,9 +4072,8 @@ export default {
40574072
item["row"] = row;
40584073
this.pathList.push(item);
40594074
this.pagination.pageIndex = 1;
4060-
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
40614075
const folder = row.id ? `&folder=${row.id}` : ''
4062-
this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}`);
4076+
this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}${basePath}`);
40634077
this.searchFileAndOpenDir(row);
40644078
} else {
40654079
let notHomePage = this.$route.path.length > 1
@@ -4083,7 +4097,8 @@ export default {
40834097
if (row.mountFileId) {
40844098
localStorage.setItem(this.path, row.mountFileId)
40854099
}
4086-
this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${this.basePath.length > 1 ? '&basePath='+this.basePath : ''}`);
4100+
const basePath = this.basePath.length > 1 ? '&basePath='+this.basePath : ''
4101+
this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`);
40874102
this.openDir(row);
40884103
}
40894104
} else {

src/views/favorite/index.vue

+30
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
:singleMenusEdit="singleMenusEdit"
1212
:multipleMenus="multipleMenus"
1313
:multipleRightMenus="multipleRightMenus"
14+
:contextMenus="contextMenus"
1415
>
1516
</show-file>
1617
</div>
@@ -29,6 +30,35 @@
2930
queryCondition: {
3031
isFavorite: true
3132
},
33+
contextMenus: [
34+
{ label: '查看', operation: 'viewMode' ,child: [
35+
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
36+
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
37+
{ label: '显示文件夹大小', operation: 'show-folder-size'},
38+
]
39+
},
40+
{ label: '排列方式', operation: 'arrangement' ,child: [
41+
{ label: '名称', operation: 'orderName', orderProp: 'name'},
42+
{ label: '大小', operation: 'orderSize', orderProp: 'size'},
43+
{ label: '日期', operation: 'orderUpdateDate', orderProp: 'updateDate'},
44+
]
45+
},
46+
{ label: '刷新', operation: 'refresh'},
47+
{ divider: true, operation: 'divider' },
48+
{ label: '新建', operation: 'create' , homeDisable: true ,child: [
49+
{ label: '文件夹', operation: 'createFolder', iconClass: 'folder'},
50+
{ divider: true, operation: 'divider' },
51+
{ label: '文本', operation: 'createTextFile', iconClass: 'file-txt'},
52+
{ label: '思维导图', operation: 'createMinderFile', iconClass: 'file-mind'},
53+
{ label: '流程图', operation: 'createDrawioFile', iconClass: 'file-drawio'},
54+
{ label: 'Word', operation: 'createWordFile', iconClass: 'file-word'},
55+
{ label: 'Excel', operation: 'createExcelFile', iconClass: 'file-excel'},
56+
{ label: 'PPT', operation: 'createPPTFile', iconClass: 'file-ppt'},
57+
]
58+
},
59+
{ divider: true, operation: 'divider' },
60+
{ label: '写文章', operation: 'createMarkdownFile'},
61+
],
3262
singleMenus: [
3363
{ iconClass: 'menu-open', label: '打开', operation: 'open' },
3464
{ iconClass: 'share', label: '分享', operation: 'share' },

src/views/tag/index.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default {
2929
{ label: '查看', operation: 'viewMode' ,child: [
3030
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
3131
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
32+
{ label: '显示文件夹大小', operation: 'show-folder-size'},
3233
]
3334
},
3435
{ label: '排列方式', operation: 'arrangement' ,child: [
@@ -39,7 +40,7 @@ export default {
3940
},
4041
{ label: '刷新', operation: 'refresh'},
4142
{ divider: true, operation: 'divider' },
42-
{ label: '新建', operation: 'create' ,child: [
43+
{ label: '新建', operation: 'create' , homeDisable: true, child: [
4344
{ label: '文件夹', operation: 'createFolder', iconClass: 'folder'},
4445
{ divider: true, operation: 'divider' },
4546
{ label: '文本', operation: 'createTextFile', iconClass: 'file-txt'},

0 commit comments

Comments
 (0)