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 {
// new GLMap(mapapi => {
window
.
mapapi
=
mapapi
;
init
(
id
);
resolve
()
resolve
(
GLMap
)
})
}
else
{
checkLoadedTimeoutId
=
check
();
...
...
src/utils/mapgeo.js
View file @
93d3620
...
...
@@ -3,7 +3,7 @@ const MAPGEO = {
getGeocoder
:
function
()
{
// let AMap = window.AMap;
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
)
// AMap.service("AMap.Geocoder", function () {
// //回调函数
...
...
@@ -53,9 +53,10 @@ const MAPGEO = {
}
function
geocoderGetAdr
(
arr
,
initIdx
)
{
const
mapapi
=
window
.
mapapiversion1
?
window
.
mapapiversion1
:
window
.
mapapi
const
timeoutId
=
window
.
setTimeout
(()
=>
{
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
data
[
initIdx
+
idx
].
transferAddress
=
province
+
city
+
district
+
town
+
street
+
poi_desc
;
obj
.
totalNum
++
;
...
...
src/views/index.vue
View file @
93d3620
...
...
@@ -325,7 +325,11 @@ export default defineComponent({
// }
// });
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.getLocation();
// })
...
...
@@ -407,12 +411,7 @@ export default defineComponent({
locates
.
push
(
item
.
wifiLocation
);
item
.
wifiLocation
.
transferAddress
=
""
;
}
window
.
mapapi
.
invoke
(
'getLocation'
,
window
.
mapapi
.
invoke
(
'Point'
,
item
[
item
.
locationType
].
blng
,
item
[
item
.
locationType
].
blat
),
res
=>
{
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
));
})
points
.
push
(
drawMarker
(
item
,
map
,
locates
));
});
if
(
locates
.
length
<=
0
)
{
return
Toast
(
"暂无有效定位点信息"
);
...
...
@@ -552,6 +551,8 @@ export default defineComponent({
// offset: window.mapapi.invoke('Size', 22, 100)
}
);
setAddress
();
setOnlineTime
();
});
// mapapi.invoke('mapOpenInfoWindow', infoWindow, mapapi.invoke('markerGetPosition', marker))
// 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