bill vor 9 Monaten
Ursprung
Commit
300d36e69d
9 geänderte Dateien mit 248 neuen und 31 gelöschten Zeilen
  1. 1 0
      .env
  2. 2 1
      .env.development
  3. 1 0
      .env.production
  4. 5 0
      src/assets/screen_s.svg
  5. 6 0
      src/router.ts
  6. 16 8
      src/store/scene.ts
  7. 7 22
      src/view/login.vue
  8. 197 0
      src/view/relics-scene/index.vue
  9. 13 0
      vite.config.ts

+ 1 - 0
.env

@@ -1,5 +1,6 @@
 VITE_QJ_URL=https://test.4dkankan.com/panorama
 VITE_LASER_URL=https://uat-laser.4dkankan.com/4pc
+VITE_SMART=/smarts/smart-viewer.html
 VITE_API=http://192.168.9.27/
 VITE_4DKK_URL=https://test.4dkankan.com
 

+ 2 - 1
.env.development

@@ -1,4 +1,5 @@
 VITE_QJ_URL=https://test.4dkankan.com/panorama
-VITE_LASER_URL=https://uat-laser.4dkankan.com/4pc
+VITE_LASER_URL=/swss
+VITE_SMART=/smarts/smart-viewer.html
 VITE_API=http://192.168.9.27/
 VITE_4DKK_URL=https://test.4dkankan.com

+ 1 - 0
.env.production

@@ -1,4 +1,5 @@
 VITE_QJ_URL=https://4dkankan.com/panorama
 VITE_LASER_URL=/swss
+VITE_SMART=/smarts/smart-viewer.html
 VITE_API=http://192.168.9.27/
 VITE_4DKK_URL=/swkk

+ 5 - 0
src/assets/screen_s.svg

@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M7.5 0C7.22386 0 7 0.223858 7 0.5V15.5C7 15.7761 7.22386 16 7.5 16C7.77614 16 8 15.7761 8 15.5V0.5C8 0.223858 7.77614 0 7.5 0Z" fill="white"/>
+<path d="M0 3.5C0 2.67157 0.671573 2 1.5 2H5C5.27614 2 5.5 2.22386 5.5 2.5C5.5 2.77614 5.27614 3 5 3H1.5C1.22386 3 1 3.22386 1 3.5V12.5C1 12.7761 1.22386 13 1.5 13H5C5.27614 13 5.5 13.2239 5.5 13.5C5.5 13.7761 5.27614 14 5 14H1.5C0.671573 14 0 13.3284 0 12.5V3.5Z" fill="white"/>
+<path d="M15 3.5C15 2.67157 14.3284 2 13.5 2H10C9.72386 2 9.5 2.22386 9.5 2.5C9.5 2.77614 9.72386 3 10 3H13.5C13.7761 3 14 3.22386 14 3.5V12.5C14 12.7761 13.7761 13 13.5 13H10C9.72386 13 9.5 13.2239 9.5 13.5C9.5 13.7761 9.72386 14 10 14H13.5C14.3284 14 15 13.3284 15 12.5V3.5Z" fill="white"/>
+</svg>

+ 6 - 0
src/router.ts

@@ -29,6 +29,12 @@ const routes: RouteRecordRaw[] = [
     component: () => import("@/view/login.vue"),
   },
   {
+    path: "/relics-scene/:relicsId",
+    name: "query-relics-scene",
+    meta: { title: "文物详情" },
+    component: () => import("@/view/relics-scene/index.vue"),
+  },
+  {
     path: "/tree2",
     name: "query-tree-2",
     meta: { title: "登录" },

+ 16 - 8
src/store/scene.ts

@@ -114,7 +114,7 @@ export const updateScenePointName = async (point: ScenePoint) => {
   relicsId.value && (await refreshScenes());
 };
 
-export const gotoScene = async (scene: Scene, edit = false) => {
+export const getSceneLink = async (scene: Scene, edit = false) => {
   const params = new URLSearchParams();
   if (edit) {
     try {
@@ -130,22 +130,30 @@ export const gotoScene = async (scene: Scene, edit = false) => {
     case SceneType.VR:
       const qjURL = import.meta.env.VITE_QJ_URL;
       params.set("id", scene.sceneCode);
-      window.open(`${qjURL}/${edit ? "edit" : "show"}.html?` + params.toString());
-      break;
+      return `${qjURL}/${edit ? "edit" : "show"}.html?` + params.toString();
     case SceneType.CLUNT:
       params.set("m", scene.sceneCode);
-      window.open(`${import.meta.env.VITE_LASER_URL}/?` + params.toString());
-      break;
+      return `${import.meta.env.VITE_LASER_URL}/?` + params.toString();
     case SceneType.MESH:
       params.set("m", scene.sceneCode);
       const kk_url = import.meta.env.VITE_4DKK_URL;
       const dest = edit ? `${kk_url}/epg.html?${params.toString()}` : `${kk_url}/spg.html?${params.toString()}`;
-      console.log('mesh-url', dest)
-      window.open(dest);
-      break;
+      return dest
     default:
       break;
   }
+}
+
+export const getSliceLink = (relicsId: number) => {
+  const params = new URLSearchParams();
+  // params.set("token", '');
+  params.set('projectId', relicsId.toString())
+  return `${import.meta.env.VITE_SMART}?` + params.toString();
+}
+
+export const gotoScene = async (scene: Scene, edit = false) => {
+  const link = await getSceneLink(scene, edit)
+  link && window.open(link)
 
   // if (scene.sceneCode.startsWith("KJ")) {
   //   const qjURL = import.meta.env.VITE_QJ_URL;

+ 7 - 22
src/view/login.vue

@@ -8,7 +8,7 @@
         <div class="content">
           <div class="info">
             <div class="top">
-              <img src="/image/logo@2x.png" style="visibility: hidden;"/>
+              <img src="/image/logo@2x.png" style="visibility: hidden" />
             </div>
             <div class="center">
               <h1>文物遗产监测巡检平台</h1>
@@ -54,11 +54,7 @@
                     @keydown.enter="submitClick"
                   >
                     <template v-slot:suffix>
-                      <el-icon
-                        :size="20"
-                        @click="flag = !flag"
-                        class="icon-style"
-                      >
+                      <el-icon :size="20" @click="flag = !flag" class="icon-style">
                         <View v-if="flag" />
                         <Hide v-else />
                       </el-icon>
@@ -98,10 +94,7 @@
                 </el-form-item>
 
                 <el-form-item class="panel-form-item">
-                  <el-button
-                    type="primary"
-                    class="fill submit"
-                    @click="submitClick"
+                  <el-button type="primary" class="fill submit" @click="submitClick"
                     >登录</el-button
                   >
                 </el-form-item>
@@ -128,12 +121,7 @@
 
 <script lang="ts" setup>
 import { reactive, watch, ref, computed } from "vue";
-import {
-  View,
-  Hide,
-  DArrowRight,
-  SuccessFilled,
-} from "@element-plus/icons-vue";
+import { View, Hide, DArrowRight, SuccessFilled } from "@element-plus/icons-vue";
 import { login } from "@/store/user";
 import { ElMessage } from "element-plus";
 import { router } from "@/router";
@@ -152,13 +140,11 @@ const verify = ref<any>();
 const isPassing2 = ref(false);
 
 const registerStatus = ref(0);
-const currentStatus = computed(
-  () => (status: number) => status === registerStatus.value
-);
+const currentStatus = computed(() => (status: number) => status === registerStatus.value);
 // 表单
 const form = reactive({
-  phone: import.meta.env.DEV ? "13800000001" : "",
-  psw: import.meta.env.DEV ? "88888888Sw" : "",
+  phone: import.meta.env.DEV ? "88888888888" : "",
+  psw: import.meta.env.DEV ? "Aa123456" : "",
 });
 const verification = reactive({ phone: "", psw: "" });
 
@@ -587,5 +573,4 @@ input[type="password"]::-ms-reveal {
 .register span {
   cursor: pointer;
 }
-
 </style>

+ 197 - 0
src/view/relics-scene/index.vue

@@ -0,0 +1,197 @@
+<template>
+  <div class="rs-layout" v-if="scenes.length">
+    <iframe :src="url" v-if="url" />
+
+    <div class="mount">
+      <el-select
+        v-model="currentId"
+        placeholder="请选择场景"
+        style="width: 120px"
+        class="scene-select"
+        popper-class="scene-select-popper"
+      >
+        <el-option
+          v-for="item in scenes"
+          :key="item.sceneCode"
+          :label="item.sceneName"
+          :value="item.id"
+        >
+          <div class="option">
+            <p>{{ item.startTime }}</p>
+            <p>{{ item.sceneName }}</p>
+          </div>
+        </el-option>
+      </el-select>
+
+      <div class="split-screen">
+        <span @click="gotoSlice">
+          <el-icon class="icon"><ZoomIn /></el-icon>
+          分屏
+        </span>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import { getSceneLink, getSliceLink, Scene, SceneType } from "@/store/scene";
+import { dateFormat } from "@/util";
+import { computed, ref, watch } from "vue";
+import ZoomIn from "@/assets/screen_s.svg";
+import { router } from "@/router";
+
+const scenes = ref<Scene[]>([]);
+const currentId = ref<number>();
+const current = computed(
+  () => currentId.value && scenes.value.find((item) => item.id === currentId.value)
+);
+const url = ref<string>();
+watch(currentId, async (id) => {
+  if (!id) {
+    url.value = void 0;
+  } else {
+    url.value = await getSceneLink(current.value, true);
+  }
+});
+
+const gotoSlice = () => {
+  window.open(getSliceLink(relicsId.value));
+};
+
+const relicsId = computed(() => Number(router.currentRoute.value.params.relicsId));
+const fetchScenes = async () => {
+  if (!relicsId.value) {
+    scenes.value = [];
+    currentId.value = void 0;
+    return;
+  }
+  await setTimeout(() => {}, 100);
+  const codes = ["SG-wh-gSLkoDR4yki", "SG-wh-yr0t9VgE0FA", "SG-wh-w7a5kIyJ7PQ"];
+  scenes.value = codes.map(
+    (code, i) =>
+      ({
+        id: i + 1,
+        sceneCode: code,
+        sceneSource: SceneType.CLUNT,
+        sceneName: `场景名称${i}`,
+        startTime: dateFormat(new Date(2014, i, 1), "yyyy-MM-dd"),
+      } as Scene)
+  );
+
+  if (!current.value) {
+    currentId.value = scenes.value[0].id;
+  }
+};
+watch(relicsId, fetchScenes, { immediate: true });
+</script>
+
+<style lang="scss" scope>
+.rs-layout {
+  position: relative;
+  width: 100%;
+  height: 100%;
+
+  iframe {
+    display: block;
+    width: 100%;
+    height: 100%;
+    border: none;
+    padding: 0;
+    margin: 0;
+  }
+}
+.mount {
+  position: absolute;
+  bottom: 10px;
+  left: 50%;
+  transform: translateX(-50%);
+  padding: 0 20px;
+  height: 40px;
+  border-radius: 20px;
+  display: flex;
+  align-items: center;
+  background: rgba(26, 26, 26, 0.8);
+  box-shadow: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.1);
+  border-radius: 58px 58px 58px 58px;
+  border: 1px solid #000000;
+}
+
+.option {
+  padding: 8px 0;
+  p {
+    margin: 0 !important;
+    font-family: Microsoft YaHei, Microsoft YaHei;
+  }
+  p:first-child {
+    font-size: 16px;
+    color: #ffffff;
+    line-height: 19px;
+    margin-bottom: 4px !important;
+  }
+  p:last-child {
+    font-size: 12px;
+    color: rgba(255, 255, 255, 0.7);
+    line-height: 14px;
+    margin-bottom: 4px;
+  }
+}
+
+.split-screen {
+  margin-left: 16px;
+  display: flex;
+  align-items: center;
+  color: #ffffff;
+
+  &::before {
+    content: "";
+    display: block;
+    width: 2px;
+    margin-right: 16px;
+    background: rgba(255, 255, 255, 0.16);
+    height: 16px;
+  }
+  span {
+    cursor: pointer;
+    display: inline-flex;
+    align-items: center;
+
+    .icon {
+      margin-right: 6px;
+    }
+  }
+}
+</style>
+
+<style lang="scss">
+.scene-select {
+  --el-fill-color-blank: rgba(0, 0, 0, 0);
+  --el-border-color: rgba(0, 0, 0, 0);
+  --el-color-primary: rgba(0, 0, 0, 0);
+  --el-border-color-hover: rgba(0, 0, 0, 0);
+  --el-text-color-regular: #fff;
+  --el-text-color-placeholder: #fff;
+}
+.scene-select-popper {
+  --el-bg-color-overlay: rgba(27, 27, 28, 0.8);
+  --el-border-color-light: #000000;
+  --el-box-shadow-light: inset 0px 0px 0px 2px rgba(255, 255, 255, 0.1);
+  --el-fill-color-light: rgba(255, 255, 255, 0.1);
+
+  &.el-popper[data-popper-placement^="top"] .el-popper__arrow:before {
+    border: none;
+    width: 0;
+    height: 0;
+    background: none;
+    border-left-color: transparent;
+    border: 7px solid transparent;
+    border-top-color: var(--el-bg-color-overlay) !important;
+    transform: rotate(0) translate(0, 6px);
+  }
+
+  .el-select-dropdown__item {
+    height: auto;
+    line-height: inherit;
+    margin: 8px 0;
+  }
+}
+</style>

+ 13 - 0
vite.config.ts

@@ -45,6 +45,19 @@ export default ({ mode }: any) =>
           changeOrigin: true,
           rewrite: (path) => path.replace(/^\/relics/, "/relics"),
         },
+        "/swss": {
+          target: loadEnv(mode, process.cwd()).VITE_API,
+          changeOrigin: true,
+        },
+        "/laser": {
+          target: loadEnv(mode, process.cwd()).VITE_API,
+          changeOrigin: true,
+        },
+        "/smarts": {
+          target: loadEnv(mode, process.cwd()).VITE_API,
+          changeOrigin: true,
+        },
+        
         // "/api": {
         //   target: `https://uat-sp.4dkankan.com/`,
         //   // target: `http://192.168.0.11:8324/relics/`,