From 81773ab04fd259e893c2d7f08dbdc9be772d01c4 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 21 Dec 2021 17:18:45 +0800
Subject: [PATCH] +,请求数据,弹框显示,优化代码长度
---
src/components/mobilemap/index.vue | 73 ++++++++++++++++--------------------
1 files changed, 32 insertions(+), 41 deletions(-)
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index cb27c45..7309ca1 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -1,9 +1,11 @@
/* eslint-disable camelcase */
<template>
<div id="mobile-viewer-container">
- <!-- 地图图标弹窗↓ -->
+ <!-- 随地图改变图标弹窗↓ -->
<div id="mobile-map_popup_content"></div>
<mobileWindow></mobileWindow>
+ <!-- 地图固定弹窗 -->
+ <mobileWindowFixed></mobileWindowFixed>
<!-- 地图图标弹窗↑ -->
<!-- 控制↓ -->
<mobileLeftNav ref="mobileLeftNav"></mobileLeftNav>
@@ -15,24 +17,19 @@
<mobilePopupOurAfter v-if="mBigPopupAfter"></mobilePopupOurAfter>
<!-- 大弹窗 -->
<mobilePopupOur :style="[bigPopup]" v-if="mBigPopup"></mobilePopupOur>
+ <!-- 测试-跳转位置 -->
+ <mobileGoTo></mobileGoTo>
+ <!-- 实景窗口 -->
+ <mobilePanorama></mobilePanorama>
</div>
</template>
<script>
import { mapGetters } from "vuex";
-import { location } from "../../position/position";
export default {
name: "mobilemapBox",
data() {
return {
DC: "",
- positions: "",
- url: "/img/job/one.jpg",
- srcList: [
- "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
- "https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg",
- ],
- popupFlag: false,
- popupWindow: false,
bigPopup: {
width: 0,
height: 0,
@@ -48,6 +45,7 @@
"mBigPopupAfter",
"iconHide",
"popupsDom",
+ "MobileWindowsHideFixed",
]),
},
watch: {
@@ -140,7 +138,7 @@
});
that.$refs.mobileLeftNav.initialize(viewer);
that.$store.commit("MSET_VIEWER", viewer);
- that.$store.commit("MSET_DC", DC);
+ // that.$store.commit("MSET_DC", DC);
const popup = viewer.popup;
popup.hide();
@@ -152,22 +150,8 @@
iconUrl: "examples/images/icon/img.png",
name: "影像",
});
- // let nowPosition = "";
- // 地图移动事件
- viewer.on(DC.MouseEventType.MOUSE_MOVE, (e) => {
- if (!that.iconHide) {
- that.$store.commit("MSET_ICONHIDE", true);
- }
- that.$store.dispatch("closeWindowsDom"); //关闭弹窗
- // if (!that.MobileWindowsHide && that.popupsDom) {
- // that.popupsDom.closeOur();
- // that.$store.commit("MSET_MOBILEWINDOWSHIDE", true);
- // }
- // nowPosition = [e.wgs84Position.lng, e.wgs84Position.lat];
- // console.log(nowPosition);
- });
- // // eslint-disable-next-line camelcase
+ // eslint-disable-next-line camelcase
// const baselayer_shaded = DC.ImageryLayerFactory.createArcGisImageryLayer({
// url: "http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer",
// });
@@ -193,6 +177,25 @@
// iconUrl: "examples/images/icon/ter.png",
// name: "地形",
// });
+
+ // 地图移动事件
+ viewer.on(DC.MouseEventType.MOUSE_MOVE, (e) => {
+ if (!that.iconHide) {
+ that.$store.commit("MSET_ICONHIDE", true);
+ }
+ if (!that.MobileWindowsHide) {
+ // that.$store.dispatch("closeMobileWindowsDom"); //关闭随地图弹窗
+ }
+ // if (!that.MobileWindowsHideFixed) {
+ // that.$store.dispatch("CLOSE_WIDOWFIXED"); //关闭固定弹窗
+ // }
+ // if (!that.MobileWindowsHide && that.popupsDom) {
+ // that.popupsDom.closeOur();
+ // that.$store.commit("MSET_MOBILEWINDOWSHIDE", true);
+ // }
+ // nowPosition = [e.wgs84Position.lng, e.wgs84Position.lat];
+ // console.log(nowPosition);
+ });
const layer = new DC.TilesetLayer("layer");
viewer.addLayer(layer);
@@ -226,7 +229,7 @@
viewer.scene.globe.depthTestAgainstTerrain = false;
// console.log(document.getElementById("mobile-map_content_content"));
- // console.log(e.position);
+ // console.log(e);
// 定制化窗体
that.openPopupS(e.position, [e.wgs84Position.lng, e.wgs84Position.lat]);
@@ -255,22 +258,10 @@
let d = {
position,
lntLat,
- query: { ...(query || {}), position, lntLat },
+ query: { ...(query || {}), introduce: position, address: lntLat },
+ useJWD: true, //仅使用经纬度
};
that.$store.dispatch("setMobileWindows", d);
- },
- getLocation() {
- // let _that = this;
- // let geolocation = location.initMap("map-container"); //定位
- // AMap.event.addListener(geolocation, "complete", (result) => {
- // console.log(result);
- // // console.log("hhha");
- // // _that.lat = result.position.lat;
- // // _that.lng = result.position.lng;
- // // _that.province = result.addressComponent.province;
- // // _that.city = result.addressComponent.city;
- // // _that.district = result.addressComponent.district;
- // });
},
},
};
--
Gitblit v1.9.3