Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
contraceptives_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ynby
contraceptives_app
Commits
7ecd2625
Commit
7ecd2625
authored
Oct 26, 2020
by
gengchunlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
f70ccb26
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
26 deletions
+83
-26
index.js
src/router/index.js
+1
-1
mapUtils.js
src/utils/mapUtils.js
+1
-1
collectRecords.vue
src/views/collectRecords.vue
+4
-4
myMap.vue
src/views/myMap.vue
+68
-14
siteDetails.vue
src/views/siteDetails.vue
+9
-6
No files found.
src/router/index.js
View file @
7ecd2625
...
...
@@ -24,7 +24,7 @@ const routes = [
]
const
router
=
new
VueRouter
({
mode
:
'h
istory
'
,
mode
:
'h
ash
'
,
base
:
process
.
env
.
BASE_URL
,
routes
})
...
...
src/utils/mapUtils.js
View file @
7ecd2625
...
...
@@ -8,7 +8,7 @@ export const location = {
mapObj
.
plugin
([
'AMap.Geolocation'
],
function
()
{
geolocation
=
new
AMap
.
Geolocation
({
enableHighAccuracy
:
true
,
// 是否使用高精度定位,默认:true
timeout
:
10
000
,
// 超过10秒后停止定位,默认:无穷大
// timeout: 5
000, // 超过10秒后停止定位,默认:无穷大
maximumAge
:
0
,
// 定位结果缓存0毫秒,默认:0
convert
:
true
,
// 自动偏移坐标,偏移后的坐标为高德坐标,默认:true
showButton
:
false
,
// 显示定位按钮,默认:true
...
...
src/views/collectRecords.vue
View file @
7ecd2625
...
...
@@ -101,10 +101,10 @@
this
.
loading
=
true
this
.
param
.
pageIndex
+=
1
this
.
getRecordInfo
()
}
},
goBack
()
{
window
.
history
.
go
(
-
1
)
}
,
goBack
()
{
window
.
history
.
go
(
-
1
)
},
},
beforeDestroy
()
{
this
.
detailInfo
=
[]
...
...
src/views/myMap.vue
View file @
7ecd2625
...
...
@@ -101,16 +101,66 @@
callMobile
(
"goIndex"
,
{});
},
createMap
()
{
let
self
=
this
let
geolocation
=
location
.
initMap
(
"map-container"
);
//定位
AMap
.
event
.
addListener
(
geolocation
,
"complete"
,
result
=>
{
this
.
lngLat
=
[
result
.
position
.
lng
,
result
.
position
.
lat
];
getNetworkInfo
({
latitude
:
result
.
position
.
lat
,
longitude
:
result
.
position
.
lng
}).
then
(
res
=>
{
if
(
res
.
data
.
code
===
'SUCCESS'
){
this
.
machines
=
res
.
data
.
data
;
this
.
createSign
();
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
];
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'
){
this
.
machines
=
res
.
data
.
data
;
this
.
createSign
();
}
})
},
createSign
()
{
// 创建一个机器Icon
...
...
@@ -223,27 +273,31 @@
var
isIOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
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
if
(
typeof
hidden
==
"undefined"
||
hidden
==
false
){
MessageBox('TE', hidden )
if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航')
}
},
2500
);
},
5000);*/
}
if
(
isIOS
)
{
//这个是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
if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航')
}
},
2500
);
},
5000);*/
}
/*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/
},
...
...
src/views/siteDetails.vue
View file @
7ecd2625
...
...
@@ -119,28 +119,31 @@
var
isAndroid
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Linux'
)
>
-
1
;
//android终端或者uc浏览器
var
isIOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
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
if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航')
}
},
2500
);
}, 2500);
*/
}
if
(
isIOS
)
{
window
.
location
.
href
=
`https://uri.amap.com/marker?position=
${
info
.
netLongitude
}
,
${
info
.
netLatitude
}
&name=
${
info
.
netAddress
}
`
;
//这个是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
if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航')
}
},
2500
);
}, 2500);
*/
}
/*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment