Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fns_front_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
fns_front_2
Commits
2b1d2184
Commit
2b1d2184
authored
Sep 27, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
87a04f76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
23 deletions
+53
-23
index.ts
src/service/AddressService/index.ts
+43
-23
jsBridge2.js
src/utils/jsBridge2.js
+10
-0
No files found.
src/service/AddressService/index.ts
View file @
2b1d2184
import
{
Toast
}
from
'vant'
import
{
Toast
}
from
'vant'
import
baseAxios
,
{
iRet
}
from
'../index'
import
baseAxios
,
{
iRet
}
from
'../index'
import
{
iNearbyOutLet
}
from
'./types'
import
{
iNearbyOutLet
}
from
'./types'
import
Bridge
from
"@/utils/jsBridge2"
class
AddressService
{
class
AddressService
{
static
instance
:
AddressService
static
instance
:
AddressService
static
getInstance
()
{
static
getInstance
()
{
...
@@ -12,30 +13,49 @@ class AddressService {
...
@@ -12,30 +13,49 @@ class AddressService {
getNearby
(
data
:
{
bank_code
:
number
;
number
:
number
})
{
getNearby
(
data
:
{
bank_code
:
number
;
number
:
number
})
{
return
new
Promise
<
iRet
<
iNearbyOutLet
[]
>>
((
resolve
)
=>
{
return
new
Promise
<
iRet
<
iNearbyOutLet
[]
>>
((
resolve
)
=>
{
if
(
'geolocation'
in
window
.
navigator
)
{
window
.
navigator
.
geolocation
.
getCurrentPosition
(
new
Bridge
().
bridge_getGps
(
null
,
(
params
:
any
)
=>
{
(
position
)
=>
{
console
.
log
(
params
,
"show params"
);
const
la
=
position
.
coords
.
latitude
.
toString
()
const
lo
=
position
.
coords
.
longitude
.
toString
()
const
list
=
params
.
split
(
','
)
resolve
(
baseAxios
<
iNearbyOutLet
[]
>
({
resolve
(
method
:
'post'
,
baseAxios
<
iNearbyOutLet
[]
>
({
url
:
'/address/nearby'
,
method
:
'post'
,
data
:
{
url
:
'/address/nearby'
,
...
data
,
data
:
{
longitude
:
lo
,
...
data
,
latitude
:
la
,
longitude
:
list
[
0
],
},
latitude
:
list
[
1
],
}),
},
)
}),
},
(
error
)
=>
{
Toast
(
error
.
message
)
},
)
)
}
else
{
})
Toast
(
'不支持获取GPS'
)
}
// if ('geolocation' in window.navigator) {
// window.navigator.geolocation.getCurrentPosition(
// (position) => {
// const la = position.coords.latitude.toString()
// const lo = position.coords.longitude.toString()
// resolve(
// baseAxios<iNearbyOutLet[]>({
// method: 'post',
// url: '/address/nearby',
// data: {
// ...data,
// longitude: lo,
// latitude: la,
// },
// }),
// )
// },
// (error) => {
// Toast(error.message)
// },
// )
// } else {
// Toast('不支持获取GPS')
// }
})
})
}
}
...
...
src/utils/jsBridge2.js
View file @
2b1d2184
...
@@ -511,5 +511,15 @@ jsBridge.prototype.bridge_navigate = function (params, success) {
...
@@ -511,5 +511,15 @@ jsBridge.prototype.bridge_navigate = function (params, success) {
}
}
}
}
/* 跳到导航软件 */
jsBridge
.
prototype
.
bridge_getGps
=
function
(
params
,
success
)
{
if
(
this
.
curApp
==
ANDROID
)
{
dsBridge
.
call
(
'bridge_getGps'
,
params
,
success
)
}
else
if
(
this
.
curApp
==
IOS
)
{
this
.
callHandler
(
'bridge_getGps'
,
params
,
success
)
}
}
export
default
jsBridge
;
export
default
jsBridge
;
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