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
6529242b
authored
2018-09-02 18:10:23 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提示运行环境
1 parent
5f4529cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
59 deletions
js/JSBridge.js
js/controller/mapController.js
js/JSBridge.js
View file @
6529242
...
...
@@ -27,7 +27,7 @@ layer.open({
content
:
"isAndroid:"
+
isAndroid
+
",isiOS:"
+
isiOS
,
time
:
2
})
AppClient
.
prototype
.
getERCode
=
function
(
jsonStr
,
getCallback
,
postC
allback
)
{
AppClient
.
prototype
.
getERCode
=
function
(
jsonStr
,
c
allback
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
)){
dataParams
=
JSON
.
parse
(
jsonStr
);
...
...
@@ -37,41 +37,36 @@ AppClient.prototype.getERCode = function (jsonStr, getCallback, postCallback) {
params
:
dataParams
};
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getERCode'
,
jsonStr
,
getCallback
);
window
.
WebViewJavascriptBridge
.
callHandler
(
'getERCode'
,
jsonStr
);
window
.
WebViewJavascriptBridge
.
registerHandler
(
'postERCode'
,
callback
);
}
else
{
this
.
appObj
.
registerHandler
(
"postERCOde"
,
postCallback
)
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
getCallback
);
this
.
appObj
.
registerHandler
(
"postERCOde"
,
callback
)
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
function
(
data
,
resCallback
)
{
});
}
};
AppClient
.
prototype
.
getGPS
=
function
(
jsonStr
,
getCallback
,
postC
allback
)
{
AppClient
.
prototype
.
getGPS
=
function
(
jsonStr
,
c
allback
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
)){
dataParams
=
JSON
.
parse
(
jsonStr
);
}
var
iOSData
=
{
from
:
'H5'
,
params
:
dataParams
};
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
function
(
res
)
{
layer
.
open
({
content
:
res
,
time
:
2
})
});
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
jsonStr
,
callback
);
}
else
{
this
.
appObj
.
registerHandler
(
"postGPS"
,
postCallback
)
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
getCallback
);
}
this
.
appObj
.
registerHandler
(
"postGPS"
,
callback
)
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
function
(
data
,
resCallback
)
{
// }
});
}
};
if
(
isAndroid
||
isiOS
)
{
function
setupWebViewJavascriptBridge
(
callback
)
{
if
(
window
.
WebViewJavascriptBridge
)
{
return
callback
(
WebViewJavascriptBridge
);
}
if
(
isiOS
){
if
(
window
.
WVJBCallbacks
)
{
return
window
.
WVJBCallbacks
.
push
(
callback
);
}
...
...
@@ -90,10 +85,6 @@ if(isAndroid || isiOS) {
setupWebViewJavascriptBridge
(
function
(
bridge
)
{
if
(
isAndroid
)
{
appClient
=
new
AppClient
(
window
.
WebViewJavascriptBridge
,
true
);
// layer.open({
// content: JSON.stringify(appClient),
// time: 2
// })
bridge
.
init
(
function
(
message
,
responseCallback
)
{
responseCallback
({
'Javascript Responds'
:
'Wee!'
})
})
...
...
js/controller/mapController.js
View file @
6529242
...
...
@@ -302,17 +302,6 @@ angular.module('myApp')
$rootScope
.
isLoadFinish
=
true
},
1000
)
}
else
{
if
(
isAndroid
){
// 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
)
{
onSuccess
({
latitude
:
30.2741500000
,
...
...
@@ -323,38 +312,50 @@ angular.module('myApp')
time
:
2
})
})
// window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) {
// if(isAndroid){
//
// // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
// // // var data = JSON.parse(res
// // // var data = eval(res)
// // layer.open({
// // content: res,
// // time: 2
// // });
// // onSuccess(data)
// // })
//
// // 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)
// // layer.open({
// // content: data,
// // time: 2
// // });
// // })
// appClient.getGPS('getGPS', '', function (res) {
// // layer.open({
// // content: JSON.stringify(res) + 'cb',
// // time: 10
// // });
// //
onSuccess({
// //
latitude:30.2741500000,
// //
longitude:120.1551500000
// //
})
//
onSuccess({
//
latitude:30.2741500000,
//
longitude:120.1551500000
//
})
//
// }, '')
}
else
if
(
isiOS
){
// appClient.appObj.registerHandler('postGPS', function(data, responseCallback) {
// var res = JSON.parse(data)
// layer.open({
// content: data,
// time: 2
// });
// })
appClient
.
getGPS
(
'getGPS'
,
''
,
function
(
res
)
{
// layer.open({
// content: JSON.stringify(res) + 'cb',
// time: 10
// });
onSuccess
({
latitude
:
30.2741500000
,
longitude
:
120.1551500000
})
},
''
)
}
// }
}
}
...
...
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