|
@@ -3,15 +3,15 @@
|
|
|
<template v-for="item in types">
|
|
|
<div :key="item.id" class="types" v-if="item.floders.length">
|
|
|
<h2 @click="item.show.value = !item.show.value">
|
|
|
- {{item.title}}
|
|
|
+ {{ item.title }}
|
|
|
<ui-icon :type="`pull-${item.show.value ? 'up' : 'down'}`" class="icon" ctrl />
|
|
|
</h2>
|
|
|
|
|
|
- <div class="floders" v-if="item.show.value">
|
|
|
- <div
|
|
|
- v-for="floder in item.floders"
|
|
|
- :key="floder.filesId"
|
|
|
- class="fun-ctrl"
|
|
|
+ <div class="floders" v-if="item.show.value">
|
|
|
+ <div
|
|
|
+ v-for="floder in item.floders"
|
|
|
+ :key="floder.filesId"
|
|
|
+ class="fun-ctrl"
|
|
|
@click="preview(floder)"
|
|
|
>
|
|
|
<ui-icon :type="typeIcons[floder.metaType]" v-if="floder.metaType" />
|
|
@@ -26,55 +26,71 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { LeftPano } from '@/layout'
|
|
|
-import { computed, ref } from 'vue';
|
|
|
-import { getUrlType, MetaType } from '@/utils'
|
|
|
-import { Preview, MediaItem, MediaType } from '@/components/static-preview/index.vue'
|
|
|
-import { floderTypes, getFloderByType } from '@/store'
|
|
|
+import { LeftPano } from "@/layout";
|
|
|
+import { computed, ref } from "vue";
|
|
|
+import { getUrlType, MetaType, saveAs } from "@/utils";
|
|
|
+import { Preview, MediaItem, MediaType } from "@/components/static-preview/index.vue";
|
|
|
+import { floderTypes, getFloderByType } from "@/store";
|
|
|
|
|
|
-import type { Floder } from '@/store'
|
|
|
-import { useViewStack } from '@/hook';
|
|
|
-import { showRightPanoStack } from '@/env';
|
|
|
+import type { Floder } from "@/store";
|
|
|
+import { useViewStack } from "@/hook";
|
|
|
+import { showRightPanoStack } from "@/env";
|
|
|
|
|
|
-const types = computed(() =>
|
|
|
- floderTypes.value.map(type => ({
|
|
|
+const types = computed(() =>
|
|
|
+ floderTypes.value.map((type) => ({
|
|
|
show: ref(true),
|
|
|
id: type.filesTypeId,
|
|
|
title: type.filesTypeName,
|
|
|
- floders: getFloderByType(type)
|
|
|
- .map(floder => ({
|
|
|
- ...floder,
|
|
|
- metaType: getUrlType(floder.filesUrl)
|
|
|
- })),
|
|
|
+ floders: getFloderByType(type).map((floder) => ({
|
|
|
+ ...floder,
|
|
|
+ metaType: getUrlType(floder.filesUrl),
|
|
|
+ })),
|
|
|
}))
|
|
|
-)
|
|
|
+);
|
|
|
|
|
|
const typeIcons = {
|
|
|
- [MetaType.image]: 'pic',
|
|
|
- [MetaType.video]: 'a-film',
|
|
|
- [MetaType.other]: 'nav-edit'
|
|
|
-}
|
|
|
+ [MetaType.image]: "pic",
|
|
|
+ [MetaType.video]: "a-film",
|
|
|
+ [MetaType.other]: "nav-edit",
|
|
|
+};
|
|
|
+
|
|
|
+const currentFile = ref<MediaItem | null>(null);
|
|
|
+const preview = async (floder: Floder) => {
|
|
|
+ const ext = floder.filesUrl
|
|
|
+ .substring(floder.filesUrl.lastIndexOf("."))
|
|
|
+ .toLocaleLowerCase();
|
|
|
+ if ([".raw", ".dcm"].includes(ext)) {
|
|
|
+ window.open(
|
|
|
+ `/xfile-viewer/index.html?file=${floder.filesUrl}&name=${floder.filesTitle}&time=` +
|
|
|
+ Date.now()
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
-const currentFile = ref<MediaItem | null>(null)
|
|
|
-const preview = (floder: Floder) => {
|
|
|
- const type = getUrlType(floder.filesUrl)
|
|
|
- const mediaType = type === MetaType.image
|
|
|
- ? MediaType.img
|
|
|
+ const type = getUrlType(floder.filesUrl);
|
|
|
+ const mediaType =
|
|
|
+ type === MetaType.image
|
|
|
+ ? MediaType.img
|
|
|
: type === MetaType.video
|
|
|
- ? MediaType.video
|
|
|
- : null
|
|
|
-
|
|
|
+ ? MediaType.video
|
|
|
+ : null;
|
|
|
+
|
|
|
if (!mediaType) {
|
|
|
- window.open(floder.filesUrl)
|
|
|
+ const isBlob = floder.filesUrl.includes("blob");
|
|
|
+
|
|
|
+ if (floder.filesTypeId === 100) {
|
|
|
+ saveAs(floder.filesUrl, floder.filesTitle + ".doc");
|
|
|
+ } else {
|
|
|
+ window.open(floder.filesUrl + (!isBlob ? "?time=" + Date.now() : ""));
|
|
|
+ }
|
|
|
} else {
|
|
|
currentFile.value = {
|
|
|
type: mediaType,
|
|
|
- url: floder.filesUrl
|
|
|
- }
|
|
|
+ url: floder.filesUrl,
|
|
|
+ };
|
|
|
}
|
|
|
-}
|
|
|
-useViewStack(() => showRightPanoStack.push(ref(false)))
|
|
|
-
|
|
|
+};
|
|
|
+useViewStack(() => showRightPanoStack.push(ref(false)));
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -84,7 +100,7 @@ useViewStack(() => showRightPanoStack.push(ref(false)))
|
|
|
font-weight: bold;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
- border-bottom: 1px solid rgba(255,255,255,0.16);
|
|
|
+ border-bottom: 1px solid rgba(255, 255, 255, 0.16);
|
|
|
align-items: center;
|
|
|
margin-bottom: 0;
|
|
|
cursor: pointer;
|
|
@@ -96,12 +112,12 @@ useViewStack(() => showRightPanoStack.push(ref(false)))
|
|
|
}
|
|
|
|
|
|
.floders {
|
|
|
- background: rgba(0,0,0,0.5);
|
|
|
+ background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
> div {
|
|
|
margin: 0 20px;
|
|
|
padding: 20px 10px;
|
|
|
- border-bottom: 1px solid rgba(255,255,255,0.16);
|
|
|
+ border-bottom: 1px solid rgba(255, 255, 255, 0.16);
|
|
|
cursor: pointer;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
@@ -110,8 +126,8 @@ useViewStack(() => showRightPanoStack.push(ref(false)))
|
|
|
margin-left: 10px;
|
|
|
font-size: 12px;
|
|
|
color: currentColor;
|
|
|
- word-break:break-all;
|
|
|
+ word-break: break-all;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|