Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨建斌
/
dy-wx2
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
982bafbd
authored
2018-09-08 17:28:20 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
无法获取定位提示
1 parent
1cffe74c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
24 deletions
js/JSBridge.js
js/controller/mapController.js
js/JSBridge.js
View file @
982bafb
...
...
@@ -53,10 +53,29 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
from
:
'H5'
,
params
:
dataParams
};
var
isRes
=
false
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getERCode'
,
jsonStr
);
window
.
WebViewJavascriptBridge
.
registerHandler
(
'postERCode'
,
function
(
data
,
responseCallback
)
{
window
.
WebViewJavascriptBridge
.
registerHandler
(
'postERCode'
,
callback
)
}
else
{
this
.
appObj
.
registerHandler
(
"postERCOde"
,
callback
)
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
function
(
data
,
responseCallback
)
{
});
}
};
AppClient
.
prototype
.
getGPS
=
function
(
jsonStr
,
callback
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
))
{
dataParams
=
JSON
.
parse
(
jsonStr
);
}
var
param
=
{
from
:
'H5'
,
params
:
dataParams
};
var
isRes
=
false
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
function
(
data
,
responseCallback
)
{
isRes
=
true
var
latitude
=
''
var
longitude
=
''
...
...
@@ -67,18 +86,18 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
callback
(
latitude
,
longitude
,
responseCallback
)
})
}
else
{
this
.
appObj
.
registerHandler
(
"post
ERCOde
"
,
function
(
data
,
responseCallback
)
{
this
.
appObj
.
registerHandler
(
"post
GPS
"
,
function
(
data
,
responseCallback
)
{
isRes
=
true
var
latitude
=
''
var
longitude
=
''
var
result
=
/
\{([\s\S]
*
)\}
/
.
exec
(
data
);
var
arr
=
result
[
1
].
split
(
','
)
var
arr
=
result
[
1
].
split
(
','
)
latitude
=
arr
[
0
].
split
(
':'
)[
1
]
longitude
=
arr
[
1
].
split
(
':'
)[
1
]
callback
(
latitude
,
longitude
,
responseCallback
)
})
this
.
appObj
.
callHandler
(
"get
ERCode
"
,
param
,
function
(
data
,
responseCallback
)
{
this
.
appObj
.
callHandler
(
"get
GPS
"
,
param
,
function
(
data
,
responseCallback
)
{
});
}
setTimeout
(
function
()
{
...
...
@@ -90,24 +109,6 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
}
},
3000
)
};
AppClient
.
prototype
.
getGPS
=
function
(
jsonStr
,
callback
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
))
{
dataParams
=
JSON
.
parse
(
jsonStr
);
}
var
param
=
{
from
:
'H5'
,
params
:
dataParams
};
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
callback
);
}
else
{
this
.
appObj
.
registerHandler
(
"postGPS"
,
callback
)
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
function
(
data
,
responseCallback
)
{
});
}
};
if
(
isAndroid
||
isiOS
)
{
...
...
js/controller/mapController.js
View file @
982bafb
...
...
@@ -302,6 +302,7 @@ angular.module('myApp')
$rootScope
.
isLoadFinish
=
true
},
1000
)
}
else
{
appClient
.
getGPS
(
''
,
function
(
latitude
,
longitude
,
cb
)
{
onSuccess
({
...
...
Write
Preview
Styling with
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