|
@@ -1,9 +1,11 @@
|
|
|
<template>
|
|
|
<el-dialog width="80%" :show-close="false" destroy-on-close :visible.sync="dialogTableVisible">
|
|
|
<!-- <div id="container"></div> -->
|
|
|
+ <div>
|
|
|
+ <el-input v-model="searchKey" @change="searchMap($event)"/>
|
|
|
+ </div>
|
|
|
<el-amap vid="container" style="height: 600px;" :center="center" :zoom="zoom" class="amap-demo">
|
|
|
- <!-- <el-amap-marker v-for="(marker,index) in markers" :key="index" :position="marker.position"
|
|
|
- :events="marker.events"></el-amap-marker> -->
|
|
|
+ <el-amap-marker v-for="(marker,index) in markers" :key="index" :position="marker.position" :icon="marker.icon"></el-amap-marker>
|
|
|
<!-- <el-amap-info-window v-if="window" :position="window.position" :visible="window.visible"
|
|
|
:content="window.content"></el-amap-info-window> -->
|
|
|
</el-amap>
|
|
@@ -11,19 +13,25 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import qs from 'qs';
|
|
|
+ //var map = new AMap.Map('container');
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ searchKey: '',
|
|
|
dialogTableVisible: true,
|
|
|
order: {},
|
|
|
- markers: [],
|
|
|
+ markers: [
|
|
|
+ { id:1, position: [120.629585, 31.269379], icon: '/static/image/map-fa.png' },
|
|
|
+ { id:2, position: [120.609585, 31.209379], icon: '/static/image/map-shou.png' },
|
|
|
+ ],
|
|
|
srcList: [],
|
|
|
windows: [],
|
|
|
window: '',
|
|
|
geocoder: '',
|
|
|
defaultCity: '苏州',
|
|
|
- zoom: 16,
|
|
|
- center: [120.619585, 31.299379],
|
|
|
+ zoom: 12,
|
|
|
+ center: [120.619585, 31.239379],
|
|
|
address: '',
|
|
|
province: '',
|
|
|
city: '',
|
|
@@ -35,14 +43,25 @@
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- var map = new AMap.Map('container', {
|
|
|
- zoom: 11, //级别
|
|
|
- center: [116.397428, 39.90923], //中心点坐标
|
|
|
- });
|
|
|
- console.log(map, '地图')
|
|
|
- },
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
+ searchMap(e) {
|
|
|
+ console.log(e)
|
|
|
+ fetch('https://restapi.amap.com/v3/assistant/inputtips?key=5ae8644771ef9abf9cfb3ea23b1df6ca&keywords=苏州大学&city=0512&offset=20&types=keywords',{
|
|
|
+ methods: 'GET'
|
|
|
+ }).then( res => {
|
|
|
+ return res.json()
|
|
|
+ }).then( result => {
|
|
|
+ console.log(result);
|
|
|
+ fetch(`https://restapi.amap.com/v3/geocode/geo?key=4940f0a9fdc717ab27dd37fa0497c771&address=${ result.tips[0].district }${ result.tips[0].address }${ result.tips[0].name }`,{
|
|
|
+ methods: 'GET'
|
|
|
+ }).then( res1 => {
|
|
|
+ return res1.json()
|
|
|
+ }).then( rp => {
|
|
|
+ console.log(rp, '------------')
|
|
|
+ } )
|
|
|
+ } )
|
|
|
+ },
|
|
|
setDialogStatus() {
|
|
|
this.dialogTableVisible = true;
|
|
|
}
|
|
@@ -51,6 +70,7 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+ /* 图标大小修改 */
|
|
|
/deep/ .el-dialog__header {
|
|
|
display: none !important;
|
|
|
}
|
|
@@ -58,4 +78,8 @@
|
|
|
width: 100%;
|
|
|
height: 400px;
|
|
|
}
|
|
|
+ /deep/ .amap-container img {
|
|
|
+ width: 35px !important;
|
|
|
+ height: 45px !important;
|
|
|
+ }
|
|
|
</style>
|