Commit c7343975a450bfc7afa1d7cfec6d460425f25cd4

Authored by liuqimichale
1 parent ac775d76

地图

src/views/map/map.vue
... ... @@ -21,7 +21,7 @@
21 21 :zoom="16">
22 22  
23 23  
24   - <bm-label content="22" :position="{lng: 116.3666882, lat: 39.9283467}" :labelStyle="{color: '#fff', fontSize : '16px',background:'#f0f',borderRadius: '50%',padding:'3px'}" title="Hover me"/>
  24 + <bm-label :content="labelContent" :position="{lng: position.longitude, lat: position.latitude}" :labelStyle="{color: '#FFF', fontSize : '16px',background:position.bgcolor,borderRadius: '50%',padding:'3px',borderColor:'#fff'}" title="Hover me"/>
25 25  
26 26 </baidu-map>
27 27  
... ... @@ -86,11 +86,18 @@ export default {
86 86 popupVisible: false,
87 87 n:10,
88 88 setTimeoutTimer:'',
89   - latitude:'',
90   - longitude:'',
  89 + latitude:'39.91092455',
  90 + longitude:'116.41338370',
91 91 name:'',
92 92 idleberths:'',
93   - julis:''
  93 + julis:'',
  94 + labelShow: false,
  95 + labelContent:'',
  96 + position:{
  97 + latitude:'39.91092455',
  98 + longitude:'116.41338370',
  99 + bgcolor: '#f00'
  100 + }
94 101 }
95 102 },
96 103 methods: {
... ... @@ -158,7 +165,24 @@ export default {
158 165  
159 166 this.latitude = datas.latitude
160 167 this.longitude = datas.longitude
  168 + this.position.latitude = datas.latitude
  169 + this.position.longitude = datas.longitude
161 170 this.idleberths = datas.idleberths
  171 + this.labelContent = datas.idleberths
  172 + if(datas.idleberths>10){
  173 + this.position.bgcolor = '#0f0'
  174 + }else if(datas.idleberths<=10&&datas.idleberths>0){
  175 + this.position.bgcolor = '#ff9e04'
  176 + }else if(datas.idleberths<=0){
  177 + this.position.bgcolor = '#f00'
  178 + }else{
  179 + this.position.bgcolor = '#0f0'
  180 + }
  181 +
  182 +
  183 +
  184 +
  185 +
162 186 this.julis = this.dis
163 187 })
164 188 },
... ...
src/views/map/search.vue
... ... @@ -82,7 +82,7 @@ export default {
82 82 tzmap: function (i) {
83 83 console.log(i)
84 84 this.$router.push({
85   - name:'map',
  85 + path:'map',
86 86 query:{
87 87 name: i.name,
88 88 lng:i.longitude,
... ...