dedsudiyu vor 1 Monat
Ursprung
Commit
7ba5247d33

BIN
public/models/demo1.glb


+ 5 - 5
src/router/index.js

@@ -43,11 +43,11 @@ export const constantRoutes = [
   //   component: (resolve) => require(['@/views/demo5'], resolve),
   //   hidden: true
   // },
-  // {
-  //   path: '/demo6',
-  //   component: (resolve) => require(['@/views/demo6'], resolve),
-  //   hidden: true
-  // },
+  {
+    path: '/demo6',
+    component: (resolve) => require(['@/views/demo6'], resolve),
+    hidden: true
+  },
   // {
   //   path: '/demo7',
   //   component: (resolve) => require(['@/views/demo7'], resolve),

+ 44 - 13
src/views/cengterMaxBox/canvasMap/index.vue

@@ -14,6 +14,7 @@
   export default {
     data() {
       return {
+        animationId: null,  // 存储动画帧ID
         model:null,
         rotateType:true,
         subModels: [],
@@ -134,6 +135,15 @@
     },
 
     beforeDestroy() {
+      // 停止动画循环
+      if (this.animationId) {
+        cancelAnimationFrame(this.animationId);
+      }
+      // 销毁Three.js相关资源
+      this.disposeThreeResources();
+      // 停止所有补间动画
+      TWEEN.removeAll();
+      // 移除事件监听器
       window.removeEventListener('resize', this.onWindowResize);
       this.renderer.dispose();
     },
@@ -254,19 +264,13 @@
           this.model.rotation.y += 0.001; // 添加简单旋转动画
         }else if(this.model&&!this.rotateType){
             this.model.rotation.y = 0;
-          // if(this.model.rotation.y > 10){
-          //   this.model.rotation.y -= 10;
-          // }else if(this.model.rotation.y > 1){
-          //   this.model.rotation.y -= 1;
-          // }else if(this.model.rotation.y > 0.1){
-          //   this.model.rotation.y -= 0.1;
-          // }else if(this.model.rotation.y > 0.01){
-          //   this.model.rotation.y -= 0.01;
-          // }else if(this.model.rotation.y > 0.001){
-          //   this.model.rotation.y -= 0.001;
-          // }
         }
-        requestAnimationFrame(this.animate);
+        // requestAnimationFrame(this.animate);
+        // TWEEN.update();
+        // this.controls.update();
+        // this.renderer.render(this.scene, this.camera);
+        // this.labelRenderer.render(this.scene, this.camera);
+        this.animationId = requestAnimationFrame(this.animate);
         TWEEN.update();
         this.controls.update();
         this.renderer.render(this.scene, this.camera);
@@ -805,7 +809,34 @@
         function isInner(userIp,begin,end){
           return (userIp>=begin) && (userIp<=end);
         }
-      }
+      },
+      // 资源销毁方法
+      disposeThreeResources() {
+        // 释放几何体和材质
+        this.scene.traverse(child => {
+          if (child.isMesh) {
+            child.geometry.dispose();
+            if (Array.isArray(child.material)) {
+              child.material.forEach(m => m.dispose());
+            } else {
+              child.material.dispose();
+            }
+          }
+        });
+
+        // 释放渲染器
+        this.renderer.dispose();
+        this.labelRenderer.domElement.remove();
+        this.labelRenderer = null;
+
+        // 释放场景和相机
+        this.scene = null;
+        this.camera = null;
+
+        // 释放控制器
+        this.controls.dispose();
+        this.controls = null;
+      },
     }
   };
 </script>

+ 52 - 9
src/views/cengterMaxBox/overdueServiceEquipmentStatistics/index.vue

@@ -25,6 +25,11 @@
         echartsBox:null,
         // 定时器
         echartsTimer:null,
+        minTimer:null,
+        //数据
+        dataList:[],
+        numIndex:0,
+        maxNum: 0,
       }
     },
     created () {
@@ -37,17 +42,55 @@
     methods: {
       getList(){
         reportReportBsEquipOverdueList().then(response => {
-          let obj = {
-            nameList:[],
-            dataList:[],
-          }
-          response.data.forEach((item)=>{
-            obj.nameList.push(item.deptName);
-            obj.dataList.push(item.deviceNum);
-          })
-          this.eChartsMethod(obj);
+          this.$set(this,'numIndex',0);
+          this.$set(this,'maxNum',response.data.length-1);
+          this.$set(this,'dataList',response.data);
+          this.minTimeFunction();
+          // let obj = {
+          //   nameList:[],
+          //   dataList:[],
+          // }
+          // response.data.forEach((item)=>{
+          //   obj.nameList.push(item.deptName);
+          //   obj.dataList.push(item.deviceNum);
+          // })
+          // this.eChartsMethod(obj);
         })
       },
+      minTimeFunction(){
+        let self = this;
+        showTime();
+        if(!this.minTimer){
+          this.minTimer = window.setInterval(showTime, 10000);
+        }
+        function showTime() {
+          if(self.dataList[0]){
+            let newList = [];
+            for(let i=0;i<5;i++){
+              if(self.dataList[self.numIndex]){
+                newList.push(self.dataList[self.numIndex])
+                if(self.numIndex<self.maxNum){
+                  self.numIndex++;
+                }else{
+                  self.numIndex=0;
+                  break
+                }
+              }
+            }
+            let obj = {
+              nameList:[],
+              dataList:[],
+            }
+            if(newList[0]){
+              newList.forEach((item)=>{
+                  obj.nameList.push(item.deptName);
+                  obj.dataList.push(item.deviceNum);
+              })
+              self.eChartsMethod(obj);
+            }
+          }
+        }
+      },
       eChartsMethod(obj){
         let option = {
           tooltip: {

+ 2 - 32
src/views/cengterMaxBox/videoSurveillance/pageComponent/videoComponent.vue

@@ -152,38 +152,8 @@
         //   {
         //     width:this.width,
         //     height:this.height,
-        //     url:'wss://labcontrol.nwafu.edu.cn/proxy/172.16.0.68:559/openUrl/luk8N32',
-        //     cameraIndexCode:'c451e9f079874b6ea6ddb1eb4f55d410',
-        //   },
-        //   {
-        //     width:this.width,
-        //     height:this.height,
-        //     url:'wss://labcontrol.nwafu.edu.cn/proxy/172.16.0.68:559/openUrl/luk8N32',
-        //     cameraIndexCode:'555848cb4ef64234817778ef48e07108',
-        //   },
-        //   {
-        //     width:this.width,
-        //     height:this.height,
-        //     url:'wss://labcontrol.nwafu.edu.cn/proxy/172.16.0.68:559/openUrl/luk8N32',
-        //     cameraIndexCode:'87acbd68f5304e62b054de724d6a73c0',
-        //   },
-        //   {
-        //     width:this.width,
-        //     height:this.height,
-        //     url:'wss://labcontrol.nwafu.edu.cn/proxy/172.16.0.68:559/openUrl/luk8N32',
-        //     cameraIndexCode:'c451e9f079874b6ea6ddb1eb4f55d411',
-        //   },
-        //   {
-        //     width:this.width,
-        //     height:this.height,
-        //     url:'wss://labcontrol.nwafu.edu.cn/proxy/172.16.0.68:559/openUrl/luk8N32',
-        //     cameraIndexCode:'555848cb4ef64234817778ef48e07102',
-        //   },
-        //   {
-        //     width:this.width,
-        //     height:this.height,
-        //     url:'wss://labcontrol.nwafu.edu.cn/proxy/172.16.0.68:559/openUrl/luk8N32',
-        //     cameraIndexCode:'87acbd68f5304e62b054de724d6a73c3',
+        //     url:'ws://172.16.0.68:559/openUrl/Sg0ajRK?beginTime=20250305T132000&endTime=20250305T132500',
+        //     cameraIndexCode:'f0192a7ffd014509a8f2e8f3bc0936cf',
         //   },
         // ];
         // this.$set(this,'videoList',list)

+ 7 - 4
src/views/demo6.vue

@@ -117,6 +117,8 @@
       moveCameraToModel(model,name) {
         console.log('点击=>model=>',model)
         console.log('点击=>name=>',name)
+        console.log('点击=>scene=>',this.scene)
+        console.log('点击=>subModels=>',this.subModels)
         let self = this;
         // 禁用控制器
         this.controls.enabled = false;
@@ -226,9 +228,9 @@
         this.controls.dampingFactor = 0.05;
 
         // 添加灯光
-        const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
+        const ambientLight = new THREE.AmbientLight(0xffffff, 1);
         this.scene.add(ambientLight);
-        const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
+        const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
         directionalLight.position.set(0, 5, 5);
         this.scene.add(directionalLight);
 
@@ -238,13 +240,14 @@
       //模型加载
       loadModel() {
         const loader = new GLTFLoader();
-        loader.load('/models/xiaoQuB.glb', (gltf) => {
+        loader.load('/models/demo1.glb', (gltf) => {
           const model = gltf.scene;
           this.scene.add(model);
 
           // 获取所有子模型并计算中心点
           model.traverse((child) => {
-            if (child.isMesh) {
+            console.log(child)
+            if (child.isGroup) {
               const center = this.getBoundingBoxCenter(child);
               this.subModels.push({
                 name: child.name,

+ 4 - 4
src/views/home.vue

@@ -89,11 +89,11 @@
     <!--左侧遮罩-->
     <div class="back-l-img"></div>
     <!--中央遮罩-->
-    <div class="back-c-img"></div>
+    <div class="back-c-img" v-if="pageType == 1 && deptVideoType"></div>
     <!--右侧遮罩-->
     <div class="back-r-img"></div>
     <!--地图层南校区-->
-    <div class="map-max-big-box">
+    <div class="map-max-big-box" v-if="!deptVideoType">
       <canvasMap ref="canvasMap" class="map-box"></canvasMap>
     </div>
     <!--左侧报警提示-->
@@ -758,7 +758,7 @@
     background-size: 100% 100%;
   }
   .back-c-img{
-    z-index: 13;
+    z-index: 14;
     position: absolute;
     top:0;
     left:1790px;
@@ -779,7 +779,7 @@
     background-size: 100% 100%;
   }
   .map-max-big-box{
-    z-index: 14;
+    z-index: 10;
     position: absolute;
     width:5927px;
     height: 2160px;