6529242b by unknown

提示运行环境

1 parent 5f4529cb
......@@ -27,7 +27,7 @@ layer.open({
content: "isAndroid:"+ isAndroid+ ",isiOS:" + isiOS,
time: 2
})
AppClient.prototype.getERCode = function (jsonStr, getCallback, postCallback) {
AppClient.prototype.getERCode = function (jsonStr, callback) {
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, postCallback) {
AppClient.prototype.getGPS = function (jsonStr, callback) {
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!'})
})
......
......@@ -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
})
}, '')
}
// }
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!