bill 1 tahun lalu
induk
melakukan
63db7e695d
2 mengubah file dengan 55 tambahan dan 44 penghapusan
  1. 4 0
      src/sdk/sdk.ts
  2. 51 44
      src/views/folder/index.vue

+ 4 - 0
src/sdk/sdk.ts

@@ -136,6 +136,10 @@ export const initialSDK = async (props: InialSDKProps) => {
     `./lib/jquery/jquery-3.1.1.min.js`,
     `./lib/other/BinaryHeap.js`,
     `./lib/tween/tween.min.js`,
+    `./lib/plasio/js/laslaz.js`,
+    `./lib/plasio/vendor/bluebird.js`,
+    `./lib/plasio/workers/laz-loader-worker.js`,
+    `./lib/plasio/workers/laz-perf.js`,
   ]
   await Promise.all(libs.map(loadLib))
   await loadLib(`./lib/potree/potree.js`)

+ 51 - 44
src/views/folder/index.vue

@@ -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,62 @@
 </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 } 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 currentFile = ref<MediaItem | null>(null);
 const preview = (floder: Floder) => {
-  const type = getUrlType(floder.filesUrl)
-  const mediaType = type === MetaType.image 
-      ? MediaType.img 
+  const ext = floder.filesUrl
+    .substring(floder.filesUrl.lastIndexOf("."))
+    .toLocaleLowerCase();
+  if (ext === ".raw") {
+    window.open(`/xfile-viewer/index.html?file=${floder.filesUrl}&time=` + Date.now());
+    return;
+  }
+
+  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)
+    window.open(floder.filesUrl + "?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 +91,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 +103,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 +117,8 @@ useViewStack(() => showRightPanoStack.push(ref(false)))
       margin-left: 10px;
       font-size: 12px;
       color: currentColor;
-      word-break:break-all;
+      word-break: break-all;
     }
   }
 }
-</style>
+</style>