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
c22c9704
authored
2018-09-01 17:07:58 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
h5
1 parent
8ba9954d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
22 deletions
js/JSBridge.js
js/controller/mapController.js
js/JSBridge.js
View file @
c22c970
var
u
=
navigator
.
userAgent
;
var
isAndroid
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
;
//android终端
var
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
var
appClient
=
n
ew
AppClient
({},
false
);
;
var
appClient
=
n
ull
;
function
AppClient
(
appObj
,
isAndroid
)
{
layer
.
open
({
content
:
JSON
.
stringify
(
appObj
),
...
...
@@ -19,7 +19,7 @@ function isJson(str) {
return
true
;
}
function
toJson
(
str
)
{
var
i
=
str
.
index
(
'
"
{'
)
var
i
=
str
.
index
(
'{'
)
try
{
var
arr
=
str
.
split
(
2
,
str
.
length
-
4
)
console
.
log
(
arr
)
...
...
@@ -101,7 +101,7 @@ if(isAndroid || isiOS) {
setupWebViewJavascriptBridge
(
function
(
bridge
)
{
if
(
isAndroid
)
{
bridge
.
init
(
function
(
message
,
responseCallback
)
{
appClient
=
new
AppClient
(
bridge
,
isAndroid
);
appClient
=
new
AppClient
(
bridge
,
true
);
responseCallback
({
'Javascript Responds'
:
'Wee!'
})
})
}
...
...
@@ -111,9 +111,5 @@ if(isAndroid || isiOS) {
// 此处可以调用一些init的方法
});
}
else
{
// layer.open({
// content: '非原生',
// time: 2
// })
appClient
=
new
AppClient
({},
false
);
}
...
...
js/controller/mapController.js
View file @
c22c970
...
...
@@ -298,29 +298,29 @@ angular.module('myApp')
// }
// });
if
(
isAndroid
){
// // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
// // var res = JSON.parse(data)
// // layer.open({
// // content: data,
// // time: 2
// // });
// // onSuccess(data)
// // })
// window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
// // var data = JSON.parse(res
// // var data = eval(res)
// var res = JSON.parse(data)
// layer.open({
// content:
res
,
// content:
data
,
// 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