diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78a752d --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +.DS_Store +node_modules/ +dist/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.local + +package-lock.json +yarn.lock diff --git a/package-lock.json b/package-lock.json index 7ee46ce..a25ac1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "echarts": "^5.5.0", "element-plus": "^2.6.2", "lodash-es": "^4.17.21", + "mitt": "^3.0.1", "mockjs": "^1.1.0", "pinia": "^2.1.7", "vite-plugin-html": "^3.2.2", @@ -3562,6 +3563,11 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, "node_modules/mlly": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.1.tgz", diff --git a/package.json b/package.json index 5cf4974..edba2e0 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "echarts": "^5.5.0", "element-plus": "^2.6.2", "lodash-es": "^4.17.21", + "mitt": "^3.0.1", "mockjs": "^1.1.0", "pinia": "^2.1.7", "vite-plugin-html": "^3.2.2", diff --git a/public/static/map_load.js b/public/static/map_load.js index 2a40814..bb07b54 100644 --- a/public/static/map_load.js +++ b/public/static/map_load.js @@ -5,9 +5,9 @@ var bmapcfg = { 'imgext': '.jpg', //瓦片图的后缀 ------ 根据需要修改,一般是 .png .jpg //这里我直接用的路径是/static/bmap_offline_demo/tiles,如果瓦片数量较大,可改为瓦片服务的地址 tiles_dir: "images", //普通瓦片图的地址,为空默认在 offlinemap/tiles/ 目 - tiles_path : 'http://172.16.1.162:8123/HeBeiDarkMap/', - tiles_hybrid: 'http://172.16.1.162:8123/HeBeiDarkMap/', //卫星瓦片图的地址,为空默认在 offlinemap/tiles_hybrid/ 目 - tiles_self : 'http://172.16.1.162:8123/HeBeiDarkMap/' //自定义图层的地址,为空默认在 offlinemap/tiles_self/ 目录 + tiles_path : 'http://111.229.30.246:4008/HeBeiDarkMap/', + tiles_hybrid: 'http://111.229.30.246:4008/HeBeiDarkMap/', //卫星瓦片图的地址,为空默认在 offlinemap/tiles_hybrid/ 目 + tiles_self : 'http://111.229.30.246:4008/HeBeiDarkMap/' //自定义图层的地址,为空默认在 offlinemap/tiles_self/ 目录 // tiles_path: "http://111.229.30.246:4008/HeBeiDarkMap/", // tiles_hybrid: "http://111.229.30.246:4008/HeBeiDarkMap/", //卫星瓦片图的地址,为空默认在 offlinemap/tiles_hybrid/ 目 // tiles_self: "http://111.229.30.246:4008/HeBeiDarkMap/", //自定义图层的地址,为空默认在 offlinemap/tiles_self/ 目录 diff --git a/src/utils/eventBus.ts b/src/utils/eventBus.ts new file mode 100644 index 0000000..be25938 --- /dev/null +++ b/src/utils/eventBus.ts @@ -0,0 +1,2 @@ +import mitt from 'mitt'; +export const emitter = mitt(); \ No newline at end of file diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 4815f4f..b7517c7 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -2,12 +2,16 @@ import { ref } from "vue"; import { RouterView } from "vue-router"; import ScaleScreen from "@/components/scale-screen"; +import Left from "./component/left.vue"; +import Right from "./component/right.vue"; +import Center from "./component/center.vue"; import Headers from "./header.vue"; import Setting from "./setting.vue"; import { useSettingStore } from "@/stores/index"; import { storeToRefs } from "pinia"; import MessageContent from "@/components/Plugins/MessageContent"; -import Map from "./component/map.vue" +import Map from "./component/map.vue"; +import Home from "./index/index.vue" const settingStore = useSettingStore(); const { isScale } = storeToRefs(settingStore); const wrapperStyle = {}; @@ -26,11 +30,27 @@ const wrapperStyle = {}; :wrapperStyle="wrapperStyle" :autoScale="isScale" > -
- - + +
+ +
+ +
+
+ +
+
+ +
+
+
+ + +
@@ -40,11 +60,43 @@ const wrapperStyle = {}; .content_wrap { width: 100%; height: 100%; - // padding: 16px 16px 16px 16px; - box-sizing: border-box; + position: relative; background-image: url("@/assets/img/pageBg.png"); background-size: cover; background-position: center center; + overflow: hidden; // 防止地图溢出边界 +} + +.background_layer { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + // z-index: 0; // 确保在前景层之下 position: relative; + .header_layer{ + position: absolute; + top: 0; + } + .left{ + position: absolute; + top: 100px; + left: 0; + } + .right{ + position: absolute; + top: 100px; + right: 0; + } + .center{ + position: absolute; + top: 100px; + } +} + +.foreground_layer { + position: relative; + // z-index: 1; // 确保在背景层之上 } diff --git a/src/views/component/center.vue b/src/views/component/center.vue index 13eb151..34867ba 100644 --- a/src/views/component/center.vue +++ b/src/views/component/center.vue @@ -47,10 +47,6 @@ -
- - -
@@ -67,7 +63,7 @@ import hub from "@/assets/img/hub.png"; import { getDeviceList } from "@/api/modules/index"; import DeviceInfoComponentTwo from "./DeviceInfoComponentTwo.vue"; import Map from "./map.vue" - +import { emitter } from '@/utils/eventBus'; const showServiceArea = ref(false); const showMap = ref(true); const showDeviceInfo = ref(false); @@ -131,12 +127,18 @@ const deviceInfoTwo = ref({ // const deviceInfo = ref({}); function handleShowDeviceInfo(data) { - console.log("设备信息数据:", data); - if(data.deviceTypeId=="22"){ + console.log("接收到设备信息:", data); + + // 关闭其他面板 + showDeviceInfo.value = false; + showDeviceInfoTwo.value = false; + + if (data.deviceTypeId === "22" || data.deviceTypeId === "44") { showDeviceInfo.value = true; - } else if(data.deviceTypeId=="15"){ + } else if (data.deviceTypeId === "15" || data.deviceTypeId === "53") { showDeviceInfoTwo.value = true; } + deviceInfo.value = data; } const closeDeviceInfo = () => { @@ -145,46 +147,23 @@ const closeDeviceInfo = () => { showMap.value = true; }; const mapFlag = ref(true); -onMounted(async () => { - // 初始化地图相关代码... - // if (mapFlag.value) { - // const map = new BMap.Map("baiduMap"); - // const point = new BMap.Point(116.827009, 37.890385); - // map.setMinZoom(11); - // map.setMaxZoom(19); - // map.centerAndZoom(point, 11); - // map.enableScrollWheelZoom(true); - // } - - // const query = { - // area: "", - // deviceType: 22, - // pageNum: 1, - // pageSize: 9999 - // }; - // 调用接口获取设备列表数据 - // try { - // const res = await getDeviceList(query); - // console.log("设备列表数据:", res); - // // 在这里可以处理返回的数据,例如更新页面状态或渲染内容 - // } catch (error) { - // console.error("请求设备列表失败:", error); - // } +onMounted(() => { + emitter.on("show-device-info", handleShowDeviceInfo); }); \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index c73e1f6..b217388 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -57,12 +57,12 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => { strictPort: false, proxy: { [viteEnv.VITE_APP_CONTROL_BASE_API]: { - target: 'http://172.16.1.113:8080/xjIotApi', + target: 'http://192.168.1.117:8090/xjIotApi', changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^${viteEnv.VITE_APP_CONTROL_BASE_API}`), ''), }, [viteEnv.VITE_APP_BASE_API]: { - target: 'http://172.16.1.113:8080/iotApi', + target: 'http://192.168.1.117:8090/iotApi', changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^${viteEnv.VITE_APP_BASE_API}`), ''), }