Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
oEshield
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 b2cb5f3b
authored
Feb 14, 2025
by
wangzhihui
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
8cf43f19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
16 deletions
src/utils/mapBgeo.js
src/utils/mapBgeo.js
View file @
b2cb5f3
...
...
@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-11-28 16:37:15
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2025-02-1
3 17:17:1
2
* @LastEditTime: 2025-02-1
4 15:00:0
2
* @FilePath: \oEshield\src\utils\mapgeo.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -42,7 +42,7 @@ const MAPGEO = {
}
})
// console.log(data,'data')
Promise
.
race
([
geocoderGetAdr
(
data
),
limitload
()])
//
Promise.race([geocoderGetAdr(data),limitload()])
geocoderGetAdr
(
data
)
function
fixed6
(
num
)
{
return
Number
(
num
).
toFixed
(
6
);
...
...
@@ -70,16 +70,33 @@ const MAPGEO = {
try
{
const
o
=
await
AMap
.
invoke
(
'Point'
,
item
.
blng
,
item
.
blat
);
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
10
))
MAPGEO
.
geocoder
.
getLocation
(
o
,(
res
)
=>
{
MAPGEO
.
geocoder
.
getLocation
(
o
,(
res
)
=>
{
setAddress
(
o
,
res
);
obj
.
totalNum
++
;
// console.log(obj.totalNum , obj.realNum,obj.totalNum === obj.realNum)
if
(
obj
.
totalNum
===
obj
.
realNum
&&
typeof
cb
===
'function'
)
{
obj
.
totalNum
++
;
// console.log(obj.totalNum , obj.realNum,obj.totalNum === obj.realNum)
if
(
obj
.
totalNum
===
obj
.
realNum
&&
typeof
cb
===
'function'
)
{
cb
(
data
);
resolve
()
}
cb
(
data
);
resolve
()
}
});
// const res=await new Promise((resolve)=>{
// MAPGEO.geocoder.getLocation(o,(res)=>{
// resolve(res)
// });
// })
// console.log(res,obj.totalNum , obj.realNum,obj.totalNum === obj.realNum)
// setAddress(o, res);
// obj.totalNum++;
// // console.log(obj.totalNum , obj.realNum,obj.totalNum === obj.realNum)
// if (obj.totalNum === obj.realNum && typeof cb === 'function') {
// cb(data);
// resolve()
// }
}
catch
(
error
)
{
console
.
error
(
`Error processing item
${
item
}
:`
,
error
);
...
...
@@ -90,13 +107,13 @@ const MAPGEO = {
}
function
limitload
(){
let
time
=
(
data
.
length
/
58
)
*
1000
;
new
Promise
(
resolve
=>
setTimeout
(()
=>
{
if
(
typeof
cb
===
'function'
)
{
cb
(
data
);
resolve
()
}
},
time
))
// let time=data.length
*1000;
//
new Promise(resolve => setTimeout(()=>{
//
if ( typeof cb === 'function') {
//
cb(data);
//
resolve()
//
}
//
}, time))
}
}
...
...
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