gemercheung 1 vuosi sitten
vanhempi
commit
1e6c190f6a
6 muutettua tiedostoa jossa 65 lisäystä ja 36 poistoa
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 38 24
      src/components/showCase.vue
  4. 13 1
      src/store/collect.js
  5. 12 7
      src/views/collect-detail.vue
  6. 0 2
      src/views/exhibition.vue

+ 1 - 1
.env.development

@@ -1,4 +1,4 @@
 VITE_DOMAIN_URL="https://sit-qiushoubwg.4dage.com"
 VITE_API_URL="https://sit-qiushoubwg.4dage.com/api"
-VITE_MODEL_URL="https://model3d.4dage.com/model/showModel.html?m="
+VITE_MODEL_URL="https://sit-qiushoubwg.4dage.com/model/model.html?m="
 VITE_PUBLIC_DIR="/web/"

+ 1 - 1
.env.production

@@ -1,4 +1,4 @@
 VITE_DOMAIN_URL="https://sit-qiushoubwg.4dage.com"
 VITE_API_URL="https://sit-qiushoubwg.4dage.com/api"
-VITE_MODEL_URL="https://model3d.4dage.com/model/showModel.html?m="
+VITE_MODEL_URL="https://sit-qiushoubwg.4dage.com/model/model.html?m="
 VITE_PUBLIC_DIR="/web/"

+ 38 - 24
src/components/showCase.vue

@@ -67,6 +67,7 @@
     <div class="tools">
       <n-space class="group-type" :size="25">
         <n-button
+          v-if="model"
           class="model btn"
           :class="{
             active: isModel,
@@ -87,6 +88,7 @@
           ><img src="@/assets/icon_video.png" />视频</n-button
         >
         <n-button
+          v-if="gallery.length > 0"
           class="gallery btn"
           :class="{
             active: isGallery,
@@ -101,7 +103,7 @@
         >
       </n-space>
       <div class="actions">
-        <div v-if="isModel">
+        <div v-if="isModel && model">
           <img src="@/assets/zoom-in.png" @click="handleFullScreen" />
           <img src="@/assets/zoom-out.png" @click="handleExitFullScreen" />
           <img src="@/assets/reload.png" @click="reloadIframe" />
@@ -116,36 +118,18 @@
 </template>
 
 <script setup>
-import { ref, computed, unref } from "vue";
+import { ref, computed, unref, watchEffect } from "vue";
 import { useFullscreen } from "@vueuse/core";
 
-const iframeRef = ref();
-const containerRef = ref();
-const type = ref("model");
-const defaultType = ref(["model", "video", "audio", "gallery"]);
-const videoRef = ref();
-const modelUrl = import.meta.env.VITE_MODEL_URL;
-
-// ("https://model3d.4dage.com/model/showModel.html?m=d558c919-a001-4aef-a719-18af4ed2bd82");
-
-const iframeURL = ref(modelUrl + "3477401f-6ab6-49cb-b862-a2cc6830d089");
-
-const isModel = computed(() => type.value === "model");
-const isVideo = computed(() => type.value === "video");
-// const isAudio = computed(() => type.value === "audio");
-const isGallery = computed(() => type.value === "gallery");
-const domain = ref(import.meta.env.VITE_DOMAIN_URL);
-const audioSound = ref("");
-const currentSlideIndex = ref(1);
-const { isFullscreen, enter, exit, toggle } = useFullscreen(containerRef);
-
-const isVideoPlaying = ref(false);
-
 defineOptions({
   name: "show-case",
 });
 
 const props = defineProps({
+  active: {
+    type: String,
+    default: () => "",
+  },
   model: {
     type: String,
     default: () => "",
@@ -164,6 +148,25 @@ const props = defineProps({
   },
 });
 
+const iframeRef = ref();
+const containerRef = ref();
+const type = ref("model");
+const defaultType = ref(["model", "video", "audio", "gallery"]);
+const videoRef = ref();
+const modelUrl = import.meta.env.VITE_MODEL_URL;
+const iframeURL = computed(() => modelUrl + props.model);
+
+const isModel = computed(() => type.value === "model");
+const isVideo = computed(() => type.value === "video");
+// const isAudio = computed(() => type.value === "audio");
+const isGallery = computed(() => type.value === "gallery");
+const domain = ref(import.meta.env.VITE_DOMAIN_URL);
+const audioSound = ref("");
+const currentSlideIndex = ref(1);
+const { isFullscreen, enter, exit } = useFullscreen(containerRef);
+
+const isVideoPlaying = ref(false);
+
 const handleSwitchType = (value) => {
   if (defaultType.value.includes(value)) {
     type.value = value;
@@ -204,6 +207,17 @@ const handleFullScreen = () => {
 const handleExitFullScreen = () => {
   exit();
 };
+watchEffect(() => {
+  if (props.active) {
+    let tempType = "";
+    if (props.active === "img") {
+      tempType = "gallery";
+    } else {
+      tempType = props.active;
+    }
+    handleSwitchType(tempType);
+  }
+});
 </script>
 
 <style>

+ 13 - 1
src/store/collect.js

@@ -40,7 +40,8 @@ export const useCollectStore = defineStore({
     model() {
       const model = this.files.find((item) => item.type === "model");
       if (model) {
-        return model.id;
+        // debugger
+        return model.filePath;
       } else {
         return "";
       }
@@ -77,6 +78,17 @@ export const useCollectStore = defineStore({
         return [];
       }
     },
+    firstTab() {
+      if (this.entity.fileType) {
+        if (this.entity.fileType.includes(",")) {
+          return String(this.entity.fileType).split(",")[0];
+        } else {
+          return this.entity.fileType;
+        }
+      } else {
+        return "model";
+      }
+    },
   },
   actions: {
     convertLevel(dictLevel) {

+ 12 - 7
src/views/collect-detail.vue

@@ -6,12 +6,11 @@
         <hero-sub-title :type="3" />
         <div class="detail">
           <div class="detail-wrapper">
-            <div class="back" @click="$router.go(-1)"></div>
-            <!-- {{ files }}
-            {{ entity }} -->
+            <div class="back" @click="$router.push('/collect')"></div>
             <div class="info">
               <!-- <div class="show-case"></div> -->
               <show-case
+                :active="firstTab"
                 :video="video"
                 :gallery="gallery"
                 :audio="audio"
@@ -20,9 +19,15 @@
               <h3 class="title">{{ entity.name }}</h3>
               <div class="label-list">
                 <span v-if="entity.dictAge">时代:{{ entity.dictAge }}</span>
-                <span v-if="entity.dictSource">来源:{{ entity.dictSource }}</span>
-                <span v-if="entity.dictTexture">质地:{{ entity.dictTexture }}</span>
-                <span v-if="entity.dictLevel">级别:{{ entity.dictLevel }}</span>
+                <span v-if="entity.dictSource"
+                  >来源:{{ entity.dictSource }}</span
+                >
+                <span v-if="entity.dictTexture"
+                  >质地:{{ entity.dictTexture }}</span
+                >
+                <span v-if="entity.dictLevel"
+                  >级别:{{ entity.dictLevel }}</span
+                >
               </div>
               <div class="text">
                 {{ entity.description }}
@@ -52,6 +57,7 @@ const video = computed(() => collectStore.video);
 const gallery = computed(() => collectStore.gallery);
 const audio = computed(() => collectStore.audio);
 const model = computed(() => collectStore.model);
+const firstTab = computed(() => collectStore.firstTab);
 const props = defineProps({
   id: {
     type: [String, Number],
@@ -70,7 +76,6 @@ watchEffect(() => {
     document.title = unref(entity).name;
   }
 });
-;
 </script>
 
 <style lang="scss" scoped>

+ 0 - 2
src/views/exhibition.vue

@@ -3,8 +3,6 @@
     <div class="content">
       <sub-header />
       <div class="left">
-        <!-- {{ exhibitionList }} -->
-
         <n-tabs type="line" pane-class="tab-content" v-model:value="currentTab">
           <template #prefix>
             <span class="meta-title">