Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
e-shield-h5
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 93d36208
authored
Feb 07, 2025
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
getLocation,地图版本切换
1 parent
0b816dcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
src/components/mapContent.vue
src/utils/mapgeo.js
src/views/index.vue
src/components/mapContent.vue
View file @
93d3620
...
@@ -46,7 +46,7 @@ export default {
...
@@ -46,7 +46,7 @@ export default {
// new GLMap(mapapi => {
// new GLMap(mapapi => {
window
.
mapapi
=
mapapi
;
window
.
mapapi
=
mapapi
;
init
(
id
);
init
(
id
);
resolve
()
resolve
(
GLMap
)
})
})
}
else
{
}
else
{
checkLoadedTimeoutId
=
check
();
checkLoadedTimeoutId
=
check
();
...
...
src/utils/mapgeo.js
View file @
93d3620
...
@@ -3,7 +3,7 @@ const MAPGEO = {
...
@@ -3,7 +3,7 @@ const MAPGEO = {
getGeocoder
:
function
()
{
getGeocoder
:
function
()
{
// let AMap = window.AMap;
// let AMap = window.AMap;
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
MAPGEO
.
geocoder
=
window
.
mapapi
.
invoke
(
'Geocoder'
)
MAPGEO
.
geocoder
=
window
.
mapapi
version1
?
window
.
mapapiversion1
.
invoke
(
'Geocoder'
)
:
window
.
mapapi
.
invoke
(
'Geocoder'
)
resolve
(
MAPGEO
.
geocoder
)
resolve
(
MAPGEO
.
geocoder
)
// AMap.service("AMap.Geocoder", function () {
// AMap.service("AMap.Geocoder", function () {
// //回调函数
// //回调函数
...
@@ -53,9 +53,10 @@ const MAPGEO = {
...
@@ -53,9 +53,10 @@ const MAPGEO = {
}
}
function
geocoderGetAdr
(
arr
,
initIdx
)
{
function
geocoderGetAdr
(
arr
,
initIdx
)
{
const
mapapi
=
window
.
mapapiversion1
?
window
.
mapapiversion1
:
window
.
mapapi
const
timeoutId
=
window
.
setTimeout
(()
=>
{
const
timeoutId
=
window
.
setTimeout
(()
=>
{
arr
.
forEach
((
item
,
idx
)
=>
{
arr
.
forEach
((
item
,
idx
)
=>
{
window
.
mapapi
.
invoke
(
'getLocation'
,
window
.
mapapi
.
invoke
(
'Point'
,
item
[
0
],
item
[
1
]
),
res
=>
{
mapapi
.
invoke
(
'getLocation'
,
mapapi
.
invoke
(
'Point'
,
Number
(
item
[
0
]),
Number
(
item
[
1
])
),
res
=>
{
const
{
content
:
{
poi_desc
,
address_detail
:
{
province
,
city
,
district
,
town
,
street
}}}
=
res
const
{
content
:
{
poi_desc
,
address_detail
:
{
province
,
city
,
district
,
town
,
street
}}}
=
res
data
[
initIdx
+
idx
].
transferAddress
=
province
+
city
+
district
+
town
+
street
+
poi_desc
;
data
[
initIdx
+
idx
].
transferAddress
=
province
+
city
+
district
+
town
+
street
+
poi_desc
;
obj
.
totalNum
++
;
obj
.
totalNum
++
;
...
...
src/views/index.vue
View file @
93d3620
...
@@ -325,7 +325,11 @@ export default defineComponent({
...
@@ -325,7 +325,11 @@ export default defineComponent({
// }
// }
// });
// });
onMounted
(()
=>
{
onMounted
(()
=>
{
mapContentRefs
.
value
.
initMap
(
"container"
);
mapContentRefs
.
value
.
initMap
(
"container"
).
then
(
GLMap
=>
{
new
GLMap
({
version
:
1
},
mapapi
=>
{
window
.
mapapiversion1
=
mapapi
;
})
});
// mapContentRefs.value.initMap("container").then(res => {
// mapContentRefs.value.initMap("container").then(res => {
// mapContentRefs.value.getLocation();
// mapContentRefs.value.getLocation();
// })
// })
...
@@ -407,12 +411,7 @@ export default defineComponent({
...
@@ -407,12 +411,7 @@ export default defineComponent({
locates
.
push
(
item
.
wifiLocation
);
locates
.
push
(
item
.
wifiLocation
);
item
.
wifiLocation
.
transferAddress
=
""
;
item
.
wifiLocation
.
transferAddress
=
""
;
}
}
window
.
mapapi
.
invoke
(
'getLocation'
,
window
.
mapapi
.
invoke
(
'Point'
,
item
[
item
.
locationType
].
blng
,
item
[
item
.
locationType
].
blat
),
res
=>
{
points
.
push
(
drawMarker
(
item
,
map
,
locates
));
const
{
content
:
{
poi_desc
,
address_detail
:
{
province
,
city
,
district
,
town
,
street
}}}
=
res
item
.
transferAddress
=
province
+
city
+
district
+
town
+
street
+
poi_desc
;
locates
[
idx
].
transferAddress
=
province
+
city
+
district
+
town
+
street
+
poi_desc
;
points
.
push
(
drawMarker
(
item
,
map
,
locates
));
})
});
});
if
(
locates
.
length
<=
0
)
{
if
(
locates
.
length
<=
0
)
{
return
Toast
(
"暂无有效定位点信息"
);
return
Toast
(
"暂无有效定位点信息"
);
...
@@ -552,6 +551,8 @@ export default defineComponent({
...
@@ -552,6 +551,8 @@ export default defineComponent({
// offset: window.mapapi.invoke('Size', 22, 100)
// offset: window.mapapi.invoke('Size', 22, 100)
}
}
);
);
setAddress
();
setOnlineTime
();
});
});
// mapapi.invoke('mapOpenInfoWindow', infoWindow, mapapi.invoke('markerGetPosition', marker))
// mapapi.invoke('mapOpenInfoWindow', infoWindow, mapapi.invoke('markerGetPosition', marker))
// let infoWindow = new window.AMap.InfoWindow({
// let infoWindow = new window.AMap.InfoWindow({
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment