Преглед на файлове

虚拟场景页面,如果还没有实际的虚拟场景,给出无场景提示。

任一存 преди 2 години
родител
ревизия
b7dc9b51fb
променени са 3 файла, в които са добавени 94 реда и са изтрити 8 реда
  1. 14 0
      code/src/utils/index.js
  2. 1 1
      code/src/views/home/list.vue
  3. 79 7
      code/src/views/zhanlan/index.vue

+ 14 - 0
code/src/utils/index.js

@@ -0,0 +1,14 @@
+export function throttle(fn, interval) {
+  let lastRunTime = 0
+
+  return function (...args) {
+    let elapsedTime = Date.now() - lastRunTime
+    if (elapsedTime < interval) {
+      return
+    }
+
+    let context = this
+    lastRunTime = Date.now()
+    fn.apply(context, args)
+  }
+}

+ 1 - 1
code/src/views/home/list.vue

@@ -41,7 +41,7 @@ const onClickSelect = (data) => {
 }
 
 const onClickItem = data => {
-  if (currentId === 'museum') {
+  if (currentId.value === 'museum') {
     if (data.name === '广东省博物馆') {
       router.push({name: 'gdmuseum'})
     } else {

+ 79 - 7
code/src/views/zhanlan/index.vue

@@ -1,32 +1,104 @@
 <template>
-    <div class="zhanlan">
-      <iframe v-if="currentScene" :src="`https://gdbwg.4dage.com${currentScene.filePath}/wwwroot/spg.html?m=${currentScene.fileName.replace('.zip','')}`" frameborder="0"></iframe>
+    <div
+      class="zhanlan"
+      :class="{
+        mobile: isMobile,
+      }"
+    >
+      <iframe v-if="currentScene && currentScene.filePath && currentScene.fileName" :src="`https://gdbwg.4dage.com${currentScene.filePath}/wwwroot/spc.html?m=${currentScene.fileName.replace('.zip','')}`" frameborder="0"></iframe>
+      <div class="empty-tip" v-else>
+        <img src="@/assets/images/resource/searchNone.svg" alt="no result" draggable="false">
+        <span>暂无展览场景</span>
+        <img
+          class="close"
+          @click="onClickClose"
+          :src="require(`@/assets/images/icon/close.png`)"
+        />
+      </div>
     </div>
 </template>
 
 <script setup>
 import { ref, reactive, onMounted, watch, computed, nextTick } from "vue";
-
 import { getExhibitionDetail } from "@/config/api";
-
 import { useRouter, useRoute } from "vue-router";
+import { throttle } from "@/utils/index.js";
 
 const route = useRoute();
+const router = useRouter()
 
 const currentScene = ref(null)
 
 getExhibitionDetail({id:route.params.id},data=>{
   currentScene.value = data.data
 })
-  
+
+const onClickClose = throttle(() => {
+  router.go(-1)
+}, 1000)
+
+import browser from '@/utils/browser'
+const isMobile = ref(false)
+onMounted(() => {
+  if (browser.isMobile()) {
+    isMobile.value = true
+  } else {
+    isMobile.value = false
+  }
+})
 </script>
 
 <style lang="scss" scoped>
-.zhanlan{
+.zhanlan {
   width: 100%;
-  >iframe{
+  > iframe {
     width: 100%;
     height: 100%;
   }
+  > .empty-tip {
+    width: 100%;
+    height: 100%;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-direction: column;
+    position: relative;
+    img {
+      width: 240px;
+      height: 216px;
+    }
+    span {
+      margin-top: 24px;
+      font-size: 24px;
+      font-family: Source Han Sans CN-Regular, Source Han Sans CN;
+      color: #333333;
+      line-height: 36px;
+    }
+    .close {
+      position: absolute;
+      top: 40px;
+      right: 60px;
+      width: 70px;
+      height: 70px;
+      cursor: pointer;
+    }
+  }
+}
+
+.zhanlan.mobile {
+  > .empty-tip {
+    img {
+      width: 50%;
+      height: auto;
+    }
+    span {
+      margin-top: 20px;
+      font-size: 20px;
+      line-height: 30px;
+    }
+    .close {
+      display: none;
+    }
+  }
 }
 </style>