Browse Source

添加地图缩放

feature
SongZhen 2 years ago
parent
commit
6a3d7e6d19
  1. 32
      src/views/dataBoard/cpts/map/index.vue
  2. 12
      src/views/dataBoard/organizational/dangTree/index.vue

32
src/views/dataBoard/cpts/map/index.vue

@ -3,7 +3,7 @@
<div id="map"></div>
<div class="btn" v-if="mapStyleType == 'light'" v-show="false" @click="shiftMapStyle('dark')">切换深色模式</div>
<div class="btn" v-show="false" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
<!-- :style="{ transform: `scale(${zoom})` }" -->
<cpt-popup ref="popup" @clickListItem="handleClickDotListItem" @operate="handleClickDotBtn" />
</div>
</template>
@ -39,7 +39,7 @@ export default {
data() {
return {
mapType,
zoom: 0,
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
@ -264,9 +264,25 @@ export default {
dotList2(val, oldValue) {
this.updateDot();
},
// "$store.state.chooseArea.realScale"(n, v) {
// this.setStartScale(n);
// },
},
mounted() {
// const scale = this.$store.state.chooseArea.realScale;
// console.log(scale);
// if (scale) {
// this.setStartScale(scale);
// }
},
methods: {
// setStartScale(n) {
// const scale = 1 / n;
// this.zoom = scale;
// },
iniMap() {
const { darkStyle, lightStyle, srcGridData } = this;
if (!srcGridData) return false;
@ -493,7 +509,7 @@ export default {
.active(true);
scene.addLayer(textLayer);
polygonLayer.on("mouseenter", (e) => {
polygonLayer.on("mousemove", (e) => {
// console.log("e", e);
// const { lng, lat } = e.lngLat;
// const popup = new Popup({
@ -515,11 +531,11 @@ export default {
scene.addPopup(popup);
});
polygonLayer.on("mousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
// polygonLayer.on("mousemove", (e) => {
// polygonLayer.style({
// raisingHeight: 0,
// });
// });
polygonLayer.on("click", (e) => {
console.log("e", e);
this.$emit("clickAgency", e.feature.properties);

12
src/views/dataBoard/organizational/dangTree/index.vue

@ -39,28 +39,16 @@ export default {
this.getTreeData();
}
},
"$store.state.chooseArea.realScale"(n, v) {
this.setStartScale(n);
},
},
computed: {},
mounted() {
const orgId = this.$store.state.chooseArea.chooseName.orgId;
const scale = this.$store.state.chooseArea.realScale;
if (scale) {
this.setStartScale(scale);
}
if (orgId) {
this.getTreeData();
}
this.getTextMap();
},
methods: {
setStartScale(n) {
const scale = 1 / n;
this.zoom = scale;
},
getLevelArrNum(myArray) {
const arr = [...myArray];
while (arr.length > 1) {

Loading…
Cancel
Save