From a358c49de4680dcde00d543043ef6694b92e7bd1 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 07 Nov 2024 17:18:55 +0800
Subject: [PATCH] global.$viewer更换为window.$viewer 地下管网加载测试 园区范围加载测试

---
 src/hooks/initMap.js |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/hooks/initMap.js b/src/hooks/initMap.js
index dce2117..5569c85 100644
--- a/src/hooks/initMap.js
+++ b/src/hooks/initMap.js
@@ -2,7 +2,7 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2024-10-25 15:09:55
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-10-28 19:42:36
+ * @LastEditTime: 2024-11-07 16:15:48
  * @FilePath: \bigScreen\src\hooks\initMap.js
  * @Description: 
  * 
@@ -10,12 +10,11 @@
  */
 let viewer = null
 const { VITE_APP_BASE } = import.meta.env
-
 import { useMap } from 'store/map'
 import { nextTick } from 'vue'
 
 export function readyViewer () {
-  const { appContext } = getCurrentInstance()
+  const Cesium = DC.getLib('Cesium')
   const store = useMap()
 
   function initMap () {
@@ -23,16 +22,23 @@
 
     nextTick(() => {
       DC.ready({
-        baseUrl: `${VITE_APP_BASE}/libs/dc-sdk/resources/`
+        baseUrl: `${VITE_APP_BASE}libs/dc-sdk/resources/`
       }).then(() => {
 
         viewer = new DC.Viewer('viewer-container')
 
-        const global = appContext.config.globalProperties
+        window.$viewer = viewer
 
-        global.$viewer = viewer
-
-        store.setLoadMap(true)
+        window.$viewer.zoomToPosition(new DC.Position(
+          115.1048036679409,
+          27.276835758787513,
+          4000,
+          0,
+          -90,
+          0
+        ), () => {
+          store.setLoadMap(true)
+        })
       })
     })
   }

--
Gitblit v1.9.3