forked from drone/command-center-dashboard

罗广辉
2025-03-28 1ee14c09d0203569f8ab83194bcb9fedcf267415
feat: 全屏功能
3 files modified
47 ■■■■ changed files
package.json 2 ●●● patch | view | raw | blame | history
src/views/Home/Home.vue 39 ●●●● patch | view | raw | blame | history
src/views/Home/components/HomeRight/UserOperate.vue 6 ●●●●● patch | view | raw | blame | history
package.json
@@ -4,7 +4,7 @@
  "scripts": {
    "dev": "vite --host",
    "prod": "vite --mode production",
    "build": "vite build",
    "build:dev": "vite build --mode development",
    "build:prod": "vite build --mode production",
    "serve": "vite preview --host"
  },
src/views/Home/Home.vue
@@ -8,13 +8,13 @@
<script setup>
import HomeRight from './components/HomeRight/HomeRight.vue';
import HomeLeft from '@/views/Home/components/HomeLeft/HomeLeft.vue';
import { getAggregation } from '@/views/Home/aggregation';
import SearchBox from '@/views/Home/SearchBox.vue';
import jiangxi from '@/assets/geojson/jiangxi.json';
import nanchang from '@/assets/geojson/nanchang.json';
import jiangxishi from '@/assets/geojson/jiangxishi.json';
import zg from '@/assets/geojson/zg.json';
import * as Cesium from 'cesium';
import data1 from '@/assets/images/home/homeRight/data1.png';
import data2 from '@/assets/images/home/homeRight/data2.png';
const list = [
  { name: '县', value: [0,48651], gJson: null },
@@ -33,7 +33,6 @@
const determineScaling = () => {
  let height = viewer.camera.positionCartographic.height;
  console.log('缩放结束,高度为:', height);
  // 根据高度展示对应的 gJson
  for (let item of list) {
    // if (height < item.value) {
@@ -44,6 +43,31 @@
        active.value = item.name;
        if (item.gJson) {
          aggregation(item);
        }else{
          for (let i = 0; i < 50; i++) {
            viewer.entities.add({
              position: Cesium.Cartesian3.fromDegrees(
                115.89 + Math.random() * 0.2,
                28.68 + Math.random() * 0.2
              ),
              label: {
                // 随机整数
                text: Math.floor(Math.random() * 100)+'号机巢',
                font: '14pt monospace',
                fillColor: Cesium.Color.WHITE,
                outlineColor: Cesium.Color.BLACK,
                outlineWidth: 2,
                style: Cesium.LabelStyle.FILL_AND_OUTLINE,
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
                pixelOffset: new Cesium.Cartesian2(0, -9),
              },
              billboard: {
                image: data1,
                width: 24,
                height: 24,
              },
            });
          }
        }
      }
      break;
@@ -73,6 +97,11 @@
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
        pixelOffset: new Cesium.Cartesian2(0, -9),
      },
      billboard: {
        image: data2,
        width: 24,
        height: 24,
      },
    });
  });
  // 加载新的 GeoJSON 数据
@@ -85,8 +114,8 @@
      entity.polygon.material = new Cesium.ColorMaterialProperty(
        Cesium.Color.YELLOW.withAlpha(0) // 透明填充
      );
      entity.polygon.outline = true; // 显示边框
      entity.polygon.outlineColor = Cesium.Color.YELLOW; // 黑色边框
      entity.polygon.outline = new Cesium.ConstantProperty(true); // 显示边框
      entity.polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.YELLOW); // 黑色边框
    });
  });
};
src/views/Home/components/HomeRight/UserOperate.vue
@@ -1,10 +1,12 @@
<script setup></script>
<script setup>
import { fullscreenToggel } from '@/utils/util';
</script>
<template>
  <div class="userOperate">
    <img alt="" src="@/assets/images/home/homeRight/operate1.png" />
    <img alt="" src="@/assets/images/home/homeRight/operate2.png" />
    <img alt="" src="@/assets/images/home/homeRight/operate3.png" />
    <img alt="" src="@/assets/images/home/homeRight/operate3.png"  @click="fullscreenToggel"/>
  </div>
</template>