Chargermap.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <template>
  2. <view>
  3. <view id="container" :style="myStyle"></view>
  4. <u-icon name="map-fill" v-if="false" class="input-card" style="width: 24rem;top: 130px;width: 20px;height: 20px;" color="#999" size="40"></u-icon>
  5. </view>
  6. </template>
  7. <script>
  8. import MapLoader from '@/utils/AMap'
  9. export default {
  10. name:"Chargermap",
  11. data() {
  12. return {
  13. myStyle:"width: 100%; height: 1200rpx;",
  14. chargerIcon:'',
  15. chargerSelectedIcon:'',
  16. positionIcon:'',
  17. personIcon:'',
  18. longitude: 112.276527,
  19. latitude: 30.306427,
  20. AMap:null,
  21. //车的位置
  22. car: {
  23. obj:null,
  24. longitude: '',
  25. latitude: '',
  26. },
  27. down: {
  28. obj:null,
  29. longitude: '',
  30. latitude: '',
  31. },
  32. up: {
  33. obj:null,
  34. longitude: '',
  35. latitude: '',
  36. },
  37. //个人
  38. info: {
  39. obj:null,
  40. init: false,
  41. longitude: '',
  42. latitude: '',
  43. },
  44. mapcharger:null,
  45. startend: [{
  46. longitude:112.279274,
  47. latitude:30.303273,
  48. name:''
  49. }, {
  50. longitude:112.273867,
  51. latitude:30.309817,
  52. name:''
  53. }],
  54. start:{},
  55. end:{},
  56. chargerList:[],
  57. covers: [
  58. {
  59. longitude:112.273867,
  60. latitude:30.309817,
  61. },{
  62. longitude:112.280261,
  63. latitude:30.3041,
  64. },{
  65. longitude:112.279274,
  66. latitude:30.303273,
  67. }
  68. ],
  69. };
  70. },
  71. methods:{
  72. /*
  73. getLocation1() {
  74. // console.log('getLocation');
  75. const self = this;
  76. AMap.plugin('AMap.Geolocation', function () {
  77. var geolocation = new AMap.Geolocation({
  78. // 是否使用高精度定位,默认:true
  79. enableHighAccuracy: true,
  80. // 设置定位超时时间,默认:无穷大
  81. timeout: 10000
  82. });
  83. geolocation.getCurrentPosition();
  84. AMap.event.addListener(geolocation, 'complete', onComplete);
  85. AMap.event.addListener(geolocation, 'error', onError);
  86. function onComplete (data) {
  87. // data是具体的定位信息
  88. self.$emit('location',data);
  89. console.log('定位成功信息:', data.addressComponent.city);
  90. self.city = data.addressComponent.city;
  91. }
  92. function onError (data) {
  93. // 定位出错
  94. // console.log('定位失败错误:', data);
  95. // 调用IP定位
  96. let ret = { position:{longitude: 112.28468,latitude: 30.307094}};
  97. self.$emit('location',ret);
  98. //self.getLngLatLocation();
  99. }
  100. });
  101. },
  102. // 通过IP获取当前位置
  103. getLngLatLocation () {
  104. const self = this;
  105. AMap.plugin('AMap.CitySearch', function () {
  106. var citySearch = new AMap.CitySearch();
  107. citySearch.getLocalCity(function (status, result) {
  108. if (status === 'complete' && result.info === 'OK') {
  109. // 查询成功,result即为当前所在城市信息
  110. //console.log('通过ip获取当前城市:', result);
  111. // 逆向地理编码
  112. AMap.plugin('AMap.Geocoder', function () {
  113. var geocoder = new AMap.Geocoder({
  114. // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
  115. city: result.adcode
  116. });
  117. var lnglat = result.rectangle.split(';')[0].split(',');
  118. geocoder.getAddress(lnglat, function (status, data) {
  119. if (status === 'complete' && data.info === 'OK') {
  120. // result为对应的地理位置详细信息
  121. //self.$emit('location',data);
  122. console.log('location'+JSON.stringify(data));
  123. }
  124. });
  125. });
  126. }
  127. });
  128. });
  129. }, */
  130. getPositionByLonLats(pos) {
  131. var _this = this;
  132. MapLoader().then(AMap => {
  133. var lnglatXY =//[_this.longitude, _this.latitude]
  134. [pos.longitude, pos.latitude];
  135. AMap.service('AMap.Geocoder', function() {
  136. let geocoder = new AMap.Geocoder({});
  137. geocoder.getAddress(lnglatXY, function(status, result) {
  138. console.log(lnglatXY);
  139. console.log(status, result);
  140. if (status === 'complete' && result.info === 'OK') {
  141. var address = result.regeocode.formattedAddress;
  142. console.log('当前位置'+JSON.stringify(lnglatXY)+address);
  143. //_this.message= address;
  144. } else {
  145. //_this.message= '无法获取定位';
  146. }
  147. });
  148. });
  149. }).catch(error => {
  150. console.log(error)
  151. })
  152. },
  153. searchBtn(startLngLat,endLst){
  154. var _this = this;
  155. AMap.plugin('AMap.Driving', function() {
  156. var driving = new AMap.Driving({
  157. // 驾车路线规划策略,AMap.DrivingPolicy.LEAST_TIME是最快捷模式
  158. policy: AMap.DrivingPolicy.LEAST_TIME
  159. })
  160. //var startLngLat = [_this.longitude, _this.latitude]
  161. //var endLngLat = [116.427281, 39.903719]
  162. for(let i=0;i< endLst.length;i++)
  163. {
  164. let item = endLst[i];
  165. let endLngLat = [item.longitude,item.latitude]
  166. // console.log('search start['+JSON.stringify(startLngLat))
  167. // console.log('search end]'+JSON.stringify(endLngLat))
  168. driving.search(startLngLat, endLngLat, function (status, result) {
  169. // console.log(result)
  170. // console.log('秒'+result.routes[0].time)//秒
  171. // console.log('距离'+result.routes[0].distance)//米
  172. //uni.showToast({
  173. // title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
  174. //})
  175. endLst[i].distance = result.routes[0].distance/1000.0;
  176. endLst[i].time = result.routes[0].time/60.0;
  177. })
  178. //var startLngLat2 = [_this.longitude, _this.latitude]
  179. //var endLngLat2 = [_this.longitude2, _this.latitude2]
  180. /*
  181. driving.search(startLngLat2, endLngLat2, function (status, result) {
  182. console.log(result)
  183. console.log(result.routes[0].time)//秒
  184. console.log(result.routes[0].distance)//米
  185. uni.showToast({
  186. title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
  187. })
  188. })*/
  189. }
  190. })
  191. },
  192. updateCharger(pos){
  193. // console.log('更新充电桩'+JSON.stringify(this.chargerList.length) )
  194. // console.log('更新充电桩1'+JSON.stringify(pos) )
  195. // let index = this.chargerList.findIndex(item => item.info.latitude === pos.latitude && item.info.longitude === pos.longitude);
  196. //let index = this.chargerList.findIndex(item => (Math.abs(item.info.longitude-pos.longitude)<0.000001 && Math.abs(item.info.longitude - pos.latitude)<0.000001));
  197. let index = this.chargerList.findIndex(item => item.info.id === pos.id);
  198. // console.log('更新充电桩['+ index + ']'+JSON.stringify(pos))
  199. let colorBg = '#00BAC8';//#00b962
  200. if(this.chargerList[index].info.type =='快充'){
  201. colorBg = '#8486FF'
  202. }else if(this.chargerList[index].info.type =='慢充'){
  203. colorBg = '#9d9fff'
  204. }
  205. console.log('colorBg'+colorBg)
  206. console.log('更新充电桩2'+JSON.stringify(this.chargerList[index].info))
  207. if(index>=0){
  208. let station_icon2 = "width: 100px;height: 36px;line-height: 20px;border-radius: 50px;background-color: " + colorBg +";text-align: center;display: flex;";
  209. let corner2=" width: 0;height: 0;position: absolute;top: 36px;left: 0;right: 0;margin: auto;border-bottom: 6px solid transparent;border-left: 6px solid transparent;border-right: 6px solid transparent;border-top: 8px solid " + colorBg +" ;";
  210. let content = "<div style='" + station_icon2 + "'>";
  211. content+="<div style='width: 36px;height: 36px;line-height: 36px;text-align: center;border: 1px solid " + colorBg +";border-radius: 999px;background-color: #fff;color: " + colorBg +";' class='iconfont'>&#xe606;</div>";
  212. content+="<div style='color: #ffffff;line-height: 14px;padding: 4px;'>";
  213. content+="<div style='"+corner2+"'></div>";
  214. content+="<div class=''>";
  215. content+= "¥" + pos.price.toString();
  216. content+="</div>";
  217. content+="<div class=''>";
  218. content+="空闲" + pos.idleNum.toString();
  219. content+="</div>"
  220. content+="</div>";
  221. content+="</div>";
  222. // console.log('找到充电桩[]'+content)
  223. //content = "<div style='height: 40px;width: 100px;display: flex;flex-direction: row; flex-wrap: wrap; background-color: #00B962!important;border-radius: 20px;'> <div><img src='"+this.chargerSelectedIcon+"' style='idth: 40px;height: 40px'></div><div style='display: flex;flex-direction:column;color:#FFFFFF;'><div style='margin-left:10px'>¥"+ pos.price +"</div><div style='margin-left:10px'>空闲"+pos.idleNum + "</div> </div></div>";
  224. this.chargerList[index].info.selected = true;
  225. this.chargerList[index].marker.setContent(content);
  226. }
  227. for(let i = 0;i < this.chargerList.length;i++){
  228. if(index == i)
  229. continue;
  230. if(this.chargerList[i].info.selected != null &&
  231. this.chargerList[i].info.selected)
  232. {
  233. let station_icon = "width: 36px;height: 36px;line-height: 36px;text-align: center;border: 1px solid " + colorBg +"; color: " + colorBg +"; border-radius: 999px;";
  234. let corner = "width: 0;height: 0;position: absolute;top: 34px;left: 0;right: 0;margin: auto;border-bottom: 4px solid transparent;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 6px solid " + colorBg +" ;";
  235. let content = "<div style='"+station_icon+"'><text class='iconfont'>&#xe606;</text><div style='" + corner+"'></div></div>"
  236. //let content = "<img src='"+this.chargerIcon+"' style='height: 40px;width: 40px' />";
  237. this.chargerList[i].marker.setContent(content);
  238. this.chargerList[i].info.selected = false;
  239. console.log('restore'+JSON.stringify(this.chargerList[i].info))
  240. }
  241. }
  242. },
  243. addCharger(pos) {
  244. let colorBg = '#00BAC8';//#00b962
  245. if(pos.type =='快充'){
  246. colorBg = '#8486FF'
  247. }else if(pos.type =='慢充'){
  248. colorBg = '#9d9fff'
  249. }
  250. // console.log('添加充电桩'+JSON.stringify(pos))
  251. //let content = "<div style='height: 40px;width: 100px;display: flex;flex-direction: row; flex-wrap: wrap; background-color: #00B962!important;border-radius: 20px;'> <div><img src='"+this.chargerIcon+"' style='idth: 40px;height: 40px'></div><div style='display: flex;flex-direction:column;color:#FFFFFF'><div>¥1.5</div><div>空闲10</div> </div></div>";
  252. let station_icon = "width: 36px;height: 36px;line-height: 36px;text-align: center;border: 1px solid "+ colorBg+"; color: "+ colorBg+"; border-radius: 999px;";
  253. let corner = "width: 0;height: 0;position: absolute;top: 34px;left: 0;right: 0;margin: auto;border-bottom: 4px solid transparent;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 6px solid "+ colorBg+" ;";
  254. let content = "<div style='"+station_icon+"'><text class='iconfont'>&#xe606;</text><div style='" + corner+"'></div></div>"
  255. let marker = new AMap.Marker({
  256. content: content,//"<img src='"+this.chargerIcon+"' style='height: 40px;width: 40px' />",
  257. //icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
  258. position: [pos.longitude,pos.latitude],
  259. offset: new AMap.Pixel(-13, -30),
  260. zIndex:900,
  261. autoRotation: true,
  262. });
  263. marker.setMap(this.mapcharger);
  264. this.myEmit("charger",marker,pos)
  265. this.chargerList.push({marker:marker,info:pos});
  266. },
  267. addPerson(pos) {
  268. console.log('addPerson'+JSON.stringify(pos))
  269. let marker = new AMap.Marker({
  270. content: "<img src='"+this.personIcon+"' style='height: 40px;width: 40px' />",
  271. //icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
  272. position: [pos.longitude,pos.latitude],
  273. offset: new AMap.Pixel(-13, -30),
  274. zIndex:900,
  275. autoRotation: true,
  276. });
  277. marker.setMap(this.mapcharger);
  278. this.myEmit("person",marker,pos)
  279. //this.chargerList.push(marker)
  280. },
  281. /*
  282. addPosition() {
  283. console.log('addPosition'+JSON.stringify(pos))
  284. let marker = new AMap.Marker({
  285. content: "<img src='"+this.positionIcon+"' style='height: 40px;width: 40px' />",
  286. //icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
  287. //position: [pos.longitude,pos.latitude],
  288. offset: new AMap.Pixel(20, 220),
  289. zIndex:900,
  290. autoRotation: true,
  291. });
  292. marker.setMap(this.mapcharger);
  293. //this.myEmit("person",marker,pos)
  294. //this.chargerList.push(marker)
  295. },*/
  296. setChargerList(sz){
  297. if(this.AMap==null){
  298. return
  299. }
  300. //this.getLocation();
  301. for(var i in this.chargerList){
  302. if(this.chargerList[i].marker){
  303. this.chargerList[i].marker.setMap(null);
  304. }
  305. this.mapcharger.remove(this.chargerList[i]);
  306. }
  307. this.chargerList=[]
  308. for(var i in sz){
  309. var ob=sz[i];
  310. this.addCharger(ob);
  311. /*var ob1 = new AMap.Marker({
  312. position: new AMap.LngLat(ob.longitude,ob.latitude), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
  313. title: '北京'
  314. });
  315. this.mapcharger.add(ob1);*/
  316. /*
  317. var ob1=new AMap.Marker({
  318. map: this.mapcharger,
  319. position: [ob.longitude,ob.latitude],
  320. //offset: new AMap.Pixel(-5, -5),
  321. //offset: new AMap.Pixel(-18, -40),
  322. content:"<img src='"+icon0+"' style='height: 40px;width: 40px' />",
  323. title:'test111111111111111',
  324. zIndex:900,
  325. autoRotation: true,
  326. });
  327. this.myEmit("car",ob1,ob)
  328. */
  329. //this.mapcharger.add(ob1);
  330. }
  331. },
  332. myEmit(type,ob1,obj){
  333. var _this=this;
  334. AMap.event.addListener(ob1, 'click', function(e) {
  335. _this.$emit('clickMap',{
  336. type:type,
  337. obj:obj
  338. })
  339. })
  340. },
  341. setMyStyle(s){
  342. this.myStyle=s;
  343. },
  344. setCenter(item){
  345. if(this.mapcharger){
  346. this.mapcharger.setCenter([item.longitude,item.latitude]);
  347. return true
  348. }else{
  349. return false
  350. }
  351. },
  352. setPerson(ob,bl){
  353. // console.log('setPerson1'+JSON.stringify(ob))
  354. if(this.AMap==null){
  355. return
  356. }
  357. // console.log('setPerson2')
  358. this.info.longitude=ob.longitude
  359. this.info.latitude=ob.latitude
  360. if(!this.info.ob){
  361. //this.addPerson(ob)
  362. //this.info.ob.setMap(this.mapcharger);
  363. //console.log('setMap xxx ')
  364. //this.mapbus.setCenter([this.info.longitude,this.info.latitude]); //设置地图中心点
  365. if(!bl){
  366. let posCenter= [ this.info.longitude,this.info.latitude];
  367. // console.log('center'+JSON.stringify(posCenter))
  368. //this.mapcharger.setZoom(9)
  369. //this.mapcharger.setCenter([112.28541,30.308354])
  370. //this.mapcharger.setCenter([121.504919,31.351083])
  371. this.mapcharger.setCenter(posCenter); //设置地图中心点
  372. }
  373. }else{
  374. // this.info.ob.setPosition( [this.info.longitude,this.info.latitude]);
  375. }
  376. },
  377. logMapInfo() {
  378. var posCenter = this.mapcharger.getCenter();
  379. //console.log('center'+JSON.stringify(posCenter));
  380. var limitBounds = this.mapcharger.getBounds();
  381. let pos = {center:posCenter,bounds:limitBounds};
  382. return pos;
  383. },
  384. init(){
  385. // console.log('init')
  386. var _this = this;
  387. // this.positionIcon = require('@/static/img/location.png')
  388. // this.personIcon = require("@/static/img/charger_selected.png")
  389. // this.chargerIcon = require("@/static/img/charger.png");
  390. // this.chargerSelectedIcon = require("@/static/img/charger_selected_circle.png");
  391. MapLoader().then(AMap => {
  392. this.AMap=AMap;
  393. _this.mapcharger && _this.mapcharger.destroy();
  394. //使用地图容器ID创建
  395. _this.mapcharger=new AMap.Map("container", {
  396. resizeEnable: true,
  397. dragEnable : true,
  398. center: [this.longitude, this.latitude],
  399. zoom: 14
  400. });
  401. /*
  402. new SimpleMarker({
  403. iconLabel: '2',
  404. //自定义图标节点(img)的属性
  405. iconStyle: {
  406. src: '@/static/img/location.png',
  407. style: {
  408. width: '20px',
  409. height: '30px'
  410. }
  411. },
  412. //设置基点偏移
  413. offset: new AMap.Pixel(-10, -30),
  414. map: map,
  415. showPositionPoint: true,
  416. position: lngLats[1],
  417. zIndex: 200
  418. });
  419. */
  420. /*
  421. _this.mapcharger.plugin('AMap.Geolocation', function () {
  422. var geolocation = new AMap.Geolocation({
  423. enableHighAccuracy: true,
  424. timeout: 10000,
  425. buttonOffset: new AMap.Pixel(10, 220),
  426. zoomToAccuracy: true,
  427. buttonPosition: 'RB'
  428. });
  429. _this.mapcharger.center = geolocation;
  430. _this.mapcharger.addControl(geolocation);//地图控件右下角显示当前位置
  431. });
  432. _this.mapcharger.plugin(["AMap.ToolBar"],function(){
  433. //加载工具条
  434. var tool = new AMap.ToolBar({
  435. locate:true,
  436. direction:false,
  437. ruler:false,
  438. liteStyle:true,
  439. useNative:true,
  440. // autoPosition:true,
  441. // locationMarker:
  442. });
  443. _this.mapcharger.addControl(tool);
  444. });*/
  445. /*
  446. _this.mapcharger.plugin(["AMap.ControlBar"],function(){
  447. var controlBar = new AMap.ControlBar({
  448. showZoomBar:true,
  449. showControlButton:true,
  450. position:{top:'10px',right:'10px'}
  451. })
  452. _this.mapcharger.addControl(controlBar)
  453. });*/
  454. var clickHandler = function(e) {
  455. _this.$emit('onClicked',e);
  456. console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
  457. };
  458. _this.mapcharger.on('click', clickHandler);
  459. _this.$emit('onload')
  460. //_this.addPosition();
  461. _this.listenMove();
  462. }, e => {
  463. //_this.mui.toast('地图加载失败');
  464. console.log('地图加载失败', e)
  465. })
  466. },
  467. listenMove(){
  468. var _this = this;
  469. var mapMovestart = function(){
  470. console.log('movestart')
  471. }
  472. var mapMove = function(){
  473. //console.log('mapMove')
  474. }
  475. var mapMoveend = function(){
  476. let pos = _this.logMapInfo();
  477. _this.$emit('onMoveEnd',pos);
  478. // console.log('mapMoveend')
  479. }
  480. _this.mapcharger.on('movestart', mapMovestart);
  481. _this.mapcharger.on('mapmove', mapMove);
  482. _this.mapcharger.on('moveend', mapMoveend);
  483. },
  484. navigate(){
  485. AMap.plugin('AMap.Driving', function() {
  486. var driving = new AMap.Driving({
  487. // 驾车路线规划策略,AMap.DrivingPolicy.LEAST_TIME是最快捷模式
  488. policy: AMap.DrivingPolicy.LEAST_TIME
  489. })
  490. var startLngLat = [116.379028, 39.865042]
  491. var endLngLat = [116.427281, 39.903719]
  492. driving.search(startLngLat, endLngLat, function (status, result) {
  493. // 未出错时,result即是对应的路线规划方案
  494. })
  495. })
  496. },
  497. initMap(point,stationList,startend){
  498. console.log('初始化地图'+this.longitude+this.latitude)
  499. var _this = this;
  500. this.covers=point;
  501. this.startend=startend;
  502. MapLoader().then(AMap => {
  503. this.AMap=AMap;
  504. _this.mapcharger && _this.mapcharger.destroy();
  505. _this.mapcharger=new AMap.Map("container", {
  506. resizeEnable: true,
  507. center: [this.longitude, this.latitude],
  508. //center: [116.397428, 39.90923],
  509. zoom: 14
  510. });
  511. var lineArr=[]
  512. //var icon0 = require("@/static/img/map_0.png");
  513. //var icon1 = require("@/static/img/map_1.png");
  514. //var icon2 = require("@/static/img/map_2.png");
  515. /*this.start=new AMap.Marker({
  516. map: _this.mapcharger,
  517. position: [_this.startend[0].longitude,_this.startend[0].latitude],
  518. content:"<img src='"+icon0+"' style='height: 30px;width: 30px' />",
  519. offset: new AMap.Pixel(-15, -30),
  520. zIndex:99,
  521. autoRotation: true,
  522. });
  523. this.end=new AMap.Marker({
  524. map: _this.mapcharger,
  525. position: [_this.startend[1].longitude,_this.startend[1].latitude],
  526. content:"<img src='"+icon2+"' style='height: 30px;width: 30px' />",
  527. offset: new AMap.Pixel(-15, -30),
  528. zIndex:99,
  529. autoRotation: true,
  530. });
  531. for(var i in _this.covers){
  532. var point=_this.covers[i]
  533. lineArr.push([point.longitude,point.latitude])
  534. }
  535. for(var i in stationList){
  536. var point=stationList[i]
  537. var ob_point =new AMap.Marker({
  538. map: _this.mapcharger,
  539. position: [point.longitude,point.latitude],
  540. offset: new AMap.Pixel(-5, -7),
  541. content:"<img src='"+icon1+"' style='height: 10px;width: 10px' />",
  542. zIndex:99,
  543. autoRotation: true,
  544. });
  545. this.myEmit("point",ob_point,point)
  546. }
  547. var polyline = new AMap.Polyline({
  548. map: _this.mapcharger,
  549. path: lineArr,
  550. showDir: true,
  551. strokeColor: "#28F", //线颜色
  552. // strokeOpacity: 1, //线透明度
  553. strokeWeight: 3, //线宽
  554. //strokeStyle: "solid" //线样式
  555. });*/
  556. this.$emit('onload')
  557. }, e => {
  558. //_this.mui.toast('地图加载失败');
  559. console.log('地图加载失败', e)
  560. })
  561. },
  562. }
  563. }
  564. </script>
  565. <style scoped>
  566. /*去除下标*/
  567. .amap-logo{
  568. display: none;
  569. }
  570. .amap-copyright{
  571. opacity:0;
  572. font-size: 1px;
  573. }
  574. .input-card {
  575. display: flex;
  576. flex-direction: column;
  577. min-width: 0;
  578. word-wrap: break-word;
  579. background-color: #fff;
  580. background-clip: border-box;
  581. border-radius: .25rem;
  582. width: 22rem;
  583. border-width: 0;
  584. border-radius: 0.4rem;
  585. box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
  586. position: fixed;
  587. bottom: 1rem;
  588. right: 1rem;
  589. -ms-flex: 1 1 auto;
  590. flex: 1 1 auto;
  591. padding: 0.75rem 0.75rem;
  592. }
  593. .station-icon {
  594. width: 36px;
  595. height: 36px;
  596. line-height: 36px;
  597. text-align: center;
  598. border: 1px solid rgba(133, 140, 255, 100);
  599. color: #b58cff;
  600. border-radius: 999px;
  601. position: absolute;
  602. top: 89px;
  603. left: 38px;
  604. }
  605. .corner{
  606. width: 0;
  607. height: 0;
  608. position: absolute;
  609. top: 34px;
  610. left: 0;
  611. right: 0;
  612. margin: auto;
  613. border-bottom: 4px solid transparent;
  614. border-left: 4px solid transparent;
  615. border-right: 4px solid transparent;
  616. border-top: 6px solid #b58cff ;
  617. }
  618. .station-icon2 {
  619. width: 100px;
  620. height: 36px;
  621. line-height: 20px;
  622. border-radius: 50px;
  623. background-color: rgba(0, 185, 98, 100);
  624. text-align: center;
  625. display: flex;
  626. position: absolute;
  627. top: 191px;
  628. left: 168px;
  629. }
  630. .icon2-left{
  631. width: 36px;
  632. height: 36px;
  633. line-height: 36px;
  634. text-align: center;
  635. border: 1px solid rgba(0, 185, 98, 100);
  636. border-radius: 999px;
  637. background-color: #fff;
  638. color: #00b962;
  639. }
  640. .icon2-right{
  641. color: #ffffff;
  642. line-height: 14px;
  643. padding: 4px;
  644. }
  645. .corner2{
  646. width: 0;
  647. height: 0;
  648. position: absolute;
  649. top: 36px;
  650. left: 0;
  651. right: 0;
  652. margin: auto;
  653. border-bottom: 6px solid transparent;
  654. border-left: 6px solid transparent;
  655. border-right: 6px solid transparent;
  656. border-top: 8px solid #00b962 ;
  657. }
  658. </style>