perf: 优化收藏页右键菜单
This commit is contained in:
parent
9a52cbd0f6
commit
c4aa8eb2db
@ -1324,7 +1324,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.$route.query.folder && this.path) {
|
if (this.$route.query.folder && this.path && !this.$route.query.keyword) {
|
||||||
localStorage.setItem(this.path, this.$route.query.folder)
|
localStorage.setItem(this.path, this.$route.query.folder)
|
||||||
}
|
}
|
||||||
if (this.$route.query.highlight) {
|
if (this.$route.query.highlight) {
|
||||||
@ -2297,6 +2297,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleLink(item, index, unPushLink, unRefresh, keywordQuery) {
|
handleLink(item, index, unPushLink, unRefresh, keywordQuery) {
|
||||||
this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1))
|
this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1))
|
||||||
|
console.log('handleLink', item)
|
||||||
if (item && item.search) {
|
if (item && item.search) {
|
||||||
if (item.searchKey) {
|
if (item.searchKey) {
|
||||||
this.searchFileByKeyword(item.searchKey);
|
this.searchFileByKeyword(item.searchKey);
|
||||||
@ -2313,8 +2314,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.path = this.path.replace(/\\/g, "/");
|
this.path = this.path.replace(/\\/g, "/");
|
||||||
})
|
})
|
||||||
let queryFolder = localStorage.getItem(this.path)
|
let queryFolder = localStorage.getItem("mountFileOwner") ? localStorage.getItem(this.path) : this.$route.query.folder
|
||||||
|
|
||||||
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 basePath = this.getBasePath()
|
||||||
@ -2773,6 +2773,14 @@ export default {
|
|||||||
},
|
},
|
||||||
searchFileAndOpenDir(fileId, onLoad) {
|
searchFileAndOpenDir(fileId, onLoad) {
|
||||||
this.beforeLoadData(onLoad);
|
this.beforeLoadData(onLoad);
|
||||||
|
|
||||||
|
const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : ''
|
||||||
|
const path = this.$route.query.path ? `&path=${this.$route.query.path}` : ''
|
||||||
|
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
|
||||||
|
const basePath = this.getBasePath()
|
||||||
|
const folder = `&folder=${fileId}`
|
||||||
|
this.$router.push(`?vmode=${this.vmode}${path}${keyword}${queryTagId}${basePath}${folder}`)
|
||||||
|
|
||||||
api.searchFileAndOpenDir({
|
api.searchFileAndOpenDir({
|
||||||
userId: this.$store.state.user.userId,
|
userId: this.$store.state.user.userId,
|
||||||
username: this.$store.getters.name,
|
username: this.$store.getters.name,
|
||||||
@ -3102,7 +3110,7 @@ export default {
|
|||||||
this.rowContextData = row;
|
this.rowContextData = row;
|
||||||
}
|
}
|
||||||
const isFavorite = this.rowContextData.isFavorite;
|
const isFavorite = this.rowContextData.isFavorite;
|
||||||
this.highlightFavorite(this.isCollectView ? true : isFavorite, false);
|
this.highlightFavorite(isFavorite, false);
|
||||||
},
|
},
|
||||||
// 单元格hover进入时事件
|
// 单元格hover进入时事件
|
||||||
cellMouseEnter(row) {
|
cellMouseEnter(row) {
|
||||||
@ -3356,7 +3364,7 @@ export default {
|
|||||||
) {
|
) {
|
||||||
this.menusIsMultiple = true;
|
this.menusIsMultiple = true;
|
||||||
this.menus = this.multipleRightMenus;
|
this.menus = this.multipleRightMenus;
|
||||||
this.highlightFavorite(this.isCollectView, false);
|
this.highlightFavorite(false, false);
|
||||||
} else {
|
} else {
|
||||||
this.$refs.fileListTable.clearSelection();
|
this.$refs.fileListTable.clearSelection();
|
||||||
this.$refs.fileListTable.toggleRowSelection([{ row: row }]);
|
this.$refs.fileListTable.toggleRowSelection([{ row: row }]);
|
||||||
@ -3394,10 +3402,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
menuFavoriteOver(index, isFavorite) {
|
menuFavoriteOver(index, isFavorite) {
|
||||||
this.highlightFavorite(this.isCollectView ? true : isFavorite, false);
|
this.highlightFavorite(isFavorite, false);
|
||||||
},
|
},
|
||||||
menuFavoriteLeave(index, isFavorite) {
|
menuFavoriteLeave(index, isFavorite) {
|
||||||
this.highlightFavorite(this.isCollectView ? true : isFavorite, false);
|
this.highlightFavorite(isFavorite, false);
|
||||||
},
|
},
|
||||||
// 是否高亮收藏图标
|
// 是否高亮收藏图标
|
||||||
highlightFavorite(isFavorite, isHover) {
|
highlightFavorite(isFavorite, isHover) {
|
||||||
@ -3911,19 +3919,17 @@ export default {
|
|||||||
const fileIds = this.getSelectIdList();
|
const fileIds = this.getSelectIdList();
|
||||||
this.rowContextData.isFavorite = isFavorite;
|
this.rowContextData.isFavorite = isFavorite;
|
||||||
this.highlightFavorite(isFavorite, true);
|
this.highlightFavorite(isFavorite, true);
|
||||||
api
|
api.favoriteUrl({
|
||||||
.favoriteUrl({
|
|
||||||
fileIds: fileIds,
|
fileIds: fileIds,
|
||||||
isFavorite: isFavorite
|
isFavorite: isFavorite
|
||||||
})
|
}).then(() => {
|
||||||
.then(res => {
|
|
||||||
// 收藏页面
|
// 收藏页面
|
||||||
if (!isFavorite && this.isCollectView) {
|
const homePage = !this.$route.query.path || this.$route.query.length <= 1
|
||||||
|
if (!isFavorite && this.isCollectView && homePage) {
|
||||||
// 移除列表
|
// 移除列表
|
||||||
this.removeSelectItme();
|
this.removeSelectItme();
|
||||||
}
|
}
|
||||||
})
|
}).catch(() => {
|
||||||
.catch(() => {
|
|
||||||
this.rowContextData.isFavorite = !isFavorite;
|
this.rowContextData.isFavorite = !isFavorite;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -4118,8 +4124,8 @@ export default {
|
|||||||
if (row.mountFileId) {
|
if (row.mountFileId) {
|
||||||
localStorage.setItem(this.path, row.mountFileId)
|
localStorage.setItem(this.path, row.mountFileId)
|
||||||
}
|
}
|
||||||
const basePath = this.basePath ? `&basePath=${this.basePath}` : ''
|
const basePath = this.basePath && this.basePath.length > 1 ? `&basePath=${this.basePath}` : ''
|
||||||
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(path)}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`);
|
this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`);
|
||||||
this.openDir(row);
|
this.openDir(row);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -7,10 +7,6 @@
|
|||||||
:orderCustom="true"
|
:orderCustom="true"
|
||||||
:defaultSort="sortable"
|
:defaultSort="sortable"
|
||||||
:queryCondition="queryCondition"
|
:queryCondition="queryCondition"
|
||||||
:singleMenus="singleMenus"
|
|
||||||
:singleMenusEdit="singleMenusEdit"
|
|
||||||
:multipleMenus="multipleMenus"
|
|
||||||
:multipleRightMenus="multipleRightMenus"
|
|
||||||
:contextMenus="contextMenus"
|
:contextMenus="contextMenus"
|
||||||
>
|
>
|
||||||
</show-file>
|
</show-file>
|
||||||
@ -45,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
{ label: '刷新', operation: 'refresh'},
|
{ label: '刷新', operation: 'refresh'},
|
||||||
{ divider: true, operation: 'divider' },
|
{ divider: true, operation: 'divider' },
|
||||||
{ label: '新建', operation: 'create' , homeDisable: true ,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'},
|
||||||
@ -58,35 +54,7 @@
|
|||||||
},
|
},
|
||||||
{ divider: true, operation: 'divider' },
|
{ divider: true, operation: 'divider' },
|
||||||
{ label: '写文章', operation: 'createMarkdownFile'},
|
{ label: '写文章', operation: 'createMarkdownFile'},
|
||||||
],
|
]
|
||||||
singleMenus: [
|
|
||||||
{ iconClass: 'menu-open', label: '打开', operation: 'open' },
|
|
||||||
{ iconClass: 'share', label: '分享', operation: 'share' },
|
|
||||||
{ iconClass: 'menu-favorite', label: '收藏', operation: 'favorite' },
|
|
||||||
{ iconClass: 'menu-details', label: '详细信息', operation: 'details' },
|
|
||||||
{ iconClass: 'menu-rename', label: '重命名', operation: 'rename' },
|
|
||||||
{ iconClass: 'menu-copy', label: '移动或复制', operation: 'copy' },
|
|
||||||
{ iconClass: 'menu-download', label: '下载', operation: 'download' },
|
|
||||||
// { iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' }
|
|
||||||
],
|
|
||||||
singleMenusEdit: [
|
|
||||||
{ iconClass: 'menu-open', label: '打开', operation: 'open' },
|
|
||||||
{ iconClass: 'share', label: '分享', operation: 'share' },
|
|
||||||
{ iconClass: 'menu-favorite', label: '收藏', operation: 'favorite' },
|
|
||||||
{ iconClass: 'menu-edit1', label: '编辑', operation: 'edit' },
|
|
||||||
{ iconClass: 'menu-details', label: '详细信息', operation: 'details' },
|
|
||||||
{ iconClass: 'menu-rename', label: '重命名', operation: 'rename' },
|
|
||||||
{ iconClass: 'menu-download', label: '下载', operation: 'download' },
|
|
||||||
// { iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' }
|
|
||||||
],
|
|
||||||
multipleMenus: [
|
|
||||||
{ iconClass: 'menu-download', label: '下载', operation: 'download' },
|
|
||||||
{ iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' }
|
|
||||||
],
|
|
||||||
multipleRightMenus: [
|
|
||||||
{ iconClass: 'menu-download', label: '下载', operation: 'download' },
|
|
||||||
{ iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user