mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-16 14:12:51 +00:00
perf: 优化文件里预览图片
This commit is contained in:
parent
ff872c7dce
commit
376120b6d0
@ -75,7 +75,7 @@ export default {
|
|||||||
this.lightbox = new PhotoSwipeLightbox({
|
this.lightbox = new PhotoSwipeLightbox({
|
||||||
dataSource,
|
dataSource,
|
||||||
escKey: false,
|
escKey: false,
|
||||||
mainClass: this.className,
|
mainClass: this.className + ' no-dark-content',
|
||||||
showHideAnimationType: 'none',
|
showHideAnimationType: 'none',
|
||||||
pswpModule: () => import('photoswipe'),
|
pswpModule: () => import('photoswipe'),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -415,12 +415,6 @@
|
|||||||
<FileContent v-else ref="fileContent" v-model="fileShow" :file="fileInfo"/>
|
<FileContent v-else ref="fileContent" v-model="fileShow" :file="fileInfo"/>
|
||||||
</DrawerOverlay>
|
</DrawerOverlay>
|
||||||
|
|
||||||
<!--预览文件-->
|
|
||||||
<PreviewImage
|
|
||||||
v-model="imageShow"
|
|
||||||
:index="imageIndex"
|
|
||||||
:list="imageList"/>
|
|
||||||
|
|
||||||
<!--拖动上传提示-->
|
<!--拖动上传提示-->
|
||||||
<Modal
|
<Modal
|
||||||
v-model="pasteShow"
|
v-model="pasteShow"
|
||||||
@ -443,7 +437,6 @@
|
|||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {sortBy} from "lodash";
|
import {sortBy} from "lodash";
|
||||||
import DrawerOverlay from "../../components/DrawerOverlay";
|
import DrawerOverlay from "../../components/DrawerOverlay";
|
||||||
import PreviewImage from "../../components/PreviewImage";
|
|
||||||
import longpress from "../../directives/longpress";
|
import longpress from "../../directives/longpress";
|
||||||
import UserSelect from "../../components/UserSelect.vue";
|
import UserSelect from "../../components/UserSelect.vue";
|
||||||
import UserAvatarTip from "../../components/UserAvatar/tip.vue";
|
import UserAvatarTip from "../../components/UserAvatar/tip.vue";
|
||||||
@ -453,7 +446,7 @@ const FileContent = () => import('./components/FileContent');
|
|||||||
const FileObject = {sort: null, mode: null, shared: null};
|
const FileObject = {sort: null, mode: null, shared: null};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {UserAvatarTip, UserSelect, PreviewImage, FilePreview, DrawerOverlay, FileContent},
|
components: {UserAvatarTip, UserSelect, FilePreview, DrawerOverlay, FileContent},
|
||||||
directives: {longpress},
|
directives: {longpress},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -534,10 +527,6 @@ export default {
|
|||||||
fileShow: false,
|
fileShow: false,
|
||||||
fileInfo: {permission: -1},
|
fileInfo: {permission: -1},
|
||||||
|
|
||||||
imageShow: false,
|
|
||||||
imageIndex: 0,
|
|
||||||
imageList:[],
|
|
||||||
|
|
||||||
uploadDir: false,
|
uploadDir: false,
|
||||||
uploadIng: 0,
|
uploadIng: 0,
|
||||||
uploadShow: false,
|
uploadShow: false,
|
||||||
@ -931,12 +920,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
imageShow(val) {
|
|
||||||
if (!val) {
|
|
||||||
this.browseFile(0)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
navigator: {
|
navigator: {
|
||||||
handler() {
|
handler() {
|
||||||
this.$nextTick(_ => {
|
this.$nextTick(_ => {
|
||||||
@ -1088,39 +1071,17 @@ export default {
|
|||||||
openFileJudge() {
|
openFileJudge() {
|
||||||
if (this.$route.name !== 'manage-file') {
|
if (this.$route.name !== 'manage-file') {
|
||||||
this.fileShow = false;
|
this.fileShow = false;
|
||||||
this.imageShow = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.fid <= 0) {
|
if (this.fid <= 0) {
|
||||||
this.fileShow = false;
|
this.fileShow = false;
|
||||||
this.imageShow = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item = this.fileList.find(({id}) => id === this.fid)
|
const item = this.fileList.find(({id}) => id === this.fid)
|
||||||
if (!item) {
|
if (!item) {
|
||||||
this.fileShow = false;
|
this.fileShow = false;
|
||||||
this.imageShow = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 图片直接浏览
|
|
||||||
if (item.image_url) {
|
|
||||||
const list = this.fileList.filter(({image_url}) => !!image_url)
|
|
||||||
if (list.length > 0) {
|
|
||||||
this.imageIndex = list.findIndex(({id}) => item.id === id)
|
|
||||||
this.imageList = list.map(item => {
|
|
||||||
if (item.image_width) {
|
|
||||||
return {
|
|
||||||
src: item.image_url,
|
|
||||||
width: item.image_width,
|
|
||||||
height: item.image_height,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return item.image_url;
|
|
||||||
})
|
|
||||||
this.imageShow = true
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 客户端打开独立窗口
|
// 客户端打开独立窗口
|
||||||
if (this.$Electron || this.$isEEUiApp) {
|
if (this.$Electron || this.$isEEUiApp) {
|
||||||
this.openFileSingle(item);
|
this.openFileSingle(item);
|
||||||
@ -1220,9 +1181,28 @@ export default {
|
|||||||
}
|
}
|
||||||
if (item.type == 'folder') {
|
if (item.type == 'folder') {
|
||||||
this.browseFolder(item.id)
|
this.browseFolder(item.id)
|
||||||
} else {
|
return;
|
||||||
this.browseFile(item.id)
|
|
||||||
}
|
}
|
||||||
|
if (item.image_url) {
|
||||||
|
// 图片直接浏览
|
||||||
|
const list = this.fileList.filter(({image_url}) => !!image_url)
|
||||||
|
if (list.length > 0) {
|
||||||
|
const index = list.findIndex(({id}) => item.id === id)
|
||||||
|
const array = list.map(item => {
|
||||||
|
if (item.image_width) {
|
||||||
|
return {
|
||||||
|
src: item.image_url,
|
||||||
|
width: item.image_width,
|
||||||
|
height: item.image_height,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item.image_url;
|
||||||
|
})
|
||||||
|
this.$store.dispatch("previewImage", {index, list: array})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.browseFile(item.id)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'upperFolder':
|
case 'upperFolder':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user