Browse Source

更改噪声图片、进度条问题

Rmengdi 3 tháng trước cách đây
mục cha
commit
d6ff8224a7

+ 60 - 40
uavps-web/src/views/system/task/index.vue

@@ -699,7 +699,7 @@
                 :text-inside="true"
                 :stroke-width="26"
                 v-if="isUpdateView"
-                :percentage="percentage"
+                :percentage="percentage > 100 ? 100 : percentage"
               ></el-progress>
             </el-col>
           </el-row>
@@ -846,6 +846,7 @@ import {
 import * as PIXI from "pixi.js";
 import platformPNG from "../../textures/platform.png";
 import uavTarPNG from "../../textures/uav-tar.png";
+import noisePNG from "../../textures/noise.png";
 
 export default {
   name: "Task",
@@ -1416,9 +1417,9 @@ export default {
     handlePlayback(row) {
       this.parameterId = row.bizId || this.ids;
       this.playbackTime = row.totalDuration;
+      this.title = "回放";
       this.showTrajectory = true;
       this.isUpdateView = true;
-      this.title = "回放";
     },
     initWebSocket() {
       const wsUri = "ws://127.0.0.1:8080/websocket/message";
@@ -1460,8 +1461,11 @@ export default {
     endHandle() {
       let msg = "END:" + this.parameterId;
       this.webSocket.send(msg);
-      this.getList();
       this.showTrajectory = false;
+      this.loading = true;
+      setTimeout(() => {
+        this.getList();
+      }, 1500);
     },
 
     // 居中
@@ -1680,8 +1684,8 @@ export default {
             const northSpeed = newData[i].northSpeed;
             targetUav.rotation = Math.atan2(northSpeed, eastSpeed);
 
-            const cx = targetUav.x - 10;
-            const cy = targetUav.y - 6;
+            const cx = targetUav.x - 5;
+            const cy = targetUav.y - 3;
 
             const circle = this.targetUavCircleR[`${id}`];
             circle.x = cx;
@@ -1727,29 +1731,33 @@ export default {
             // 更新路径绘制
             this.updatePath(id, targetUav.x, targetUav.y);
           }
-          if (this.isUpdateView && i == 0) {
-            const viewSprite = this.pixiApp.stage.children.find((item) => {
-              return (
-                item.id == data.targetAircraft[0].aircrafts[0].aircraftNumber
-              );
-            });
-            // 获取精灵的边界
-            const spriteBounds = viewSprite.getBounds();
-            // 检测是否移出画布
-            if (spriteBounds.left < 0) {
-              // 触碰到了左边界
-              this.pixiApp.stage.x += this.container.clientWidth / 2;
-            } else if (spriteBounds.right > this.container.clientWidth) {
-              // 触碰到了右边
-              this.pixiApp.stage.x -= this.container.clientWidth / 2;
-            } else if (spriteBounds.top < 0) {
-              // 触碰到了上边
-              this.pixiApp.stage.y += this.container.clientHeight / 2;
-            } else if (spriteBounds.bottom > this.container.clientHeight) {
-              // 触碰到了下边
-              this.pixiApp.stage.y -= this.container.clientHeight / 2;
-            }
-          }
+          // if (this.isUpdateView && i == 0) {
+          //   console.log(
+          //     "11",
+          //     data.targetAircraft[0].aircrafts[0].aircraftNumber
+          //   );
+          //   const viewSprite = this.pixiApp.stage.children.find((item) => {
+          //     return (
+          //       item.id == data.targetAircraft[0].aircrafts[0].aircraftNumber
+          //     );
+          //   });
+          //   // 获取精灵的边界
+          //   const spriteBounds = viewSprite.getBounds();
+          //   // 检测是否移出画布
+          //   if (spriteBounds.left < 0) {
+          //     // 触碰到了左边界
+          //     this.pixiApp.stage.x += this.container.clientWidth / 2;
+          //   } else if (spriteBounds.right > this.container.clientWidth) {
+          //     // 触碰到了右边
+          //     this.pixiApp.stage.x -= this.container.clientWidth / 2;
+          //   } else if (spriteBounds.top < 0) {
+          //     // 触碰到了上边
+          //     this.pixiApp.stage.y += this.container.clientHeight / 2;
+          //   } else if (spriteBounds.bottom > this.container.clientHeight) {
+          //     // 触碰到了下边
+          //     this.pixiApp.stage.y -= this.container.clientHeight / 2;
+          //   }
+          // }
 
           this.cycleCount++;
         }
@@ -1798,13 +1806,21 @@ export default {
     // 新建一个飞机
     addAir(data, isZhen) {
       const targetTexture = new PIXI.Texture.from(uavTarPNG);
+      const noiseTexture = new PIXI.Texture.from(noisePNG);
       const group = new PIXI.Container();
       group.id = data.aircraftNumber;
 
       // 创建无人机
-      const dude = new PIXI.Sprite(targetTexture);
-      dude.anchor.set(0.5, 0.5);
-      dude.scale.set(0.01);
+      let dude;
+      if (isZhen) {
+        dude = new PIXI.Sprite(targetTexture);
+        dude.anchor.set(0.5, 0.5);
+        dude.scale.set(0.01);
+      } else {
+        dude = new PIXI.Sprite(noiseTexture);
+        dude.anchor.set(0.5, 0.5);
+        dude.scale.set(0.08);
+      }
 
       dude.x = data.coordinateX;
       dude.y = data.coordinateY;
@@ -1815,8 +1831,8 @@ export default {
       group.addChild(dude);
 
       // 创建圆圈  圆圈相对于飞机的位置
-      const cx = dude.x - 10;
-      const cy = dude.y - 6;
+      const cx = dude.x - 5;
+      const cy = dude.y - 3;
 
       //编号-圆圈
       const circle = new PIXI.Graphics();
@@ -1851,9 +1867,9 @@ export default {
         this.targetUavCircleR[`${id}`] = circle;
         this.targetUavCircleNumR[`${id}`] = text;
       } else {
-        dude.alpha = 0.5;
-        circle.alpha = 0.5;
-        text.alpha = 0.5;
+        dude.alpha = 0.7;
+        circle.alpha = 0.7;
+        text.alpha = 0.7;
         this.targetDataN[`${id}`] = dude;
         this.targetUavCircleN[`${id}`] = circle;
         this.targetUavCircleNumN[`${id}`] = text;
@@ -1952,8 +1968,8 @@ export default {
             const northSpeed = newData[i].northSpeed;
             targetUav.rotation = Math.atan2(northSpeed, eastSpeed);
 
-            const cx = targetUav.x - 10;
-            const cy = targetUav.y - 6;
+            const cx = targetUav.x - 5;
+            const cy = targetUav.y - 3;
 
             const circle = this.targetUavCircleN[`${id}`];
             circle.x = cx;
@@ -2356,12 +2372,15 @@ export default {
     },
 
     closeDialog() {
-      const msg = "END:" + this.parameterId;
-      this.webSocket.send(msg);
+      if (!this.isUpdateView) {
+        const msg = "END:" + this.parameterId;
+        this.webSocket.send(msg);
+      }
       this.destroyTrajectory();
       this.showTrajectory = false;
       this.isUpdateView = false;
       this.isClickGroup = false;
+      this.loading = true;
       setTimeout(() => {
         this.getList();
       }, 1500);
@@ -2472,6 +2491,7 @@ export default {
       this.playbackTime = null;
       this.firstAir = "";
       this.secondAir = "";
+      this.percentage = 0;
     },
     // 综合计算(距离、方位角、航向夹角)
     calculateRelativePosition(lat1, lon1, heading1, lat2, lon2, heading2) {

BIN
uavps-web/src/views/textures/noise.png