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
3699474c
authored
2018-09-01 16:40:59 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
h5
1 parent
e70e826a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
71 deletions
js/JSBridge.js
js/controller/mainController.js
js/controller/mapController.js
js/JSBridge.js
View file @
3699474
...
...
@@ -29,28 +29,28 @@ function toJson(str) {
// getSign(jsonStr);
// }
//
AppClient
.
prototype
.
getERCode
=
function
(
callbackName
,
callback
,
jsonStr
)
{
AppClient
.
prototype
.
getERCode
=
function
(
jsonStr
,
getCallback
,
postCallback
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
)){
dataParams
=
JSON
.
parse
(
jsonStr
);
}
var
iOSData
=
{
var
param
=
{
from
:
'H5'
,
params
:
dataParams
};
if
(
this
.
isAndroid
)
{
window
.
WebViewJavascriptBridge
.
callHandler
(
'getERCode'
,
jsonStr
,
function
(
res
)
{
layer
.
open
({
content
:
res
,
time
:
2
})
});
}
else
{
this
.
appObj
.
callHandler
(
"getERCode"
,
iOSData
,
callback
);
}
// if
(this.isAndroid) {
// this.appObj
.callHandler('getERCode', jsonStr, function (res) {
//
layer.open({
//
content: res,
//
time: 2
//
})
//
});
//
} else {
this
.
appObj
.
registerHandler
(
"postERCOde"
,
postCallback
)
this
.
appObj
.
callHandler
(
"getERCode"
,
param
,
getCallback
);
//
}
};
AppClient
.
prototype
.
getGPS
=
function
(
callbackName
,
callback
,
jsonStr
)
{
AppClient
.
prototype
.
getGPS
=
function
(
jsonStr
,
getCallback
,
postCallback
)
{
var
dataParams
=
""
;
if
(
isJson
(
jsonStr
)){
dataParams
=
JSON
.
parse
(
jsonStr
);
...
...
@@ -59,39 +59,19 @@ AppClient.prototype.getGPS = function (callbackName, callback, jsonStr) {
from
:
'H5'
,
params
:
dataParams
};
if
(
this
.
isAndroid
)
{
this
.
appObj
.
getGPS
(
'H5'
,
jsonStr
);
}
else
{
this
.
appObj
.
callHandler
(
"getGPS"
,
iOSData
,
callback
);
// if (this.isAndroid) {
// this.appObj.callHandler('getGPS', jsonStr, function (res) {
// layer.open({
// content: res,
// time: 2
// })
// })
// } else {
this
.
appObj
.
registerHandler
(
"postGPS"
,
postCallback
)
this
.
appObj
.
callHandler
(
"getGPS"
,
param
,
getCallback
);
}
//
}
};
//
// window. = function (_params) {
//
// }
// window.postGPS = function (params) {
// layer.open({
// content: JSON.stringify(_params),
// time: 10
// });
// }
// var appClient = new AppClient(window.android, true);
// layer.open({
// content: window.android,
// time: 2
// })
// layer.open({
// content: 'hah' ,
// time: 2
// })
// bridge.registerHandler('postGPS', function(data, responseCallback) {
// log('ObjC called testJavascriptHandler with', data)
// var responseData = { 'Javascript Says':'Right back atcha!' }
// log('JS responding with', responseData)
// responseCallback(responseData)
// })
if
(
isAndroid
||
isiOS
)
{
...
...
js/controller/mainController.js
View file @
3699474
...
...
@@ -161,31 +161,33 @@ angular.module('myApp')
if
(
isAndroid
){
window
.
WebViewJavascriptBridge
.
registerHandler
(
'postERCode'
,
function
(
data
,
responseCallback
)
{
appClient
.
getERCode
(
''
,
function
(
data
,
cb
)
{
layer
.
open
({
content
:
data
,
time
:
10
});
})
window
.
WebViewJavascriptBridge
.
callHandler
(
'getERCode'
,
function
(
data
,
responseCallback
)
{
time
:
2
})
}
else
if
(
isiOS
){
appClient
.
appObj
.
registerHandler
(
'postERCode'
,
function
(
data
,
responseCallback
)
{
layer
.
open
({
content
:
JSON
.
stringify
(
data
),
time
:
10
});
// log('ObjC called testJavascriptHandler with', data)
// var responseData = { 'Javascript Says':'Right back atcha!' }
// log('JS responding with', responseData)
// responseCallback(responseData)
})
appClient
.
getERCode
(
'getERCode'
,
function
(
res
)
{
// window.WebViewJavascriptBridge.registerHandler('postERCode', function(data, responseCallback) {
// layer.open({
// content: data,
// time: 10
// });
// })
// window.WebViewJavascriptBridge.callHandler('getERCode', function(data, responseCallback) {
// })
// }else if(isiOS){
// appClient.appObj.registerHandler('postERCode', function(data, responseCallback) {
// layer.open({
// content: JSON.stringify(res) + 'cb'
,
// content: JSON.stringify(data)
,
// time: 10
// });
},
''
)
// })
// appClient.getERCode('getERCode', function (res) {
// // layer.open({
// // content: JSON.stringify(res) + 'cb',
// // time: 10
// // });
// }, '')
}
else
{
layer
.
open
({
content
:
'调起摄像头失败'
,
...
...
js/controller/mapController.js
View file @
3699474
...
...
@@ -298,22 +298,28 @@ 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 res = JSON.parse(data)
// // var data = JSON.parse(res
// // var data = eval(res)
// layer.open({
// content:
data
,
// content:
res
,
// time: 2
// });
// onSuccess(data)
// })
window
.
WebViewJavascriptBridge
.
callHandler
(
'getGPS'
,
''
,
function
(
res
,
responseCallback
)
{
// var data = JSON.parse(res
// var data = eval(res)
appClient
.
getGPS
(
''
,
function
(
data
,
cb
)
{
layer
.
open
({
content
:
res
,
content
:
data
,
time
:
2
});
onSuccess
(
data
)
})
})
// window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) {
// // layer.open({
...
...
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