Merge pull request #95 from jamebal/dev

perf: 优化收藏页和标签页的右键菜单
This commit is contained in:
jmal 2024-05-16 18:16:21 +08:00 committed by GitHub
commit 1ee311a8d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 56 additions and 10 deletions

View File

@ -19,7 +19,7 @@
></svg-icon> ></svg-icon>
{{ item.label }} {{ item.label }}
</v-contextmenu-item> </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"> <div v-for="itemSecond of item.child" :key="itemSecond.operation">
<v-contextmenu-item <v-contextmenu-item
@ -2268,7 +2268,9 @@ export default {
goBack() { goBack() {
if (this.pathList.length <= 1) { if (this.pathList.length <= 1) {
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' 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; return;
} }
this.lastLink(); this.lastLink();
@ -2309,10 +2311,12 @@ export default {
if (!unPushLink) { if (!unPushLink) {
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' 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) { 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 { } 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) { if (!unRefresh) {
@ -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() { newDocument() {
window.open(`/setting/website/manager-articles?operation=new`, "_blank"); window.open(`/setting/website/manager-articles?operation=new`, "_blank");
@ -2541,7 +2552,9 @@ export default {
} }
this.editingIndex = -1; this.editingIndex = -1;
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' 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(); this.rowDrop();
// 画矩形选取 // 画矩形选取
@ -2713,9 +2726,10 @@ export default {
this.pathList.push(item1); this.pathList.push(item1);
} }
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
const basePath = this.getBasePath()
const keyword = key ? `&keyword=${key}` : '' const keyword = key ? `&keyword=${key}` : ''
const path = this.path ? encodeURI(this.path) : "/"; 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({ api.searchFile({
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
username: this.$store.state.user.name, username: this.$store.state.user.name,
@ -4049,6 +4063,7 @@ export default {
if (row.isFolder) { if (row.isFolder) {
this.editingIndex = -1; this.editingIndex = -1;
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' 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) { if (this.listModeSearch) {
const item = {}; const item = {};
@ -4057,9 +4072,8 @@ export default {
item["row"] = row; item["row"] = row;
this.pathList.push(item); this.pathList.push(item);
this.pagination.pageIndex = 1; this.pagination.pageIndex = 1;
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
const folder = row.id ? `&folder=${row.id}` : '' 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); this.searchFileAndOpenDir(row);
} else { } else {
let notHomePage = this.$route.path.length > 1 let notHomePage = this.$route.path.length > 1
@ -4083,7 +4097,8 @@ export default {
if (row.mountFileId) { if (row.mountFileId) {
localStorage.setItem(this.path, 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); this.openDir(row);
} }
} else { } else {

View File

@ -11,6 +11,7 @@
:singleMenusEdit="singleMenusEdit" :singleMenusEdit="singleMenusEdit"
:multipleMenus="multipleMenus" :multipleMenus="multipleMenus"
:multipleRightMenus="multipleRightMenus" :multipleRightMenus="multipleRightMenus"
:contextMenus="contextMenus"
> >
</show-file> </show-file>
</div> </div>
@ -29,6 +30,35 @@
queryCondition: { queryCondition: {
isFavorite: true 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: [ singleMenus: [
{ iconClass: 'menu-open', label: '打开', operation: 'open' }, { iconClass: 'menu-open', label: '打开', operation: 'open' },
{ iconClass: 'share', label: '分享', operation: 'share' }, { iconClass: 'share', label: '分享', operation: 'share' },

View File

@ -29,6 +29,7 @@ export default {
{ label: '查看', operation: 'viewMode' ,child: [ { label: '查看', operation: 'viewMode' ,child: [
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'}, { iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'}, { iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
{ label: '显示文件夹大小', operation: 'show-folder-size'},
] ]
}, },
{ label: '排列方式', operation: 'arrangement' ,child: [ { label: '排列方式', operation: 'arrangement' ,child: [
@ -39,7 +40,7 @@ export default {
}, },
{ label: '刷新', operation: 'refresh'}, { label: '刷新', operation: 'refresh'},
{ divider: true, operation: 'divider' }, { divider: true, operation: 'divider' },
{ label: '新建', operation: 'create' ,child: [ { label: '新建', operation: 'create' , homeDisable: true, child: [
{ label: '文件夹', operation: 'createFolder', iconClass: 'folder'}, { label: '文件夹', operation: 'createFolder', iconClass: 'folder'},
{ divider: true, operation: 'divider' }, { divider: true, operation: 'divider' },
{ label: '文本', operation: 'createTextFile', iconClass: 'file-txt'}, { label: '文本', operation: 'createTextFile', iconClass: 'file-txt'},