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
ec50b287
authored
2018-09-01 16:02:00 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
h5
1 parent
b74756ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
22 deletions
js/JSBridge.js
js/controller/mainController.js
js/controller/mapController.js
js/JSBridge.js
View file @
ec50b28
...
...
@@ -114,18 +114,14 @@ if(isAndroid || isiOS) {
}
setupWebViewJavascriptBridge
(
function
(
bridge
)
{
layer
.
open
({
content
:
bridge
,
time
:
2
})
if
(
isAndroid
)
{
bridge
.
init
(
function
(
message
,
responseCallback
)
{
responseCallback
({
'Javascript Responds'
:
'Wee!'
})
appClient
=
new
AppClient
(
bridge
,
isAndroid
);
})
// appClient = new AppClient(bridge, isAndroid);
}
if
(
isiOS
)
{
appClient
=
new
AppClient
(
bridge
,
isAndroid
);
appClient
=
new
AppClient
(
bridge
,
false
);
}
// 此处可以调用一些init的方法
});
...
...
js/controller/mainController.js
View file @
ec50b28
...
...
@@ -171,12 +171,20 @@ angular.module('myApp')
// // log('JS responding with', responseData)
// // responseCallback(responseData)
// })
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
function
(
res
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
''
,
function
(
res
,
responseCallback
)
{
var
res
=
JSON
.
parse
(
data
)
layer
.
open
({
content
:
res
,
time
:
5
content
:
data
,
time
:
2
});
},
''
)
// onSuccess(data)
})
// window.WebViewJavascriptBridge.callHandler('getGPS', function (res) {
// layer.open({
// content: res,
// time: 5
// });
// }, '')
}
else
if
(
isiOS
){
appClient
.
appObj
.
registerHandler
(
'postERCode'
,
function
(
data
,
responseCallback
)
{
...
...
js/controller/mapController.js
View file @
ec50b28
...
...
@@ -298,24 +298,25 @@ angular.module('myApp')
// }
// });
if
(
isAndroid
){
window
.
WebViewJavascriptBridge
.
callHandler
(
'
postGPS'
,
''
,
function
(
data
,
responseCallback
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'
getGPS'
,
''
,
function
(
res
,
responseCallback
)
{
var
res
=
JSON
.
parse
(
data
)
layer
.
open
({
content
:
data
,
time
:
2
});
onSuccess
(
data
)
})
window
.
WebViewJavascriptBridge
.
callHandler
.
getGPS
(
'getGPS'
,
'1'
,
function
(
res
)
{
// layer.open({
// content: JSON.stringify(res) + 'cb',
// time: 10
// });
onSuccess
({
latitude
:
30.2741500000
,
longitude
:
120.1551500000
})
},
''
)
// window.WebViewJavascriptBridge.callHandler
('getGPS','1', function (res) {
//
// layer.open({
//
// content: JSON.stringify(res) + 'cb',
//
// time: 10
//
// });
// //
onSuccess({
// //
latitude:30.2741500000,
// //
longitude:120.1551500000
// //
})
//
//
}, '')
}
else
if
(
isiOS
){
appClient
.
appObj
.
registerHandler
(
'postGPS'
,
function
(
data
,
responseCallback
)
{
var
res
=
JSON
.
parse
(
data
)
...
...
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