From 75e8b201c5094714894b1b6206b8811eab2bfd20 Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期五, 06 六月 2025 09:34:28 +0800 Subject: [PATCH] Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb --- public/images/earth/影像.png | 0 src/views/GisView.vue | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/assets/img/screen/dq.png | 0 public/images/earth/地形.png | 0 src/store/simulation.js | 20 +++--- public/images/earth/地图.png | 0 6 files changed, 168 insertions(+), 9 deletions(-) diff --git "a/public/images/earth/\345\234\260\345\233\276.png" "b/public/images/earth/\345\234\260\345\233\276.png" new file mode 100644 index 0000000..64d1f2e --- /dev/null +++ "b/public/images/earth/\345\234\260\345\233\276.png" Binary files differ diff --git "a/public/images/earth/\345\234\260\345\275\242.png" "b/public/images/earth/\345\234\260\345\275\242.png" new file mode 100644 index 0000000..5de3cda --- /dev/null +++ "b/public/images/earth/\345\234\260\345\275\242.png" Binary files differ diff --git "a/public/images/earth/\345\275\261\345\203\217.png" "b/public/images/earth/\345\275\261\345\203\217.png" new file mode 100644 index 0000000..126d82c --- /dev/null +++ "b/public/images/earth/\345\275\261\345\203\217.png" Binary files differ diff --git a/src/assets/img/screen/dq.png b/src/assets/img/screen/dq.png new file mode 100644 index 0000000..a1422af --- /dev/null +++ b/src/assets/img/screen/dq.png Binary files differ diff --git a/src/store/simulation.js b/src/store/simulation.js index d5c460d..4bfc089 100644 --- a/src/store/simulation.js +++ b/src/store/simulation.js @@ -23,12 +23,12 @@ const weatherShow = ref(false) const barShow = ref(false) const deviceShow = ref(false) - const showResultAssess = ref(false) const showLayerTree = ref(true) - const showDangerAssess = ref(false) const schemCard = ref([]) const backToHome = ref(false) const selectedScheme = ref(null) + // 妯℃嫙浠跨湡鍥句緥 + const isShowEarth = ref(false) // 闄嶉洦鏁版嵁鍒楄〃 const rainFalls = ref() // 闄嶉洦鍗曚綅 @@ -58,8 +58,6 @@ rightRiverShow.value = false showPreview.value = false deviceShow.value = false - showResultAssess.value = false - showDangerAssess.value = false schemCard.value = [] } @@ -102,24 +100,29 @@ init() flyToHomeView() locationShow.value = true + isShowEarth.value = true + } const startZHJC = () => { init() functionShow.value = true deviceShow.value = true + isShowEarth.value = true + } const startMNFZ = () => { init() leftShow.value = true - // rightRiverShow.value = true + isShowEarth.value = false + } const startMNPG = () => { init() - // showResultAssess.value = true - // showDangerAssess.value = true + isShowEarth.value = false + } const setBackToHome = (value) => { @@ -162,9 +165,7 @@ weatherShow, barShow, deviceShow, - showResultAssess, showLayerTree, - showDangerAssess, schemCard, backToHome, rainFalls, @@ -172,6 +173,7 @@ DangerPoint, DeviceShowSwitch, DangerShowSwitch, + isShowEarth, // 鏂规鐩稿叧鏂规硶 setSchemCard, diff --git a/src/views/GisView.vue b/src/views/GisView.vue index 70bcd45..2c9fab3 100644 --- a/src/views/GisView.vue +++ b/src/views/GisView.vue @@ -1,5 +1,30 @@ <template> <div id="gis-view" ref="mapRef"></div> + <!-- 鍒囨崲搴曞浘褰卞儚 --> + <div + @click="handleShow" + class="diqiu" + :class="{ 'shift-right': simStore.isShowEarth }" + > + <img src="@/assets/img/screen/dq.png" alt="" /> + </div> + <div + v-show="picShow" + class="earthBox" + :class="{ 'shift-right': simStore.isShowEarth }" + > + <div + v-for="(item, index) in views" + :key="index" + :class="['item-container', { active: currentIndex === index }]" + @click="switchView(index)" + > + <div class="icon-wrapper"> + <img :src="getImageUrl(item.icon)" :alt="item.label" /> + <span class="label">{{ item.label }}</span> + </div> + </div> + </div> </template> <script setup> @@ -17,7 +42,69 @@ import { getDistrictCount, getDistrictCountByCity } from "@/api/index"; import { useRoute } from "vue-router"; import { EventBus } from "@/eventBus"; // 寮曞叆浜嬩欢鎬荤嚎 +import { useSimStore } from "@/store/simulation"; +const simStore = useSimStore(); +const views = [ + { label: "鍦板浘", value: "map", icon: "鍦板浘.png" }, + { label: "褰卞儚", value: "image", icon: "褰卞儚.png" }, + { label: "鍦板舰", value: "terrain", icon: "鍦板舰.png" }, +]; + +const getImageUrl = (iconName) => { + return `/images/earth/${iconName}`; +}; + +const picShow = ref(false); + +const handleShow = () => { + picShow.value = !picShow.value; +}; + +const currentIndex = ref(-1); + +let currentLayer = null; + +const switchView = async (index) => { + currentIndex.value = index; + + // 濡傛灉宸茬粡鏈夊浘灞傚瓨鍦紝鍏堜粠鍦板浘涓Щ闄� + if (currentLayer) { + currentLayer.removeFromMap(); + currentLayer = null; // 娓呯┖寮曠敤 + } + + if (views[index].value === "map") { + // 鐧惧害鍦板浘 + currentLayer = await earthCtrl.factory.createImageryLayer({ + sourceType: "baidu", + url: "https://ss1.bdstatic.com/8bo_dTSlR1gBo1vgoIiO_jowehsv/tile/?qt=vtile&x={x}&y={y}&z={z}&styles=pl&udt=20180810&scaler=1&showtext=1", + }); + } else if (views[index].value === "image") { + currentLayer = await earthCtrl.factory.createImageryLayer({ + sourceType: "mapworld", + url: "https://t0.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=3ec79cf7a9dcc6bb18411a5414b148cb", + layers: "tdtBasicLayer", + style: "default", + format: "image/jpeg", + maximumLevel: 18, + layer: "", + tileMatrixSetID: "", + }); + //鏍囨敞灞� + currentLayer = await earthCtrl.factory.createImageryLayer({ + sourceType: "mapworld", + subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], + url: "https://{s}.tianditu.gov.cn/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&tk=c53eb074c3fcba5ac86103d4d711bbe8", + }); + } else if (views[index].value === "terrain") { + // 鍦板舰鍥惧眰 + currentLayer = await earthCtrl.factory.createTerrainLayer({ + sourceType: "arcgis", + url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer", + }); + } +}; const route = useRoute(); let handler = null; function initMap() { @@ -43,6 +130,8 @@ //鏄剧ずfps earthCtrl.showFPS = true; + + // 绯荤粺鐩墠榛樿浣跨敤鐨� earthCtrl.factory.createImageryLayer({ sourceType: "mapworld", url: "http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=7eb11c0c503429878691ac917238f87f", @@ -474,9 +563,77 @@ height: 100vh; position: absolute; } + // // 淇敼鎸囧崡閽堜綅缃� /deep/ .compass { right: 128px !important; top: 112px; } + +.diqiu { + position: absolute; + bottom: 8%; + right: 4%; + z-index: 9999; +} + +.earthBox { + z-index: 9999; + width: 12%; + height: 7%; + background-color: rgba(0, 9, 9, 0.3); + position: absolute; + right: 8%; + bottom: 6%; + display: flex; + justify-content: space-evenly; + padding: 10px 6px; +} + +.icon-wrapper { + position: relative; + margin: 0; + padding: 0; + box-sizing: border-box; + border: 1px solid transparent; /* 榛樿閫忔槑杈规鍗犱綅 */ + + img { + height: 100%; + width: auto; /* 纭繚鍥剧墖鎸夋瘮渚嬬缉鏀� */ + margin: 0; + padding: 0; + display: block; /* 绉婚櫎鍥剧墖涓嬫柟鍙兘瀛樺湪鐨勭┖鐧介棿闅� */ + } + + .label { + position: absolute; + bottom: 0; + right: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.5); + text-align: center; + color: white; + } +} + +.item-container { + position: relative; + display: inline-block; + cursor: pointer; +} + +.item-container.active .icon-wrapper { + border: 1px solid #218967; /* 钃濊壊杈规 */ +} + +.item-container.active .label { + background-color: rgba(33, 137, 103, 0.8); +} + +.diqiu.shift-right { + right: 10%; +} +.earthBox.shift-right { + right: 13%; +} </style> -- Gitblit v1.9.3