|
@@ -1,90 +1,74 @@
|
|
|
<template>
|
|
|
<LeftPano>
|
|
|
- <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}}
|
|
|
- <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"
|
|
|
- @click="preview(floder)"
|
|
|
- >
|
|
|
- <ui-icon :type="typeIcons[floder.metaType]" v-if="floder.metaType" />
|
|
|
- <p>{{ floder.filesTitle }}</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="types">
|
|
|
+ <h2 @click="showInfo = true">
|
|
|
+ 案件概要
|
|
|
+ <ui-icon :type="`pull-${showInfo ? 'up' : 'down'}`" class="icon" ctrl />
|
|
|
+ </h2>
|
|
|
+ </div>
|
|
|
+ <template v-for="item in floderRoots" :key="item.id">
|
|
|
+ <FloderView :root="item" @preview="(v) => preview(v)" />
|
|
|
</template>
|
|
|
</LeftPano>
|
|
|
|
|
|
- <Preview :items="[currentFile]" v-if="currentFile" @close="currentFile = null" />
|
|
|
+ <Preview
|
|
|
+ :items="currentItems"
|
|
|
+ :current="currentNdx"
|
|
|
+ v-if="~currentNdx"
|
|
|
+ @close="currentNdx = -1"
|
|
|
+ />
|
|
|
+ <Fire v-model:open="showInfo" />
|
|
|
</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 type { Floder } from '@/store'
|
|
|
-import { useViewStack } from '@/hook';
|
|
|
-import { showRightPanoStack } from '@/env';
|
|
|
+import { LeftPano } from "@/layout";
|
|
|
+import { ref } from "vue";
|
|
|
+import { getUrlType, MetaType, saveAs } from "@/utils";
|
|
|
+import { Preview, MediaItem } from "@/components/static-preview/index.vue";
|
|
|
+import { floderRoots, getFlatFloders } from "@/store";
|
|
|
+import FloderView from "./floder-view.vue";
|
|
|
+import Fire from "./fire/index.vue";
|
|
|
|
|
|
-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)
|
|
|
- })),
|
|
|
- }))
|
|
|
-)
|
|
|
+import type { Floder, FloderRoot } from "@/store";
|
|
|
+import { useViewStack } from "@/hook";
|
|
|
+import { showRightPanoStack } from "@/env";
|
|
|
|
|
|
-const typeIcons = {
|
|
|
- [MetaType.image]: 'pic',
|
|
|
- [MetaType.video]: 'a-film',
|
|
|
- [MetaType.other]: 'nav-edit'
|
|
|
-}
|
|
|
-
|
|
|
-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
|
|
|
+const showInfo = ref(false);
|
|
|
+const currentNdx = ref(-1);
|
|
|
+const currentItems = ref<MediaItem[]>([]);
|
|
|
+const preview = async ([floder, root]: [Floder, FloderRoot]) => {
|
|
|
+ const metaType = getUrlType(floder.filesUrl);
|
|
|
+ if (metaType === MetaType.other) {
|
|
|
+ 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 {
|
|
|
+ const floders = root.flat ? getFlatFloders(root) : root.floders;
|
|
|
+ const items = floders.map((item) => ({
|
|
|
+ type: getUrlType(item.filesUrl),
|
|
|
+ id: item.filesId,
|
|
|
+ url: item.filesUrl,
|
|
|
+ }));
|
|
|
+ currentNdx.value = items.findIndex((item) => item.id === floder.filesId);
|
|
|
+ currentItems.value = items;
|
|
|
}
|
|
|
-}
|
|
|
-useViewStack(() => showRightPanoStack.push(ref(false)))
|
|
|
-
|
|
|
+};
|
|
|
+useViewStack(() => showRightPanoStack.push(ref(false)));
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.types {
|
|
|
h2 {
|
|
|
- padding: 20px;
|
|
|
+ padding: 20px 0;
|
|
|
+ margin: 0 20px;
|
|
|
+ font-size: 16px;
|
|
|
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 +80,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 +94,8 @@ useViewStack(() => showRightPanoStack.push(ref(false)))
|
|
|
margin-left: 10px;
|
|
|
font-size: 12px;
|
|
|
color: currentColor;
|
|
|
- word-break:break-all;
|
|
|
+ word-break: break-all;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|