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) {
62
63 });
65 } 64 }
66
67
68 // }
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,59 +302,60 @@ angular.module('myApp') ...@@ -302,59 +302,60 @@ angular.module('myApp')
302 $rootScope.isLoadFinish = true 302 $rootScope.isLoadFinish = true
303 },1000) 303 },1000)
304 } else { 304 } else {
305 if(isAndroid){ 305 appClient.getGPS('', function (data, cb) {
306 306 onSuccess({
307 // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) { 307 latitude:30.2741500000,
308 // // var data = JSON.parse(res 308 longitude:120.1551500000
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) {
317 onSuccess({
318 latitude:30.2741500000,
319 longitude:120.1551500000
320 })
321 layer.open({
322 content: data,
323 time: 2
324 })
325 }) 309 })
326 // window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) { 310 layer.open({
327 // // layer.open({ 311 content: data,
328 // // content: JSON.stringify(res) + 'cb', 312 time: 2
329 // // time: 10 313 })
330 // // }); 314 })
331 // // onSuccess({ 315 // if(isAndroid){
332 // // latitude:30.2741500000, 316 //
333 // // longitude:120.1551500000 317 // // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
334 // // }) 318 // // // var data = JSON.parse(res
335 // 319 // // // var data = eval(res)
336 // }, '') 320 // // layer.open({
337 } else if(isiOS){ 321 // // content: res,
338 322 // // time: 2
339 // appClient.appObj.registerHandler('postGPS', function(data, responseCallback) { 323 // // });
340 // var res = JSON.parse(data) 324 // // onSuccess(data)
341 // layer.open({ 325 // // })
342 // content: data, 326 //
343 // time: 2 327 // // window.WebViewJavascriptBridge.callHandler('getGPS','1', function (res) {
344 // }); 328 // // // layer.open({
345 // }) 329 // // // content: JSON.stringify(res) + 'cb',
346 appClient.getGPS('getGPS', '', function (res) { 330 // // // time: 10
347 // layer.open({ 331 // // // });
348 // content: JSON.stringify(res) + 'cb', 332 // // // onSuccess({
349 // time: 10 333 // // // latitude:30.2741500000,
350 // }); 334 // // // longitude:120.1551500000
351 onSuccess({ 335 // // // })
352 latitude:30.2741500000, 336 // //
353 longitude:120.1551500000 337 // // }, '')
354 }) 338 // } else if(isiOS){
355 339 //
356 }, '') 340 // // appClient.appObj.registerHandler('postGPS', function(data, responseCallback) {
357 } 341 // // var res = JSON.parse(data)
342 // // layer.open({
343 // // content: data,
344 // // time: 2
345 // // });
346 // // })
347 // appClient.getGPS('getGPS', '', function (res) {
348 // // layer.open({
349 // // content: JSON.stringify(res) + 'cb',
350 // // time: 10
351 // // });
352 // onSuccess({
353 // latitude:30.2741500000,
354 // longitude:120.1551500000
355 // })
356 //
357 // }, '')
358 // }
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!