refactor: clean up unused props and methods; streamline file selection logic
This commit is contained in:
parent
bc9acf1606
commit
a745ff70be
@ -780,7 +780,6 @@ import styleControlMixin from '@/components/ShowFile/mixins/styleControl'
|
|||||||
import fileContextmenuMixin from '@/components/ShowFile/mixins/fileContextmenu'
|
import fileContextmenuMixin from '@/components/ShowFile/mixins/fileContextmenu'
|
||||||
import clipboardMixin from '@/components/ShowFile/mixins/clipboard'
|
import clipboardMixin from '@/components/ShowFile/mixins/clipboard'
|
||||||
|
|
||||||
import path from 'path'
|
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters, mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@ -2,8 +2,7 @@ import store from '@/store'
|
|||||||
import fileConfig from '@/utils/file-config'
|
import fileConfig from '@/utils/file-config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
fileClipboard() {
|
fileClipboard() {
|
||||||
return store.getters.fileClipboard
|
return store.getters.fileClipboard
|
||||||
@ -20,12 +19,12 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 复制下载链接
|
// 复制下载链接
|
||||||
copyDownloadLink(row) {
|
copyDownloadLink(row, elName) {
|
||||||
let url = window.location.origin + fileConfig.previewUrl(this.$store.getters.name, row, undefined, this.shareToken)
|
let url = window.location.origin + fileConfig.previewUrl(this.$store.getters.name, row, undefined, this.shareToken)
|
||||||
if (row.isFolder) {
|
if (row.isFolder) {
|
||||||
url = fileConfig.packageDownloadUrl(row.id, row.name + '.zip', this.shareToken)
|
url = fileConfig.packageDownloadUrl(row.id, row.name + '.zip', this.shareToken)
|
||||||
}
|
}
|
||||||
let clipboard = new Clipboard('.file-contextmenu', {
|
let clipboard = new Clipboard(elName, {
|
||||||
text: function() {
|
text: function() {
|
||||||
return url
|
return url
|
||||||
},
|
},
|
||||||
|
|||||||
@ -9,10 +9,7 @@ export default {
|
|||||||
return `${process.env.VUE_APP_BASE_API}/view/cover?jmal-token=${this.$store.state.user.token}&name=${this.$store.state.user.name}&id=`
|
return `${process.env.VUE_APP_BASE_API}/view/cover?jmal-token=${this.$store.state.user.token}&name=${this.$store.state.user.name}&id=`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 格式化最近时间
|
// 格式化最近时间
|
||||||
formatTime(time) {
|
formatTime(time) {
|
||||||
|
|||||||
@ -290,7 +290,7 @@ export default {
|
|||||||
break
|
break
|
||||||
case 'copyDownloadLink':
|
case 'copyDownloadLink':
|
||||||
// 复制下载链接
|
// 复制下载链接
|
||||||
this.copyDownloadLink(this.rowContextData)
|
this.copyDownloadLink(this.rowContextData, '.file-contextmenu')
|
||||||
break
|
break
|
||||||
case 'remove':
|
case 'remove':
|
||||||
// 删除
|
// 删除
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export default {
|
|||||||
_this.fileListTableClearSelection()
|
_this.fileListTableClearSelection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let scrollTop = draw.scrollTop || draw.scrollTop
|
let scrollTop = draw.scrollTop
|
||||||
let scrollLeft = draw.scrollLeft || draw.scrollLeft
|
let scrollLeft = draw.scrollLeft || draw.scrollLeft
|
||||||
startX = evt.clientX + scrollLeft
|
startX = evt.clientX + scrollLeft
|
||||||
startY = evt.clientY + scrollTop
|
startY = evt.clientY + scrollTop
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import api from '@/api/file-api'
|
import api from '@/api/file-api'
|
||||||
import fileConfig from '@/utils/file-config'
|
import fileConfig from '@/utils/file-config'
|
||||||
|
import path from 'path'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
showUploadButton: {
|
showUploadButton: {
|
||||||
@ -806,16 +807,22 @@ export default {
|
|||||||
return fileIds
|
return fileIds
|
||||||
},
|
},
|
||||||
getSelectFileList() {
|
getSelectFileList() {
|
||||||
const fileList = [];
|
|
||||||
this.permanentDeleteDisable = false;
|
this.permanentDeleteDisable = false;
|
||||||
const addFileToList = ({ id, suffix, name, mountFileId, contentType, isFolder, music, video }) => {
|
let selectedSource = [];
|
||||||
fileList.push({ id, suffix, name, mountFileId, contentType, isFolder, music, video });
|
|
||||||
};
|
|
||||||
if (this.selectRowData.length > 1 || this.menusIsMultiple) {
|
if (this.selectRowData.length > 1 || this.menusIsMultiple) {
|
||||||
this.$refs.fileListTable.tableSelectData.forEach(value => addFileToList(value));
|
selectedSource = this.$refs.fileListTable.tableSelectData;
|
||||||
} else {
|
} else if (this.rowContextData) {
|
||||||
addFileToList(this.rowContextData);
|
selectedSource = [this.rowContextData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedSource.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileList = selectedSource.map(({ id, suffix, name, mountFileId, contentType, isFolder, music, video }) => {
|
||||||
|
return { id, suffix, name, mountFileId, contentType, isFolder, music, video };
|
||||||
|
});
|
||||||
|
|
||||||
if (fileList.length > 0) {
|
if (fileList.length > 0) {
|
||||||
this.checkPermanentDelete(fileList[0]);
|
this.checkPermanentDelete(fileList[0]);
|
||||||
}
|
}
|
||||||
@ -870,8 +877,6 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,7 +152,6 @@ export default {
|
|||||||
const row = this.pathList[this.pathList.length - 1]
|
const row = this.pathList[this.pathList.length - 1]
|
||||||
thisPath = `${row.row.path}${row.folder}`
|
thisPath = `${row.row.path}${row.folder}`
|
||||||
}
|
}
|
||||||
console.log('fileDoc', fileDoc)
|
|
||||||
const isCurrentPath = (thisPath + '/') === fileDoc
|
const isCurrentPath = (thisPath + '/') === fileDoc
|
||||||
if ('deleteFile' === url && (isCurrentPath || this.$route.path.startsWith('/recently'))) {
|
if ('deleteFile' === url && (isCurrentPath || this.$route.path.startsWith('/recently'))) {
|
||||||
this.getFileListEnter()
|
this.getFileListEnter()
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import api from '@/api/file-api'
|
import api from '@/api/file-api'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
basePath: '/',
|
basePath: '/',
|
||||||
|
|||||||
@ -2,8 +2,7 @@ import api from '@/api/file-api'
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showNewFolder: false,
|
showNewFolder: false,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user