Commit 7ecd2625 authored by gengchunlei's avatar gengchunlei

push

parent f70ccb26
...@@ -24,7 +24,7 @@ const routes = [ ...@@ -24,7 +24,7 @@ const routes = [
] ]
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'hash',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes
}) })
......
...@@ -8,7 +8,7 @@ export const location = { ...@@ -8,7 +8,7 @@ export const location = {
mapObj.plugin(['AMap.Geolocation'], function () { mapObj.plugin(['AMap.Geolocation'], function () {
geolocation = new AMap.Geolocation({ geolocation = new AMap.Geolocation({
enableHighAccuracy: true, // 是否使用高精度定位,默认:true enableHighAccuracy: true, // 是否使用高精度定位,默认:true
timeout: 10000, // 超过10秒后停止定位,默认:无穷大 // timeout: 5000, // 超过10秒后停止定位,默认:无穷大
maximumAge: 0, // 定位结果缓存0毫秒,默认:0 maximumAge: 0, // 定位结果缓存0毫秒,默认:0
convert: true, // 自动偏移坐标,偏移后的坐标为高德坐标,默认:true convert: true, // 自动偏移坐标,偏移后的坐标为高德坐标,默认:true
showButton: false, // 显示定位按钮,默认:true showButton: false, // 显示定位按钮,默认:true
......
...@@ -101,11 +101,11 @@ ...@@ -101,11 +101,11 @@
this.loading = true this.loading = true
this.param.pageIndex += 1 this.param.pageIndex += 1
this.getRecordInfo() this.getRecordInfo()
}
}, },
goBack() { goBack() {
window.history.go(-1) window.history.go(-1)
}, },
},
beforeDestroy() { beforeDestroy() {
this.detailInfo = [] this.detailInfo = []
} }
......
...@@ -101,16 +101,66 @@ ...@@ -101,16 +101,66 @@
callMobile("goIndex", {}); callMobile("goIndex", {});
}, },
createMap() { createMap() {
let self = this
let geolocation = location.initMap("map-container"); //定位 let geolocation = location.initMap("map-container"); //定位
AMap.event.addListener(geolocation, "complete", result => { AMap.event.addListener(geolocation, 'complete', onComplete)
AMap.event.addListener(geolocation, 'error', onError)
function onComplete(data) {
// data是具体的定位信息
console.log('定位成功信息:', data)
self.creatNetwork(data, 1)
}
function onError(data) { //非安全域禁止定位(localhost不限制) 改为https即可
// 定位出错
console.log('定位失败错误:', data)
self.getLngLatLocation()
}
},
getLngLatLocation() {
let self = this
AMap.plugin('AMap.CitySearch', function () {
var citySearch = new AMap.CitySearch()
citySearch.getLocalCity(function (status, result) {
if (status === 'complete' && result.info === 'OK') {
// 查询成功,result即为当前所在城市信息
console.log('通过ip获取当前城市:',result)
//逆向地理编码
AMap.plugin('AMap.Geocoder', function() {
var geocoder = new AMap.Geocoder({
// city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
city: result.adcode
})
var lnglat = result.rectangle.split(';')[0].split(',')
self.creatNetwork(lnglat, 2)
/* geocoder.getAddress(lnglat, function(status, data) {
if (status === 'complete' && data.info === 'OK') {
// result为对应的地理位置详细信息
console.log(data)
}
})*/
})
}
})
})
},
creatNetwork(result, flag) {
let par = {}
if (flag == 1) {
this.lngLat = [result.position.lng, result.position.lat]; this.lngLat = [result.position.lng, result.position.lat];
getNetworkInfo({latitude:result.position.lat,longitude:result.position.lng}).then(res=>{ par = {latitude:result.position.lat,longitude:result.position.lng}
} else {
this.lngLat = [...result];
par = {latitude:result[1],longitude:result[0]}
}
getNetworkInfo(par).then(res=>{
if(res.data.code==='SUCCESS'){ if(res.data.code==='SUCCESS'){
this.machines=res.data.data; this.machines=res.data.data;
this.createSign(); this.createSign();
} }
}) })
});
}, },
createSign() { createSign() {
// 创建一个机器Icon // 创建一个机器Icon
...@@ -223,27 +273,31 @@ ...@@ -223,27 +273,31 @@
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isAndroid) { if (isAndroid) {
//这个是安卓操作系统 //这个是安卓操作系统
window.location.href="androidamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0"; // window.location.href="androidamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0";
window.location.href=`https://uri.amap.com/marker?position=${info.netLongitude}, ${info.netLatitude}&name=${info.netAddress}`;
//判断是否切出浏览器 //判断是否切出浏览器
setTimeout(function(){ /* setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
MessageBox('TE', hidden )
if(typeof hidden =="undefined" || hidden ==false){ if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址 //应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航') MessageBox('提示', '请下载高德地图进行导航')
} }
}, 2500); }, 5000);*/
} }
if (isIOS) { if (isIOS) {
//这个是ios操作系统 //这个是ios操作系统
window.location.href="iosamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0" window.location.href=`https://uri.amap.com/marker?position=${info.netLongitude}, ${info.netLatitude}&name=${info.netAddress}`;
// window.location.href="iosamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0"
//判断是否切出浏览器 //判断是否切出浏览器
setTimeout(function(){ /* setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
if(typeof hidden =="undefined" || hidden ==false){ if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址 //应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航') MessageBox('提示', '请下载高德地图进行导航')
} }
}, 2500); }, 5000);*/
} }
/*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/ /*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/
}, },
......
...@@ -119,28 +119,31 @@ ...@@ -119,28 +119,31 @@
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器 var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isAndroid) { if (isAndroid) {
window.location.href=`https://uri.amap.com/marker?position=${info.netLongitude}, ${info.netLatitude}&name=${info.netAddress}`;
//这个是安卓操作系统 //这个是安卓操作系统
window.location.href="androidamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0"; // window.location.href="androidamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0";
//判断是否切出浏览器 //判断是否切出浏览器
setTimeout(function(){ /* setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
if(typeof hidden =="undefined" || hidden ==false){ if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址 //应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航') MessageBox('提示', '请下载高德地图进行导航')
} }
}, 2500); }, 2500);*/
} }
if (isIOS) { if (isIOS) {
window.location.href=`https://uri.amap.com/marker?position=${info.netLongitude}, ${info.netLatitude}&name=${info.netAddress}`;
//这个是ios操作系统 //这个是ios操作系统
window.location.href="iosamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0" // window.location.href="iosamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0"
//判断是否切出浏览器 //判断是否切出浏览器
setTimeout(function(){ /* setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
if(typeof hidden =="undefined" || hidden ==false){ if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址 //应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航') MessageBox('提示', '请下载高德地图进行导航')
} }
}, 2500); }, 2500);*/
} }
/*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/ /*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment