chore: refactoring
This commit is contained in:
parent
368b996a0d
commit
d58de27080
16544
frontend/package-lock.json
generated
16544
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -38,7 +38,7 @@
|
|||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
||||||
<ThreeViewer v-else-if="is3DModelFile(req)" :src="raw"></ThreeViewer>
|
<ThreeViewer v-else-if="is3DModelFile" :src="raw"></ThreeViewer>
|
||||||
<audio v-else-if="req.type == 'audio'" :src="raw" autoplay controls></audio>
|
<audio v-else-if="req.type == 'audio'" :src="raw" autoplay controls></audio>
|
||||||
<video v-else-if="req.type == 'video'" :src="raw" autoplay controls>
|
<video v-else-if="req.type == 'video'" :src="raw" autoplay controls>
|
||||||
<track
|
<track
|
||||||
@ -65,6 +65,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import url from '@/utils/url'
|
import url from '@/utils/url'
|
||||||
|
import { is3DModelFile } from '@/utils/filetype'
|
||||||
import { baseURL, resizePreview } from '@/utils/constants'
|
import { baseURL, resizePreview } from '@/utils/constants'
|
||||||
import { files as api } from '@/api'
|
import { files as api } from '@/api'
|
||||||
import PreviewSizeButton from '@/components/buttons/PreviewSize'
|
import PreviewSizeButton from '@/components/buttons/PreviewSize'
|
||||||
@ -128,6 +129,9 @@ export default {
|
|||||||
},
|
},
|
||||||
isResizeEnabled () {
|
isResizeEnabled () {
|
||||||
return resizePreview
|
return resizePreview
|
||||||
|
},
|
||||||
|
is3DModelFile () {
|
||||||
|
return is3DModelFile(this.req.extension)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -234,9 +238,6 @@ export default {
|
|||||||
toggleSize () {
|
toggleSize () {
|
||||||
this.fullSize = !this.fullSize
|
this.fullSize = !this.fullSize
|
||||||
},
|
},
|
||||||
is3DModelFile (req) {
|
|
||||||
return ThreeViewer.methods.is3DModelFile(req)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -22,8 +22,6 @@ import { mapState } from 'vuex'
|
|||||||
import url from '@/utils/url'
|
import url from '@/utils/url'
|
||||||
import { baseURL } from '@/utils/constants'
|
import { baseURL } from '@/utils/constants'
|
||||||
|
|
||||||
const ThreeDModelExtRegExp = new RegExp(/\.(obj|stl|dae|ply|fbx|gltf)$/);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ModelCollada,
|
ModelCollada,
|
||||||
@ -58,9 +56,6 @@ export default {
|
|||||||
this.rotating = true
|
this.rotating = true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
is3DModelFile (req) {
|
|
||||||
return ThreeDModelExtRegExp.test(req.extension);
|
|
||||||
},
|
|
||||||
onLoad () {
|
onLoad () {
|
||||||
this.loadingPreview = false
|
this.loadingPreview = false
|
||||||
this.rotate();
|
this.rotate();
|
||||||
|
|||||||
6
frontend/src/utils/filetype.js
Normal file
6
frontend/src/utils/filetype.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
const ThreeDModelExtRegExp = new RegExp(/\.(obj|stl|dae|ply|fbx|gltf)$/);
|
||||||
|
|
||||||
|
export const is3DModelFile = (filename) => {
|
||||||
|
return ThreeDModelExtRegExp.test(filename)
|
||||||
|
}
|
||||||
@ -34,6 +34,7 @@ import InternalError from './errors/500'
|
|||||||
import Preview from '@/components/files/Preview'
|
import Preview from '@/components/files/Preview'
|
||||||
import Listing from '@/components/files/Listing'
|
import Listing from '@/components/files/Listing'
|
||||||
import { files as api } from '@/api'
|
import { files as api } from '@/api'
|
||||||
|
import { is3DModelFile } from '@/utils/filetype'
|
||||||
import { mapGetters, mapState, mapMutations } from 'vuex'
|
import { mapGetters, mapState, mapMutations } from 'vuex'
|
||||||
|
|
||||||
function clean (path) {
|
function clean (path) {
|
||||||
@ -66,7 +67,14 @@ export default {
|
|||||||
'show'
|
'show'
|
||||||
]),
|
]),
|
||||||
isPreview () {
|
isPreview () {
|
||||||
return !this.loading && !this.isListing && !this.isEditor || this.loading && this.$store.state.previewMode
|
return !this.loading
|
||||||
|
&& !this.isListing
|
||||||
|
&& (!this.isEditor || this.is3DModelFile)
|
||||||
|
|| this.loading
|
||||||
|
&& this.$store.state.previewMode
|
||||||
|
},
|
||||||
|
is3DModelFile () {
|
||||||
|
return is3DModelFile(this.req.extension)
|
||||||
},
|
},
|
||||||
breadcrumbs () {
|
breadcrumbs () {
|
||||||
let parts = this.$route.path.split('/')
|
let parts = this.$route.path.split('/')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user