Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 优化收藏页和标签页的右键菜单 #95

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions src/components/ShowFile/ShowFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
></svg-icon>
{{ item.label }}
</v-contextmenu-item>
<v-contextmenu-submenu v-if="item.child" :title="item.label">
<v-contextmenu-submenu v-if="item.child" :disabled="item.homeDisable && (!path || path.length < 2)" :title="item.label">
<!-- 二级菜单 -->
<div v-for="itemSecond of item.child" :key="itemSecond.operation">
<v-contextmenu-item
Expand Down Expand Up @@ -2268,7 +2268,9 @@ export default {
goBack() {
if (this.pathList.length <= 1) {
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
this.$router.push(`/?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryTagId}`);
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
const basePath = this.getBasePath()
this.$router.push(`/?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryTagId}${basePath}${keyword}`);
return;
}
this.lastLink();
Expand Down Expand Up @@ -2309,10 +2311,12 @@ export default {

if (!unPushLink) {
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
const basePath = this.getBasePath()
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
if (!this.$route.query.path) {
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}`);
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keyword}`);
} else {
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}`);
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keyword}`);
}
}
if (!unRefresh) {
Expand All @@ -2321,6 +2325,13 @@ export default {
}
}
},
getBasePath() {
let basePath = this.$route.query.basePath ? `&basePath=${this.$route.query.basePath}` : ''
if (!this.path || this.path.length < 2) {
return ''
}
return basePath
},
// 新建文档
newDocument() {
window.open(`/setting/website/manager-articles?operation=new`, "_blank");
Expand Down Expand Up @@ -2541,7 +2552,9 @@ export default {
}
this.editingIndex = -1;
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
this.$router.push(`?vmode=${this.vmode}&path=${this.path}${this.$route.query.folder ? '&folder='+this.$route.query.folder : ''}${queryTagId}`);
const basePath = this.getBasePath()
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
this.$router.push(`?vmode=${this.vmode}&path=${this.path}${this.$route.query.folder ? '&folder='+this.$route.query.folder : ''}${queryTagId}${basePath}${keyword}`);
// 改变拖拽目标
this.rowDrop();
// 画矩形选取
Expand Down Expand Up @@ -2713,9 +2726,10 @@ export default {
this.pathList.push(item1);
}
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
const basePath = this.getBasePath()
const keyword = key ? `&keyword=${key}` : ''
const path = this.path ? encodeURI(this.path) : "/";
this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}`);
this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}`);
api.searchFile({
userId: this.$store.state.user.userId,
username: this.$store.state.user.name,
Expand Down Expand Up @@ -4049,6 +4063,7 @@ export default {
if (row.isFolder) {
this.editingIndex = -1;
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
// 打开文件夹
if (this.listModeSearch) {
const item = {};
Expand All @@ -4057,9 +4072,8 @@ export default {
item["row"] = row;
this.pathList.push(item);
this.pagination.pageIndex = 1;
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
const folder = row.id ? `&folder=${row.id}` : ''
this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}`);
this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}${basePath}`);
this.searchFileAndOpenDir(row);
} else {
let notHomePage = this.$route.path.length > 1
Expand All @@ -4083,7 +4097,8 @@ export default {
if (row.mountFileId) {
localStorage.setItem(this.path, row.mountFileId)
}
this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${this.basePath.length > 1 ? '&basePath='+this.basePath : ''}`);
const basePath = this.basePath.length > 1 ? '&basePath='+this.basePath : ''
this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`);
this.openDir(row);
}
} else {
Expand Down
30 changes: 30 additions & 0 deletions src/views/favorite/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:singleMenusEdit="singleMenusEdit"
:multipleMenus="multipleMenus"
:multipleRightMenus="multipleRightMenus"
:contextMenus="contextMenus"
>
</show-file>
</div>
Expand All @@ -29,6 +30,35 @@
queryCondition: {
isFavorite: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
{ label: '显示文件夹大小', operation: 'show-folder-size'},
]
},
{ label: '排列方式', operation: 'arrangement' ,child: [
{ label: '名称', operation: 'orderName', orderProp: 'name'},
{ label: '大小', operation: 'orderSize', orderProp: 'size'},
{ label: '日期', operation: 'orderUpdateDate', orderProp: 'updateDate'},
]
},
{ label: '刷新', operation: 'refresh'},
{ divider: true, operation: 'divider' },
{ label: '新建', operation: 'create' , homeDisable: true ,child: [
{ label: '文件夹', operation: 'createFolder', iconClass: 'folder'},
{ divider: true, operation: 'divider' },
{ label: '文本', operation: 'createTextFile', iconClass: 'file-txt'},
{ label: '思维导图', operation: 'createMinderFile', iconClass: 'file-mind'},
{ label: '流程图', operation: 'createDrawioFile', iconClass: 'file-drawio'},
{ label: 'Word', operation: 'createWordFile', iconClass: 'file-word'},
{ label: 'Excel', operation: 'createExcelFile', iconClass: 'file-excel'},
{ label: 'PPT', operation: 'createPPTFile', iconClass: 'file-ppt'},
]
},
{ divider: true, operation: 'divider' },
{ label: '写文章', operation: 'createMarkdownFile'},
],
singleMenus: [
{ iconClass: 'menu-open', label: '打开', operation: 'open' },
{ iconClass: 'share', label: '分享', operation: 'share' },
Expand Down
3 changes: 2 additions & 1 deletion src/views/tag/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
{ label: '查看', operation: 'viewMode' ,child: [
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
{ label: '显示文件夹大小', operation: 'show-folder-size'},
]
},
{ label: '排列方式', operation: 'arrangement' ,child: [
Expand All @@ -39,7 +40,7 @@ export default {
},
{ label: '刷新', operation: 'refresh'},
{ divider: true, operation: 'divider' },
{ label: '新建', operation: 'create' ,child: [
{ label: '新建', operation: 'create' , homeDisable: true, child: [
{ label: '文件夹', operation: 'createFolder', iconClass: 'folder'},
{ divider: true, operation: 'divider' },
{ label: '文本', operation: 'createTextFile', iconClass: 'file-txt'},
Expand Down