Merge branch 'refs/heads/master' into chore

This commit is contained in:
jmal 2024-05-22 15:20:23 +08:00
commit 5ac727c56d
5 changed files with 217 additions and 164 deletions

View File

@ -158,7 +158,9 @@
:clearable="true" :clearable="true"
@keyup.enter.native="searchFile(searchFileName)" @keyup.enter.native="searchFile(searchFileName)"
@focus="setInputFocus" @focus="setInputFocus"
@input="searchFile(searchFileName)"
@blur="setInputBlur()" @blur="setInputBlur()"
@clear="searchFile(searchFileName)"
> >
<el-button slot="prepend" @click="searchFile(searchFileName)"> <el-button slot="prepend" @click="searchFile(searchFileName)">
<svg-icon icon-class="search" style="font-size: 22px" /> <svg-icon icon-class="search" style="font-size: 22px" />
@ -239,12 +241,9 @@
<div> <div>
<!--统计信息--> <!--统计信息-->
<div class="info-statistics"> <div class="info-statistics">
<span v-if="listModeSearch">{{this.pagination["total"]}}个结果:&nbsp;</span>
<span v-if="tableLoading">获取更多数据...</span> <span v-if="tableLoading">获取更多数据...</span>
<span v-if="!tableLoading">{{ <span v-if="!tableLoading">{{ !finished ? "已加载 " + getSummaries3 : "已全部加载 " + getSummaries3 }}</span>
!finished
? "已加载 " + getSummaries3
: "已全部加载 " + getSummaries3
}}</span>
</div> </div>
</div> </div>
@ -1324,13 +1323,25 @@ 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) {
this.onCreateFilename = this.$route.query.highlight this.onCreateFilename = this.$route.query.highlight
this.clearOnCreateFilename() this.clearOnCreateFilename()
} }
// remove query.basePath
if (this.$route.query.basePath) {
this.basePath = this.$route.query.basePath
}
// remove query.folder
if (this.$route.query.folder && this.$route.query.keyword) {
const query = { ...this.$route.query };
delete query.folder;
this.$router.replace({ query });
}
let that = this; let that = this;
window.onresize = function() { window.onresize = function() {
that.clientHeight = that.clientHeight =
@ -2276,27 +2287,22 @@ export default {
this.lastLink(); this.lastLink();
}, },
lastLink() { lastLink() {
this.handleLink( let keywordQuery = ''
this.pathList[this.pathList.length - 2], const searchPathIndex = this.pathList.findIndex(item => item.search)
this.pathList.length - 2 if (searchPathIndex === this.pathList.length - 1) {
) keywordQuery = '&keyword='
}
this.handleLink(this.pathList[this.pathList.length - 2],this.pathList.length - 2, undefined, undefined, keywordQuery)
}, },
handleLink(item, index, unPushLink, unRefresh) { handleLink(item, index, unPushLink, unRefresh, keywordQuery) {
this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1))
if (item && item.search) { if (item && item.search) {
if (item.searchKey) { if (item.searchKey) {
this.searchFileByKeyWord(item.searchKey); this.searchFileByKeyword(item.searchKey);
} else if (item.row) { } else if (item.row) {
this.searchFileAndOpenDir(item.row); this.searchFileAndOpenDir(item.row.id);
} }
this.pathList.splice(
this.pathList.findIndex((v, i) => i === index + 1),
this.pathList.length - (index + 1)
);
} else { } else {
this.pathList.splice(
this.pathList.findIndex((v, i) => i === index + 1),
this.pathList.length - (index + 1)
);
this.pathList.forEach((p, number) => { this.pathList.forEach((p, number) => {
if (number === 0) { if (number === 0) {
this.path = ""; this.path = "";
@ -2306,18 +2312,20 @@ export default {
} }
this.path = this.path.replace(/\\/g, "/"); this.path = this.path.replace(/\\/g, "/");
}) })
let queryFolder = localStorage.getItem("mountFileOwner") ? localStorage.getItem(this.path) : this.$route.query.folder
let queryFolder = localStorage.getItem(this.path)
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()
const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' if (keywordQuery !=='&keyword=') {
if (!this.$route.query.path) { keywordQuery = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
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}${basePath}${keyword}`); keywordQuery = ''
} }
const searchPathIndex = this.pathList.findIndex(item => item.search)
if (searchPathIndex < 0) {
keywordQuery = ''
}
this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keywordQuery}`);
} }
if (!unRefresh) { if (!unRefresh) {
this.pagination.pageIndex = 1; this.pagination.pageIndex = 1;
@ -2328,6 +2336,7 @@ export default {
getBasePath() { getBasePath() {
let basePath = this.$route.query.basePath ? `&basePath=${this.$route.query.basePath}` : '' let basePath = this.$route.query.basePath ? `&basePath=${this.$route.query.basePath}` : ''
if (!this.path || this.path.length < 2) { if (!this.path || this.path.length < 2) {
this.basePath = '/'
return '' return ''
} }
return basePath return basePath
@ -2495,15 +2504,13 @@ export default {
} }
} }
let suffix = newFileName.substring(newFileName.lastIndexOf(".") + 1); let suffix = newFileName.substring(newFileName.lastIndexOf(".") + 1);
api api.addFile({
.addFile({
fileName: encodeURI(newFileName), fileName: encodeURI(newFileName),
isFolder: false, isFolder: false,
folder: this.$route.query.folder, folder: this.$route.query.folder,
username: this.$store.state.user.name, username: this.$store.state.user.name,
parentPath: encodeURI(parentPath) parentPath: encodeURI(parentPath)
}) }).then(res => {
.then(res => {
this.createFileLoading = false; this.createFileLoading = false;
switch (suffix && !this.$route.query.folder) { switch (suffix && !this.$route.query.folder) {
case "txt": case "txt":
@ -2525,13 +2532,12 @@ export default {
setTimeout(function() { setTimeout(function() {
that.newCreateFileDialog = false; that.newCreateFileDialog = false;
}, 200) }, 200)
}) }).catch(() => {
.catch(() => {
this.createFileLoading = false; this.createFileLoading = false;
}); });
} }
}, },
searchFileByKeyWord(key) { searchFileByKeyword(key) {
this.searchFile(key); this.searchFile(key);
}, },
// 切换布局 // 切换布局
@ -2678,6 +2684,13 @@ export default {
storageType = 'File' storageType = 'File'
} }
} }
const path = this.$route.query.path ? this.$route.query.path : '/'
const basePath = this.$route.query.basePath ? this.$route.query.basePath : '/'
this.path = basePath + path
this.path = this.path.replace(/\\/g, '/')
this.path = this.path.replace(/\/\//g, '/')
this.$store.dispatch('updateMessage', {event: 'storageTypeChange', data: storageType}) this.$store.dispatch('updateMessage', {event: 'storageTypeChange', data: storageType})
}, },
// 设置挂载文件的用户名(文件的所有者) // 设置挂载文件的用户名(文件的所有者)
@ -2697,7 +2710,7 @@ export default {
if (this.onCreateFilename) { if (this.onCreateFilename) {
let index = this.fileList.findIndex(item => item.name === this.onCreateFilename); let index = this.fileList.findIndex(item => item.name === this.onCreateFilename);
if (index > -1) { if (index > -1) {
let row = this.fileList[index]; let row = this.fileList[index]
setTimeout(() => { setTimeout(() => {
this.$refs.fileListTable.clearSelection() this.$refs.fileListTable.clearSelection()
this.$refs.fileListTable.toggleRowSelection([{ row: row ,selected: true}]) this.$refs.fileListTable.toggleRowSelection([{ row: row ,selected: true}])
@ -2708,28 +2721,29 @@ export default {
searchFile(key, onLoad) { searchFile(key, onLoad) {
if (key) { if (key) {
this.beforeLoadData(onLoad); this.beforeLoadData(onLoad);
// this.pathList = [{ folder: "" }]; // this.pathList = [{ folder: "" }]
// 查找this.pathList中是否已经有搜索的路径 // 查找this.pathList中是否已经有搜索的路径
let isExist = false;
this.pathList.forEach(item => { const item = {}
if (item.search) { item["folder"] = `搜索: ${key}`
// 修改搜索的路径 item["search"] = true
item.folder = "搜索: " + '"' + key + '"'; item["searchKey"] = key
isExist = true;
} let folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : ''
});
if (!isExist) { const searchPathIndex = this.pathList.findIndex(item => item.search)
const item1 = {}; if (searchPathIndex < 0) {
item1["folder"] = "搜索: " + '"' + key + '"'; this.pathList.push(item)
item1["search"] = true; } else {
item1["searchKey"] = key; this.pathList.splice(searchPathIndex, this.pathList.length - searchPathIndex)
this.pathList.push(item1); this.pathList.push(item)
folder = ''
} }
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()
const keyword = key ? `&keyword=${key}` : '' const keyword = key ? `&keyword=${key}` : ''
const path = this.path ? encodeURI(this.path) : "/"; const path = this.path ? encodeURI(this.path.replace(this.basePath, '/')) : "/"
this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}`); this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}${folder}`)
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,
@ -2744,8 +2758,7 @@ export default {
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
showFolderSize: localStorage.getItem('showFolderSize') showFolderSize: localStorage.getItem('showFolderSize')
}) }).then(res => {
.then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
this.listModeSearch = true; this.listModeSearch = true;
this.listModeSearchOpenDir = false; this.listModeSearchOpenDir = false;
@ -2756,13 +2769,20 @@ export default {
} }
} }
}, },
searchFileAndOpenDir(row, onLoad) { searchFileAndOpenDir(fileId, onLoad) {
this.beforeLoadData(onLoad); this.beforeLoadData(onLoad);
api
.searchFileAndOpenDir({ 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({
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
username: this.$store.getters.name, username: this.$store.getters.name,
id: row.id, id: fileId,
currentDirectory: this.getQueryPath(), currentDirectory: this.getQueryPath(),
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
@ -2772,15 +2792,12 @@ export default {
.then(res => { .then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
this.listModeSearch = true; this.listModeSearch = true;
this.listModeSearchOpenDir = row; this.listModeSearchOpenDir = fileId;
}); });
this.path = row.path + row.name;
this.path = this.path.replace(/\\/g, "/");
}, },
openDir(row, onLoad) { openDir(row, onLoad) {
this.beforeLoadData(onLoad); this.beforeLoadData(onLoad);
api api.searchFileAndOpenDir({
.searchFileAndOpenDir({
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
username: this.$store.getters.name, username: this.$store.getters.name,
id: row.mountFileId || row.id, id: row.mountFileId || row.id,
@ -2789,25 +2806,28 @@ export default {
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
folder: this.$route.query.folder, folder: this.$route.query.folder,
showFolderSize: localStorage.getItem('showFolderSize') showFolderSize: localStorage.getItem('showFolderSize')
}) }).then(res => {
.then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
}); });
this.path = row.path + row.name; // this.path = row.path + row.name
this.path = this.path.replace(/\\/g, "/"); // this.path = this.path.replace(/\\/g, '/')
}, },
getFileList(onLoad) { getFileList(onLoad) {
if (this.$route.query.keyword) { if (this.$route.query.keyword) {
if (this.$route.query.keyword !== "undefined") { if (this.$route.query.keyword !== "undefined") {
this.searchFileName = this.$route.query.keyword; this.searchFileName = this.$route.query.keyword
}
const searchPathIndex = this.pathList.findIndex(item => item.search)
if (this.$route.query.folder && searchPathIndex > -1) {
this.searchFileAndOpenDir(this.$route.query.folder, onLoad)
} else {
this.searchFile(this.searchFileName)
} }
this.searchFile(this.searchFileName)
} else { } else {
this.searchFileName = "" this.searchFileName = ""
this.getFileListed = true this.getFileListed = true
this.beforeLoadData(onLoad) this.beforeLoadData(onLoad)
api api.fileList({
.fileList({
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
username: this.$store.state.user.name, username: this.$store.state.user.name,
currentDirectory: this.getQueryPath(), currentDirectory: this.getQueryPath(),
@ -2830,8 +2850,7 @@ export default {
}, },
getFileListBySearchMode(onLoad) { getFileListBySearchMode(onLoad) {
this.beforeLoadData(onLoad); this.beforeLoadData(onLoad);
api api.fileList({
.fileList({
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
username: this.$store.state.user.name, username: this.$store.state.user.name,
currentDirectory: this.getQueryPath(), currentDirectory: this.getQueryPath(),
@ -2839,8 +2858,7 @@ export default {
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
showFolderSize: localStorage.getItem('showFolderSize') showFolderSize: localStorage.getItem('showFolderSize')
}) }).then(res => {
.then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
}); });
}, },
@ -3090,7 +3108,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) {
@ -3275,7 +3293,8 @@ export default {
setMenus(row) { setMenus(row) {
this.menus = JSON.parse(JSON.stringify(this.singleMenus)); this.menus = JSON.parse(JSON.stringify(this.singleMenus));
// 挂载的文件 // 挂载的文件
if (this.$route.query.folder) { const owner = localStorage.getItem('mountFileOwner')
if (this.$route.query.folder && owner) {
// 根据权限设置菜单 // 根据权限设置菜单
this.setMenusByPermission(row); this.setMenusByPermission(row);
} else { } else {
@ -3298,7 +3317,7 @@ export default {
this.menus.splice(index, 1) this.menus.splice(index, 1)
} }
} }
if (row.isShare && !row.isPrivacy) { if (row.isShare && !row.isPrivacy && !row.isFolder) {
// 添加复制下载链接选项 // 添加复制下载链接选项
this.menus.splice(-2, 0, { iconClass: "menu-fuzhi", label: "复制下载链接", operation: "copyDownloadLink" }) this.menus.splice(-2, 0, { iconClass: "menu-fuzhi", label: "复制下载链接", operation: "copyDownloadLink" })
} }
@ -3343,7 +3362,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 }]);
@ -3381,10 +3400,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) {
@ -3438,7 +3457,7 @@ export default {
break; break;
case "show-folder-size": case "show-folder-size":
const showFolderSize = localStorage.getItem('showFolderSize') const showFolderSize = localStorage.getItem('showFolderSize')
localStorage.setItem('showFolderSize', showFolderSize === 'false') localStorage.setItem('showFolderSize', showFolderSize ? false : true)
this.getFileList(); this.getFileList();
break; break;
case "orderName": case "orderName":
@ -3898,19 +3917,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;
}); });
}, },
@ -4073,31 +4090,39 @@ export default {
this.pathList.push(item); this.pathList.push(item);
this.pagination.pageIndex = 1; this.pagination.pageIndex = 1;
const folder = row.id ? `&folder=${row.id}` : '' const folder = row.id ? `&folder=${row.id}` : ''
this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}${basePath}`); const path = this.$route.query.path ? `&path=${this.$route.query.path}` : ''
this.searchFileAndOpenDir(row); const basePath = this.getBasePath()
this.$router.push(`?vmode=${this.vmode}${path}${keyword}${folder}${queryTagId}${basePath}`);
this.searchFileAndOpenDir(row.id);
} else { } else {
let notHomePage = this.$route.path.length > 1 let notHomePage = this.$route.path.length > 1
if (notHomePage && this.basePath.length === 1) { if (notHomePage && this.path + "/" !== row.path && this.basePath.length === 1) {
this.basePath = row.path this.basePath = row.path
} }
if (this.path) {
this.path += "/" + row.name; this.path += "/" + row.name;
} else { this.path = this.path.replace(/\\/g, '/')
this.path = this.basePath + row.name; this.path = this.path.replace(/\/\//g, '/')
}
// 去掉this.path开头的this.basePath // 去掉this.path开头的this.basePath
this.path = this.path.replace(this.basePath, '/') this.path = this.path.replace(this.basePath, '/')
const path = encodeURI(this.path);
// if (this.path) {
// this.path += "/" + row.name;
// } else {
// this.path = this.basePath + row.name;
// }
// // 去掉this.path开头的this.basePath
const item = { folder: row.name, shareBase: row.shareBase }; const item = { folder: row.name, shareBase: row.shareBase };
this.pathList.push(item); this.pathList.push(item);
this.pagination.pageIndex = 1; this.pagination.pageIndex = 1;
const path = encodeURI(this.path);
if (this.$store.getters.userId !== row.userId) { if (this.$store.getters.userId !== row.userId) {
row.mountFileId = row.id row.mountFileId = row.id
} }
if (row.mountFileId) { if (row.mountFileId) {
localStorage.setItem(this.path, row.mountFileId) localStorage.setItem(this.path, row.mountFileId)
} }
const basePath = this.basePath.length > 1 ? '&basePath='+this.basePath : '' const basePath = this.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.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`);
this.openDir(row); this.openDir(row);
} }

View File

@ -53,7 +53,7 @@
> >
</history-popover> </history-popover>
<el-button v-if="isShowUpdateBtn" @click="saveAll(false)" :class="lightTheme?'':'dark-button'" size="small" :loading="updating">保存所有</el-button> <el-button v-if="isShowUpdateBtn" @click="saveAll(false)" :class="lightTheme?'':'dark-button'" size="small" :loading="updating">{{saveTitle}}</el-button>
<el-button <el-button
v-if="editableTabsValue.endsWith('.md') && editableTabs.length > 0" v-if="editableTabsValue.endsWith('.md') && editableTabs.length > 0"
@ -205,6 +205,7 @@
moblie: false, moblie: false,
panelReadOnly: true, panelReadOnly: true,
mountFileId: undefined, mountFileId: undefined,
saveTitle: '',
options: { options: {
fontSize: 14, fontSize: 14,
contextmenu: true, contextmenu: true,
@ -894,11 +895,24 @@
}else{ }else{
if(editableTabValue.copyTitle === editableTabValue.title){ if(editableTabValue.copyTitle === editableTabValue.title){
editableTabValue.title += '*' editableTabValue.title += '*'
editableTabValue.status = 'Modifying' }
this.isShowUpdateBtn = true editableTabValue.status = 'Modifying'
editableTabValue.change = value this.isShowUpdateBtn = true
editableTabValue.change = value
}
this.updateSaveTitle()
},
updateSaveTitle(){
// 判断this.editableTabs中的status是否有Modifying的数量
const modifyingTags = this.editableTabs.filter(editable => editable.status === 'Modifying')
if (modifyingTags) {
let modifyingLength = modifyingTags.length
if(modifyingLength > 1) {
this.saveTitle = '保存全部'
return
} }
} }
this.saveTitle = '保存'
}, },
saveAll(isClose){ saveAll(isClose){
this.editableTabs.forEach((tab,index) => { this.editableTabs.forEach((tab,index) => {
@ -957,6 +971,7 @@
this.isShowUpdateBtn = false this.isShowUpdateBtn = false
} }
} }
this.updateSaveTitle()
if(!this.modifyMsg){ if(!this.modifyMsg){
this.$refs.historyPopover.loadHistoryPathList(this.editableTabsValue) this.$refs.historyPopover.loadHistoryPathList(this.editableTabsValue)
this.modifyMsg = this.$message({ this.modifyMsg = this.$message({

View File

@ -174,6 +174,7 @@ const actions = {
logout({ commit, state }) { logout({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token).then(() => {
localStorage.clear()
removeToken() removeToken()
removeConsumerId() removeConsumerId()
removeRememberName() removeRememberName()

View File

@ -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' }
],
} }
}, },
} }

View File

@ -34,7 +34,7 @@
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
:finished-text="statistics()" :finished-text="statistics()"
@load="searchStatus && searchValue.length>0?searchFile(searchValue,true):getFileList(true)" @load="getFileList(true)"
> >
<van-checkbox-group v-model="selectRowData" @change="checkboxChange" ref="checkboxGroup"> <van-checkbox-group v-model="selectRowData" @change="checkboxChange" ref="checkboxGroup">
<van-cell-group> <van-cell-group>
@ -807,10 +807,13 @@ export default {
searchAction.style.marginRight = '-44px' searchAction.style.marginRight = '-44px'
searchAction.style.visibility = 'hidden' searchAction.style.visibility = 'hidden'
this.searchValue = '' this.searchValue = ''
this.pathList.splice(1, this.pathList.length - 1)
this.$router.push(`?vmode=${this.vmode}`)
this.getFileList() this.getFileList()
}, },
onSearch() { onSearch() {
if (this.searchValue.length < 1) { if (this.searchValue.length < 1) {
this.$router.push(`?vmode=${this.vmode}`)
this.getFileList() this.getFileList()
} else { } else {
this.searchFile(this.searchValue) this.searchFile(this.searchValue)
@ -898,25 +901,53 @@ export default {
this.loading = true; this.loading = true;
this.getFileList(); this.getFileList();
}, },
getFileList(onLoad) { searchFileAndOpenDir(fileId, onLoad) {
this.beforeLoadData(onLoad) this.beforeLoadData(onLoad);
api.fileList({ api.searchFileAndOpenDir({
username: this.$store.state.user.name,
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
currentDirectory: encodeURI(this.$route.query.path), username: this.$store.getters.name,
folder: this.$route.query.folder, id: fileId,
queryFileType: this.queryFileType,
sortableProp: this.sortableProp,
order: this.order,
isFolder: this.queryCondition.isFolder,
isFavorite: this.queryCondition.isFavorite,
queryCondition: this.queryCondition,
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
folder: this.$route.query.folder,
showFolderSize: localStorage.getItem('showFolderSize')
}).then(res => { }).then(res => {
this.loadData(res, onLoad) this.loadData(res, onLoad)
}).catch(e => { this.listModeSearch = true
}) })
},
getFileList(onLoad) {
this.beforeLoadData(onLoad)
if (this.$route.query.keyword) {
if (this.$route.query.keyword !== "undefined") {
this.searchValue = this.$route.query.keyword
}
const searchPathIndex = this.pathList.findIndex(item => item.search)
if (this.$route.query.folder && searchPathIndex > -1) {
this.searchFileAndOpenDir(this.$route.query.folder, false)
} else {
this.searchFile(this.searchValue, onLoad)
}
} else {
this.beforeLoadData(onLoad)
api.fileList({
username: this.$store.state.user.name,
userId: this.$store.state.user.userId,
currentDirectory: encodeURI(this.$route.query.path),
folder: this.$route.query.folder,
queryFileType: this.queryFileType,
sortableProp: this.sortableProp,
order: this.order,
isFolder: this.queryCondition.isFolder,
isFavorite: this.queryCondition.isFavorite,
queryCondition: this.queryCondition,
pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize,
}).then(res => {
this.loadData(res, onLoad)
}).catch(e => {
})
}
}, },
searchFile(key, onLoad) { searchFile(key, onLoad) {
if (key) { if (key) {
@ -933,7 +964,6 @@ export default {
this.loadData(res, onLoad) this.loadData(res, onLoad)
this.path = '' this.path = ''
this.listModeSearch = true this.listModeSearch = true
this.listModeSearchOpenDir = false
}) })
} }
}, },
@ -943,9 +973,9 @@ export default {
this.pagination.pageIndex++ this.pagination.pageIndex++
} else { } else {
this.pagination.pageIndex = 1 this.pagination.pageIndex = 1
this.fileList = []
} }
this.finished = false; this.finished = false;
this.fileList = []
}, },
// 填充数据 // 填充数据
loadData(res, onLoad) { loadData(res, onLoad) {
@ -1087,15 +1117,29 @@ export default {
item['folder'] = row.name item['folder'] = row.name
item['index'] = this.pathList.length - 1 item['index'] = this.pathList.length - 1
this.pathList.push(item) this.pathList.push(item)
const path = encodeURI(this.path); const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : ''
if (this.$store.getters.userId !== row.userId) { if (this.listModeSearch) {
row.mountFileId = row.id const item = {};
item["folder"] = row.name;
item["search"] = true;
item["row"] = row;
this.pathList.push(item);
this.pagination.pageIndex = 1;
const folder = row.id ? `&folder=${row.id}` : ''
const path = this.$route.query.path ? `&path=${this.$route.query.path}` : ''
this.$router.push(`?vmode=${this.vmode}${path}${keyword}${folder}`);
this.getFileList()
} else {
const path = encodeURI(this.path);
if (this.$store.getters.userId !== row.userId) {
row.mountFileId = row.id
}
if (row.mountFileId) {
localStorage.setItem(this.path, row.mountFileId)
}
this.$router.push(`/_m?vmode=${this.vmode}&path=${path}${keyword}${row.mountFileId ? '&folder='+row.mountFileId : ''}`)
this.getFileList()
} }
if (row.mountFileId) {
localStorage.setItem(this.path, row.mountFileId)
}
this.$router.push(`/_m?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}`)
this.getFileList()
} else { } else {
if (row.contentType.startsWith('image')) { if (row.contentType.startsWith('image')) {
// 图片 // 图片