|
@@ -19,16 +19,16 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</LeftPano>
|
|
</LeftPano>
|
|
|
|
+
|
|
|
|
+ <Preview :items="[currentFile]" v-if="currentFile" @close="currentFile = null" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { LeftPano } from '@/layout'
|
|
import { LeftPano } from '@/layout'
|
|
import { computed, ref } from 'vue';
|
|
import { computed, ref } from 'vue';
|
|
import { getUrlType, MetaType } from '@/utils'
|
|
import { getUrlType, MetaType } from '@/utils'
|
|
-import {
|
|
|
|
- floderTypes,
|
|
|
|
- getFloderByType,
|
|
|
|
-} from '@/store'
|
|
|
|
|
|
+import { Preview, MediaItem, MediaType } from '@/components/static-preview/index.vue'
|
|
|
|
+import { floderTypes, getFloderByType } from '@/store'
|
|
|
|
|
|
import type { Floder } from '@/store'
|
|
import type { Floder } from '@/store'
|
|
|
|
|
|
@@ -51,7 +51,24 @@ const typeIcons = {
|
|
[MetaType.other]: 'nav-edit'
|
|
[MetaType.other]: 'nav-edit'
|
|
}
|
|
}
|
|
|
|
|
|
-const preview = (floder: Floder) => window.open(floder.filesUrl)
|
|
|
|
|
|
+const currentFile = ref<MediaItem | null>(null)
|
|
|
|
+const preview = (floder: Floder) => {
|
|
|
|
+ const type = getUrlType(floder.filesUrl)
|
|
|
|
+ const mediaType = type === MetaType.image
|
|
|
|
+ ? MediaType.img
|
|
|
|
+ : type === MetaType.video
|
|
|
|
+ ? MediaType.video
|
|
|
|
+ : null
|
|
|
|
+
|
|
|
|
+ if (!mediaType) {
|
|
|
|
+ window.open(floder.filesUrl)
|
|
|
|
+ } else {
|
|
|
|
+ currentFile.value = {
|
|
|
|
+ type: mediaType,
|
|
|
|
+ url: floder.filesUrl
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|