6529242b by unknown

提示运行环境

1 parent 5f4529cb
...@@ -27,7 +27,7 @@ layer.open({ ...@@ -27,7 +27,7 @@ layer.open({
27 content: "isAndroid:"+ isAndroid+ ",isiOS:" + isiOS, 27 content: "isAndroid:"+ isAndroid+ ",isiOS:" + isiOS,
28 time: 2 28 time: 2
29 }) 29 })
30 AppClient.prototype.getERCode = function (jsonStr, getCallback, postCallback) { 30 AppClient.prototype.getERCode = function (jsonStr, callback) {
31 var dataParams = ""; 31 var dataParams = "";
32 if(isJson(jsonStr)){ 32 if(isJson(jsonStr)){
33 dataParams = JSON.parse(jsonStr); 33 dataParams = JSON.parse(jsonStr);
...@@ -37,41 +37,36 @@ AppClient.prototype.getERCode = function (jsonStr, getCallback, postCallback) { ...@@ -37,41 +37,36 @@ AppClient.prototype.getERCode = function (jsonStr, getCallback, postCallback) {
37 params: dataParams 37 params: dataParams
38 }; 38 };
39 if(this.isAndroid) { 39 if(this.isAndroid) {
40 window.WebViewJavascriptBridge.callHandler('getERCode', jsonStr, getCallback); 40 window.WebViewJavascriptBridge.callHandler('getERCode', jsonStr);
41 window.WebViewJavascriptBridge.registerHandler('postERCode', callback);
41 } else { 42 } else {
42 this.appObj.registerHandler("postERCOde", postCallback) 43 this.appObj.registerHandler("postERCOde", callback)
43 this.appObj.callHandler("getERCode", param, getCallback); 44 this.appObj.callHandler("getERCode", param, function (data, resCallback) {
45
46 });
44 } 47 }
45 }; 48 };
46 AppClient.prototype.getGPS = function (jsonStr, getCallback, postCallback) { 49 AppClient.prototype.getGPS = function (jsonStr, callback) {
47 var dataParams = ""; 50 var dataParams = "";
48 if(isJson(jsonStr)){ 51 if(isJson(jsonStr)){
49 dataParams = JSON.parse(jsonStr); 52 dataParams = JSON.parse(jsonStr);
50 }
51 var iOSData = { 53 var iOSData = {
52 from: 'H5', 54 from: 'H5',
53 params: dataParams 55 params: dataParams
54 }; 56 };
55 if(this.isAndroid) { 57 if(this.isAndroid) {
56 window.WebViewJavascriptBridge.callHandler('getGPS', jsonStr, function (res) { 58 window.WebViewJavascriptBridge.callHandler('getGPS', jsonStr, callback);
57 layer.open({
58 content: res,
59 time: 2
60 })
61 });
62 } else { 59 } else {
63 this.appObj.registerHandler("postGPS", postCallback) 60 this.appObj.registerHandler("postGPS", callback)
64 this.appObj.callHandler("getGPS", param, getCallback); 61 this.appObj.callHandler("getGPS", param, function (data, resCallback) {
65 }
66
67 62
68 // } 63 });
64 }
69 }; 65 };
70 66
71 if(isAndroid || isiOS) { 67 if(isAndroid || isiOS) {
72 68
73 function setupWebViewJavascriptBridge(callback) { 69 function setupWebViewJavascriptBridge(callback) {
74
75 if (window.WebViewJavascriptBridge) { return callback(WebViewJavascriptBridge); } 70 if (window.WebViewJavascriptBridge) { return callback(WebViewJavascriptBridge); }
76 if(isiOS){ 71 if(isiOS){
77 if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback); } 72 if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback); }
...@@ -90,10 +85,6 @@ if(isAndroid || isiOS) { ...@@ -90,10 +85,6 @@ if(isAndroid || isiOS) {
90 setupWebViewJavascriptBridge(function(bridge) { 85 setupWebViewJavascriptBridge(function(bridge) {
91 if(isAndroid) { 86 if(isAndroid) {
92 appClient = new AppClient(window.WebViewJavascriptBridge, true); 87 appClient = new AppClient(window.WebViewJavascriptBridge, true);
93 // layer.open({
94 // content: JSON.stringify(appClient),
95 // time: 2
96 // })
97 bridge.init(function (message, responseCallback) { 88 bridge.init(function (message, responseCallback) {
98 responseCallback({'Javascript Responds': 'Wee!'}) 89 responseCallback({'Javascript Responds': 'Wee!'})
99 }) 90 })
......
...@@ -302,17 +302,6 @@ angular.module('myApp') ...@@ -302,17 +302,6 @@ angular.module('myApp')
302 $rootScope.isLoadFinish = true 302 $rootScope.isLoadFinish = true
303 },1000) 303 },1000)
304 } else { 304 } else {
305 if(isAndroid){
306
307 // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
308 // // var data = JSON.parse(res
309 // // var data = eval(res)
310 // layer.open({
311 // content: res,
312 // time: 2
313 // });
314 // onSuccess(data)
315 // })
316 appClient.getGPS('', function (data, cb) { 305 appClient.getGPS('', function (data, cb) {
317 onSuccess({ 306 onSuccess({
318 latitude:30.2741500000, 307 latitude:30.2741500000,
...@@ -323,38 +312,50 @@ angular.module('myApp') ...@@ -323,38 +312,50 @@ angular.module('myApp')
323 time: 2 312 time: 2
324 }) 313 })
325 }) 314 })
326 // window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) { 315 // if(isAndroid){
316 //
317 // // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
318 // // // var data = JSON.parse(res
319 // // // var data = eval(res)
320 // // layer.open({
321 // // content: res,
322 // // time: 2
323 // // });
324 // // onSuccess(data)
325 // // })
326 //
327 // // window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) {
328 // // // layer.open({
329 // // // content: JSON.stringify(res) + 'cb',
330 // // // time: 10
331 // // // });
332 // // // onSuccess({
333 // // // latitude:30.2741500000,
334 // // // longitude:120.1551500000
335 // // // })
336 // //
337 // // }, '')
338 // } else if(isiOS){
339 //
340 // // appClient.appObj.registerHandler('postGPS', function(data, responseCallback) {
341 // // var res = JSON.parse(data)
342 // // layer.open({
343 // // content: data,
344 // // time: 2
345 // // });
346 // // })
347 // appClient.getGPS('getGPS', '', function (res) {
327 // // layer.open({ 348 // // layer.open({
328 // // content: JSON.stringify(res) + 'cb', 349 // // content: JSON.stringify(res) + 'cb',
329 // // time: 10 350 // // time: 10
330 // // }); 351 // // });
331 // // onSuccess({ 352 // onSuccess({
332 // // latitude:30.2741500000, 353 // latitude:30.2741500000,
333 // // longitude:120.1551500000 354 // longitude:120.1551500000
334 // // }) 355 // })
335 // 356 //
336 // }, '') 357 // }, '')
337 } else if(isiOS){ 358 // }
338
339 // appClient.appObj.registerHandler('postGPS', function(data, responseCallback) {
340 // var res = JSON.parse(data)
341 // layer.open({
342 // content: data,
343 // time: 2
344 // });
345 // })
346 appClient.getGPS('getGPS', '', function (res) {
347 // layer.open({
348 // content: JSON.stringify(res) + 'cb',
349 // time: 10
350 // });
351 onSuccess({
352 latitude:30.2741500000,
353 longitude:120.1551500000
354 })
355
356 }, '')
357 }
358 } 359 }
359 } 360 }
360 361
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!