5 files modified
5 files added
| | |
| | | methods: {}, |
| | | mounted() {}, |
| | | onLoad: function(options) { |
| | | var that = this; |
| | | var data = []; |
| | | if (options.data == undefined) { |
| | | data = [{ |
| | |
| | | "wd": "28.646341" |
| | | }] |
| | | data = JSON.stringify(data); |
| | | }else{ |
| | | } else { |
| | | data = options.data; |
| | | } |
| | | this.urls = "https://web.byisf.com/xcxjingqingmap_lxdh/lxdhmap.html?data=" + data; |
| | | |
| | | //alert("Hello"); |
| | | wx.getLocation({ |
| | | type: 'wgs84', |
| | | success: function(res) { |
| | | // 经纬度 |
| | | var latitude = res.latitude |
| | | var longitude = res.longitude |
| | | wx.setStorageSync("latitude", latitude); |
| | | wx.setStorageSync("longitude", longitude); |
| | | }, |
| | | fail: function() { |
| | | console.log("定位失败") |
| | | } |
| | | }); |
| | | |
| | | var latitude = wx.getStorageSync("latitude"); |
| | | var longitude = wx.getStorageSync("longitude"); |
| | | |
| | | // alert(wx.getStorageSync("longitude")); |
| | | that.urls = "https://web.byisf.com/xcxjingqingmap_lxdh/lxdhmap.html?data=" + data + "&latitude=" + |
| | | latitude + "&longitude=" + longitude; |
| | | |
| | | |
| | | |
| | | // this.dataList = data; |
| | | // console.log(this.urls); |
| | | }, |
| New file |
| | |
| | | <template> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | urls: '', |
| | | // dataList: [], |
| | | } |
| | | }, |
| | | methods: {}, |
| | | mounted() {}, |
| | | onLoad: function(options) { |
| | | debugger |
| | | console.log(options) |
| | | var that = this, |
| | | info_detail = options; |
| | | console.log("----------------------特惠广场地址导航------------") |
| | | console.log(info_detail.latitude) |
| | | if (info_detail.latitude != '' && info_detail.latitude!=undefined){ |
| | | wx.getLocation({//获取当前经纬度 |
| | | type: 'wgs84', //返回可以用于wx.openLocation的经纬度,官方提示bug: iOS 6.3.30 type 参数不生效,只会返回 wgs84 类型的坐标信息 |
| | | success: function (res) { |
| | | wx.openLocation({//使用微信内置地图查看位置。 |
| | | latitude: Number(info_detail.latitude),//要去的纬度-地址 |
| | | longitude: Number(info_detail.longitude),//要去的经度-地址 |
| | | address: info_detail.address, |
| | | name: info_detail.name, |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | |
| | | layuiLayer: null, |
| | | nowIndex: null, |
| | | |
| | | LXdhStart: null, |
| | | LXdhEnd: null, |
| | | LxdhLine: null, |
| | | |
| | | activeName: 'first', |
| | | |
| | | move: null,//存放移动实例 |
| | | |
| | | //存放实时坐标 |
| | | lat: "", |
| | | lng: "", |
| | | |
| | | |
| | | seedata: '', |
| | | |
| | |
| | | url: `https://web.byisf.com/sf/rp/v2/api`, |
| | | params: { |
| | | ak: "1986afc8a5744263971b7f2482253dfc", |
| | | x1: "114.95675749182703", |
| | | y1: "25.84163062532512", |
| | | x1: that.lng, |
| | | y1: that.lat, |
| | | x2: x, |
| | | y2: y, |
| | | type: "1", |
| | |
| | | console.log('success'); //页面跳转胜利的回调函数 |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | getLocationData() { |
| | | var that = this; |
| | | var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq"); |
| | | var positionNum = 0; |
| | | var options = { |
| | | timeout: 8000 |
| | | }; |
| | | |
| | | function showPosition(position) { |
| | | var adCode = position.adCode; //邮政编码 |
| | | var nation = position.nation; //中国 |
| | | var city = position.city; //城市 |
| | | var addr = position.addr; //详细地址 |
| | | that.lat = position.lat; // |
| | | that.lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑 |
| | | |
| | | if (that.LXdhStart != null) { |
| | | that.map.removeLayer(that.LXdhStart); |
| | | } |
| | | |
| | | //绘制起点和终点 |
| | | that.LXdhStart = L.markerClusterGroup(); |
| | | |
| | | var transportIcon = L.Icon.extend({ //图标初始化 |
| | | options: { |
| | | iconSize: [50, 50], // 图标尺寸 |
| | | } |
| | | }); |
| | | |
| | | var qd = new transportIcon({ |
| | | iconUrl: './img/dingw.gif' |
| | | }); |
| | | |
| | | that.LXdhStart.addLayer(L.marker([that.lat, that.lng], { |
| | | icon: qd, |
| | | })); |
| | | |
| | | that.map.addLayer(that.LXdhStart); |
| | | |
| | | }; |
| | | |
| | | function showErr() { |
| | | //TODO 如果出错了调用此方法 |
| | | }; |
| | | |
| | | geolocation.getLocation(showPosition, showErr, options); |
| | | }, |
| | | |
| | | }, |
| | | created() { |
| | | }, |
| | | mounted() { |
| | | this.getDataList(); |
| | | this.getLocationData(); |
| | | }, |
| | | wacth: { |
| | | } |
| | |
| | | <!-- layui支持 --> |
| | | <!-- <link rel="stylesheet" href="../map/lib/layui/css/layui.css" media="all"> --> |
| | | <!-- <script src="../map/lib/layui/layui.js" charset="utf-8"></script> --> |
| | | |
| | | <!-- 百度地图api --> |
| | | <script type="text/javascript" src="https://mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js"></script> |
| | | |
| | | <!-- axios支持 --> |
| | | <script src="../map/lib/axios.js"></script> |
| | |
| | | |
| | | ZBCXresult: null, |
| | | |
| | | LXdhStart: null, |
| | | LXdhEnd: null, |
| | | LxdhLine: null, |
| | | |
| | | //存放实时坐标 |
| | | lat: "", |
| | | lng: "", |
| | | |
| | | move: null, //存放移动实例 |
| | | |
| | |
| | | }, |
| | | beginMap(map, data) { |
| | | var that = this, |
| | | center = [data[0].wd, data[0].jd], |
| | | url = `/api/blade-jfpts/alarm/alarm/APP-getAlarm?id=${data[0].id}`; |
| | | center = [that.lat, that.lng]; |
| | | // url = `/api/blade-jfpts/alarm/alarm/APP-getAlarm?id=${data[0].id}`; |
| | | // this.nowPosition = center; |
| | | // axios.post(url).then((res) => { |
| | | // // console.log(res) |
| | |
| | | |
| | | var createMap = () => { |
| | | map = L.map('map', { //初始化地图 |
| | | center: center, |
| | | //center: center, |
| | | zoom: 12, |
| | | minZoom: 2, |
| | | maxZoom: 17, |
| | |
| | | getDHLine(x, y) { |
| | | |
| | | var that = this; |
| | | |
| | | |
| | | //获取导航信息 |
| | | axios({ |
| | | method: "get", |
| | | url: `https://web.byisf.com/sf/rp/v2/api`, |
| | | params: { |
| | | ak: "1986afc8a5744263971b7f2482253dfc", |
| | | x1: "114.95675749182703", |
| | | y1: "25.84163062532512", |
| | | x1: that.lng, |
| | | y1: that.lat, |
| | | x2: x, |
| | | y2: y, |
| | | type: "1", |
| | |
| | | color: 'red' |
| | | }).addTo(that.map); |
| | | |
| | | alert(wx.getStorageSync("longitude")); |
| | | |
| | | // zoom the map to the polyline |
| | | that.map.fitBounds(that.LxdhLine.getBounds()) |
| | | }, |
| | | getLocationData() { |
| | | var that = this; |
| | | var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq"); |
| | | var positionNum = 0; |
| | | var options = { |
| | | timeout: 8000 |
| | | }; |
| | | |
| | | function showPosition(position) { |
| | | var adCode = position.adCode; //邮政编码 |
| | | var nation = position.nation; //中国 |
| | | var city = position.city; //城市 |
| | | var addr = position.addr; //详细地址 |
| | | that.lat = position.lat; // |
| | | that.lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑 |
| | | |
| | | if (that.LXdhStart == null) { |
| | | //点位 |
| | | var position = [that.lat, that.lng]; |
| | | |
| | | //把map定位到点位上,13为地图的级别,也可以直接marker.getLatLng() |
| | | that.map.setView(position, 15); |
| | | }else{ |
| | | that.map.removeLayer(that.LXdhStart); |
| | | } |
| | | |
| | | |
| | | //绘制起点和终点 |
| | | that.LXdhStart = L.markerClusterGroup(); |
| | | |
| | | var transportIcon = L.Icon.extend({ //图标初始化 |
| | | options: { |
| | | iconSize: [50, 50], // 图标尺寸 |
| | | } |
| | | }); |
| | | |
| | | var qd = new transportIcon({ |
| | | iconUrl: './img/dingw.gif' |
| | | }); |
| | | |
| | | that.LXdhStart.addLayer(L.marker([that.lat, that.lng], { |
| | | icon: qd, |
| | | })); |
| | | |
| | | that.map.addLayer(that.LXdhStart); |
| | | |
| | | }; |
| | | |
| | | function showErr() { |
| | | //TODO 如果出错了调用此方法 |
| | | }; |
| | | |
| | | geolocation.getLocation(showPosition, showErr, options); |
| | | }, |
| | | |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | created() {}, |
| | | mounted() { |
| | | //警情点查询 |
| | | axios({ |
| | |
| | | } |
| | | } |
| | | } |
| | | this.getDataList(res); |
| | | debugger |
| | | |
| | | var latitude = null; |
| | | var longitude = null; |
| | | var speed = null; |
| | | var accuracy = null; |
| | | |
| | | wx.getLocation({ |
| | | type: 'wgs84', |
| | | success(resLo) { |
| | | latitude = resLo.latitude |
| | | longitude = resLo.longitude |
| | | speed = resLo.speed |
| | | accuracy = resLo.accuracy |
| | | },fail(reserr){ |
| | | |
| | | } |
| | | }); |
| | | this.getDataList(res); |
| | | |
| | | this.getLocationData(); |
| | | |
| | | }); |
| | | |
| | | }, |
| | |
| | | |
| | | <!-- axios支持 --> |
| | | <script src="../map/lib/axios.js"></script> |
| | | |
| | | <!-- elementui --> |
| | | <script src="../map/lib/elementUi.js"></script> |
| | | <!-- <link rel="stylesheet" href="../map/lib/elementUi.css"> --> |
| | |
| | | <!-- 微信支持 --> |
| | | <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script> |
| | | <!-- <script src="./js/wx.js"></script> --> |
| | | |
| | | |
| | | <!-- 百度地图api --> |
| | | <script type="text/javascript" src="https://mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js"></script> |
| | | |
| | | <!-- omyself支持 --> |
| | | <link rel="stylesheet" href="./css/lxdhmap.css" /> |
| | | |