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 clipboardMixin from '@/components/ShowFile/mixins/clipboard'
|
||||
|
||||
import path from 'path'
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
|
||||
@ -2,8 +2,7 @@ import store from '@/store'
|
||||
import fileConfig from '@/utils/file-config'
|
||||
|
||||
export default {
|
||||
created() {
|
||||
},
|
||||
|
||||
computed: {
|
||||
fileClipboard() {
|
||||
return store.getters.fileClipboard
|
||||
@ -20,12 +19,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
// 复制下载链接
|
||||
copyDownloadLink(row) {
|
||||
copyDownloadLink(row, elName) {
|
||||
let url = window.location.origin + fileConfig.previewUrl(this.$store.getters.name, row, undefined, this.shareToken)
|
||||
if (row.isFolder) {
|
||||
url = fileConfig.packageDownloadUrl(row.id, row.name + '.zip', this.shareToken)
|
||||
}
|
||||
let clipboard = new Clipboard('.file-contextmenu', {
|
||||
let clipboard = new Clipboard(elName, {
|
||||
text: function() {
|
||||
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=`
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 格式化最近时间
|
||||
formatTime(time) {
|
||||
|
||||
@ -290,7 +290,7 @@ export default {
|
||||
break
|
||||
case 'copyDownloadLink':
|
||||
// 复制下载链接
|
||||
this.copyDownloadLink(this.rowContextData)
|
||||
this.copyDownloadLink(this.rowContextData, '.file-contextmenu')
|
||||
break
|
||||
case 'remove':
|
||||
// 删除
|
||||
|
||||
@ -96,7 +96,7 @@ export default {
|
||||
_this.fileListTableClearSelection()
|
||||
}
|
||||
}
|
||||
let scrollTop = draw.scrollTop || draw.scrollTop
|
||||
let scrollTop = draw.scrollTop
|
||||
let scrollLeft = draw.scrollLeft || draw.scrollLeft
|
||||
startX = evt.clientX + scrollLeft
|
||||
startY = evt.clientY + scrollTop
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import api from '@/api/file-api'
|
||||
import fileConfig from '@/utils/file-config'
|
||||
import path from 'path'
|
||||
export default {
|
||||
props: {
|
||||
showUploadButton: {
|
||||
@ -806,16 +807,22 @@ export default {
|
||||
return fileIds
|
||||
},
|
||||
getSelectFileList() {
|
||||
const fileList = [];
|
||||
this.permanentDeleteDisable = false;
|
||||
const addFileToList = ({ id, suffix, name, mountFileId, contentType, isFolder, music, video }) => {
|
||||
fileList.push({ id, suffix, name, mountFileId, contentType, isFolder, music, video });
|
||||
};
|
||||
let selectedSource = [];
|
||||
if (this.selectRowData.length > 1 || this.menusIsMultiple) {
|
||||
this.$refs.fileListTable.tableSelectData.forEach(value => addFileToList(value));
|
||||
} else {
|
||||
addFileToList(this.rowContextData);
|
||||
selectedSource = this.$refs.fileListTable.tableSelectData;
|
||||
} else if (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) {
|
||||
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]
|
||||
thisPath = `${row.row.path}${row.folder}`
|
||||
}
|
||||
console.log('fileDoc', fileDoc)
|
||||
const isCurrentPath = (thisPath + '/') === fileDoc
|
||||
if ('deleteFile' === url && (isCurrentPath || this.$route.path.startsWith('/recently'))) {
|
||||
this.getFileListEnter()
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import api from '@/api/file-api'
|
||||
export default {
|
||||
props: {
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
basePath: '/',
|
||||
|
||||
@ -2,8 +2,7 @@ import api from '@/api/file-api'
|
||||
import _ from 'lodash'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
showNewFolder: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user