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
245acb2d
authored
2018-09-01 17:16:19 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
js
1 parent
b2f12ccd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
js/JSBridge.js
js/controller/mapController.js
js/JSBridge.js
View file @
245acb2
...
...
@@ -3,10 +3,6 @@ var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终
var
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
var
appClient
=
null
;
function
AppClient
(
appObj
,
isAndroid
)
{
// layer.open({
// content: JSON.stringify(appObj),
// time: 2
// })
this
.
appObj
=
appObj
;
this
.
isAndroid
=
isAndroid
;
};
...
...
@@ -54,7 +50,6 @@ AppClient.prototype.getERCode = function (jsonStr, getCallback, postCallback) {
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
getCallback
);
this
.
appObj
.
registerHandler
(
"postERCOde"
,
postCallback
)
}
// }
};
AppClient
.
prototype
.
getGPS
=
function
(
jsonStr
,
getCallback
,
postCallback
)
{
var
dataParams
=
""
;
...
...
@@ -65,14 +60,18 @@ AppClient.prototype.getGPS = function (jsonStr, getCallback, postCallback) {
from
:
'H5'
,
params
:
dataParams
};
// if (this.isAndroid) {
// this.appObj.callHandler('getGPS', jsonStr, function (res) {
// layer.open({
// content: res,
// time: 2
// })
// })
// } else {
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
appObj
.
callHandler
(
'getGPS'
,
jsonStr
,
function
(
res
)
{
layer
.
open
({
content
:
res
,
time
:
2
})
});
}
else
{
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
getCallback
);
this
.
appObj
.
registerHandler
(
"postERCOde"
,
postCallback
)
}
this
.
appObj
.
registerHandler
(
"postGPS"
,
postCallback
)
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
getCallback
);
...
...
@@ -100,8 +99,8 @@ if(isAndroid || isiOS) {
}
setupWebViewJavascriptBridge
(
function
(
bridge
)
{
if
(
isAndroid
)
{
bridge
.
init
(
function
(
message
,
responseCallback
)
{
appClient
=
new
AppClient
(
bridge
,
true
);
bridge
.
init
(
function
(
message
,
responseCallback
)
{
responseCallback
({
'Javascript Responds'
:
'Wee!'
})
})
}
...
...
js/controller/mapController.js
View file @
245acb2
...
...
@@ -306,21 +306,21 @@ angular.module('myApp')
// });
// onSuccess(data)
// })
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
''
,
function
(
res
,
responseCallback
)
{
// var data = JSON.parse(res
// var data = eval(res)
layer
.
open
({
content
:
res
,
time
:
2
});
onSuccess
(
data
)
})
// appClient.getGPS('', function (data, cb) {
// window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
// // var data = JSON.parse(res
// // var data = eval(res)
// layer.open({
// content:
data
,
// content:
res
,
// time: 2
// });
// onSuccess(data)
// })
// })
appClient
.
getGPS
(
''
,
function
(
data
,
cb
)
{
layer
.
open
({
content
:
data
,
time
:
2
})
})
// window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) {
// // layer.open({
// // content: JSON.stringify(res) + 'cb',
...
...
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