From 42c9f118fffee7f5c705e66317e87f1267e888aa Mon Sep 17 00:00:00 2001 From: DIAMOND <276397553@qq.com> Date: Fri, 5 Jan 2024 10:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8store=E5=AD=98=E5=82=A8XbsjEa?= =?UTF-8?q?rthUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/earthMap.ts | 1 + src/views/earthMap/edit/EarthComp copy.vue | 2608 +++++++++++++++++ src/views/earthMap/edit/EarthComp.vue | 22 + src/views/earthMap/edit/EarthCompTest.vue | 1904 ++++++++++++ .../scene/model/sceneInfo/SenceInfo.vue | 23 +- 5 files changed, 4553 insertions(+), 5 deletions(-) create mode 100644 src/views/earthMap/edit/EarthComp copy.vue create mode 100644 src/views/earthMap/edit/EarthCompTest.vue diff --git a/src/store/modules/earthMap.ts b/src/store/modules/earthMap.ts index 23d88fa..a63e636 100644 --- a/src/store/modules/earthMap.ts +++ b/src/store/modules/earthMap.ts @@ -20,6 +20,7 @@ export const useEarthMapStore = defineStore({ shapeShowList: [], //绘画存储(临时) keyAreaPos: [], //记录创建防区的点位,重点管控区域 shipDataList: [], //船只数据列表 + xbsjEarthUI: null, //XbsjEarthUI }), getters: { getCustomPrimitiveList(): any { diff --git a/src/views/earthMap/edit/EarthComp copy.vue b/src/views/earthMap/edit/EarthComp copy.vue new file mode 100644 index 0000000..7987a30 --- /dev/null +++ b/src/views/earthMap/edit/EarthComp copy.vue @@ -0,0 +1,2608 @@ + + + + + + diff --git a/src/views/earthMap/edit/EarthComp.vue b/src/views/earthMap/edit/EarthComp.vue index bf75c42..1ecb62f 100644 --- a/src/views/earthMap/edit/EarthComp.vue +++ b/src/views/earthMap/edit/EarthComp.vue @@ -116,6 +116,7 @@ import circleDot1 from '@/assets/earthMap/circleDot1.png'; import circleDot3 from '@/assets/earthMap/circleDot3.png'; import ship from '@/assets/images/ship.png'; + import { onBeforeUnmount } from 'vue'; class HandleNodeType { #sn; @@ -528,6 +529,8 @@ createEarth() { let that = this; + //使用store存储XbsjEarthUI + this.store.xbsjEarthUI = XbsjEarthUI; XbsjEarthUI.create('earthContainer').then(async (earthUI: any) => { // 设置全局变量,可调试 window.$uia = earthUI; @@ -4188,6 +4191,8 @@ // 资源销毁 beforeDestroy() { // vue程序销毁时,需要清理相关资源 + console.log("vue程序销毁"); + this._earth = this._earth && this._earth.destroy(); this.websocketclose(); //清除定时器 @@ -4195,6 +4200,23 @@ clearInterval(this.timer2); clearInterval(this.alarmTrackClearTimer); } + // 资源销毁 + destroy(){ + // vue程序销毁时,需要清理相关资源 + console.log("vue程序销毁",this._earth); + + + // this.websocketclose(); + //清除定时器 + clearInterval(this.timer); + clearInterval(this.timer2); + clearInterval(this.alarmTrackClearTimer); + // window.$uia.tools.sceneTree.destroy() + // this._earth = this._earth && this._earth.destroy(); + //利用store.xbsjEarthUI 重新赋值 window.XbsjEarthUI + window.XbsjEarthUI = this.store.xbsjEarthUI + this._earth = undefined; + } } diff --git a/src/views/earthMap/edit/EarthCompTest.vue b/src/views/earthMap/edit/EarthCompTest.vue new file mode 100644 index 0000000..ed9008e --- /dev/null +++ b/src/views/earthMap/edit/EarthCompTest.vue @@ -0,0 +1,1904 @@ + + + + + diff --git a/src/views/military/modules/earthMap/scene/model/sceneInfo/SenceInfo.vue b/src/views/military/modules/earthMap/scene/model/sceneInfo/SenceInfo.vue index 6505bbf..e990941 100644 --- a/src/views/military/modules/earthMap/scene/model/sceneInfo/SenceInfo.vue +++ b/src/views/military/modules/earthMap/scene/model/sceneInfo/SenceInfo.vue @@ -119,13 +119,13 @@ title="拾取中心坐标和相机数据" :visible="mapVisible" @ok="handleOk" - @cancel="()=> mapVisible = false" + @cancel="destroyed" width="60vw" - :destroyOnClose="true" + destroyOnClose wrapClassName="EarthMap"> - + - + @@ -135,13 +135,26 @@