网格标绘增加图层切换
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import instance from '../../ui/lib/js/request'
|
|
||||||
import {Message} from 'element-ui'
|
import {Message} from 'element-ui'
|
||||||
|
import instance from '../../ui/lib/js/request'
|
||||||
|
|
||||||
let baseURLs = {
|
let baseURLs = {
|
||||||
production: "/",
|
production: "/",
|
||||||
@@ -21,8 +21,8 @@ instance.interceptors.request.use(config => {
|
|||||||
config.baseURL = "/qxn"
|
config.baseURL = "/qxn"
|
||||||
} else if (/\/xiushan/.test(location.pathname)) {
|
} else if (/\/xiushan/.test(location.pathname)) {
|
||||||
config.baseURL = "/xsjr"
|
config.baseURL = "/xsjr"
|
||||||
// } else if (/project\/oms/.test(location.pathname)) {
|
} else if (/project\/oms/.test(location.pathname)) {
|
||||||
// config.baseURL = "/omsapi"
|
config.baseURL = "/omsapi"
|
||||||
} else if (/#url-/.test(location.hash)) {
|
} else if (/#url-/.test(location.hash)) {
|
||||||
config.baseURL = location.hash.replace(/#url-/, '/')
|
config.baseURL = location.hash.replace(/#url-/, '/')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,10 @@
|
|||||||
<el-button @click="clear()">清除绘制</el-button>
|
<el-button @click="clear()">清除绘制</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mapLayerSwitcher" flex>
|
||||||
|
<div class="item" :class="{current:mapType=='vector'}" @click="mapType='vector'"/>
|
||||||
|
<div class="item satellite" :class="{current:mapType=='satellite'}" @click="mapType='satellite'"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ai-dialog>
|
</ai-dialog>
|
||||||
</section>
|
</section>
|
||||||
@@ -58,6 +62,19 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState(['user']),
|
...mapState(['user']),
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
mapType(v) {
|
||||||
|
if (v == 'satellite') {
|
||||||
|
for (const k in this.layers) {
|
||||||
|
this.layers[k].show()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const k in this.layers) {
|
||||||
|
this.layers[k].hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
map: null,
|
map: null,
|
||||||
@@ -66,7 +83,9 @@ export default {
|
|||||||
searchAddress: "",
|
searchAddress: "",
|
||||||
overlays: [],
|
overlays: [],
|
||||||
points: [],
|
points: [],
|
||||||
dialog: false
|
dialog: false,
|
||||||
|
mapType: "vector",
|
||||||
|
layers: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -100,6 +119,14 @@ export default {
|
|||||||
this.map = new AMap.Map("container", {
|
this.map = new AMap.Map("container", {
|
||||||
resizeEnable: true,
|
resizeEnable: true,
|
||||||
});
|
});
|
||||||
|
/* 添加卫星图层*/
|
||||||
|
this.layers.roadNet = new AMap.TileLayer.RoadNet({zIndex: 11})
|
||||||
|
this.layers.satellite = new AMap.TileLayer.Satellite({zIndex: 10})
|
||||||
|
this.map.addLayer(this.layers.roadNet)
|
||||||
|
this.map.addLayer(this.layers.satellite)
|
||||||
|
this.layers.roadNet.hide()
|
||||||
|
this.layers.satellite.hide()
|
||||||
|
/*end*/
|
||||||
this.placeSearch = new AMap.PlaceSearch({
|
this.placeSearch = new AMap.PlaceSearch({
|
||||||
pageSize: 5, // 单页显示结果条数
|
pageSize: 5, // 单页显示结果条数
|
||||||
pageIndex: 1, // 页码
|
pageIndex: 1, // 页码
|
||||||
@@ -197,9 +224,76 @@ export default {
|
|||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mapLayerSwitcher {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 202304061607;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 12px;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 5px;
|
||||||
|
width: fit-content;
|
||||||
|
height: 56px;
|
||||||
|
box-sizing: content-box;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: width 2s ease;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.item {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
position: relative;
|
||||||
|
width: 80px;
|
||||||
|
height: 56px;
|
||||||
|
border: 1px dashed #ddd;
|
||||||
|
cursor: pointer;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background-image: url("https://cdn.cunwuyun.cn/map/defaultMap.png");
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #fff;
|
||||||
|
background-size: 100%;
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
&.current {
|
||||||
|
border: 1px solid #366FFF;
|
||||||
|
display: block !important;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
background-color: #366FFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 18px;
|
||||||
|
padding: 0 3px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
content: "地图";
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.satellite {
|
||||||
|
background-image: url("https://cdn.cunwuyun.cn/map/satelliteMap.png");
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: "卫星"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.fullscreenMap ){
|
:deep(.fullscreenMap ) {
|
||||||
.el-dialog {
|
.el-dialog {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -222,11 +316,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep( .amap-copyright ){
|
:deep( .amap-copyright ) {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep( .amap-logo ){
|
:deep( .amap-logo ) {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import component from './AppGridBlock.vue'
|
|
||||||
|
|
||||||
component.install = function (Vue) {
|
|
||||||
Vue.component(component.name, component)
|
|
||||||
}
|
|
||||||
export default component
|
|
||||||
Reference in New Issue
Block a user