1cffe74c by ex

无法获取定位提示

1 parent 5cf7468e
...@@ -53,30 +53,34 @@ AppClient.prototype.getERCode = function (jsonStr, callback) { ...@@ -53,30 +53,34 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
53 from: 'H5', 53 from: 'H5',
54 params: dataParams 54 params: dataParams
55 }; 55 };
56 var isRes = false
56 if(this.isAndroid) { 57 if(this.isAndroid) {
57 window.WebViewJavascriptBridge.callHandler('getERCode', jsonStr); 58 window.WebViewJavascriptBridge.callHandler('getERCode', jsonStr);
58 window.WebViewJavascriptBridge.registerHandler('postERCode', callback); 59 window.WebViewJavascriptBridge.registerHandler('postERCode', function (data, responseCallback) {
59 } else {
60 var isRes = false
61 this.appObj.registerHandler("postERCOde", function (data, responseCallback) {
62 isRes = true 60 isRes = true
63 var latitude = '' 61 var latitude = ''
64 var longitude = '' 62 var longitude = ''
65 var result = /\{([\s\S]*)\}/.exec(data); 63 var result = /\{([\s\S]*)\}/.exec(data);
66 var arr = result[1].split(',') 64 var arr = result[1].split(',')
67 if(isAndroid){
68 latitude = arr[0].split('=')[1] 65 latitude = arr[0].split('=')[1]
69 longitude = arr[1].split('=')[1] 66 longitude = arr[1].split('=')[1]
67 callback(latitude, longitude, responseCallback)
68 })
70 } else { 69 } else {
70 this.appObj.registerHandler("postERCOde", function (data, responseCallback) {
71 isRes = true
72 var latitude = ''
73 var longitude = ''
74 var result = /\{([\s\S]*)\}/.exec(data);
75 var arr = result[1].split(',')
71 latitude = arr[0].split(':')[1] 76 latitude = arr[0].split(':')[1]
72 longitude = arr[1].split(':')[1] 77 longitude = arr[1].split(':')[1]
73 }
74
75 callback(latitude, longitude, responseCallback) 78 callback(latitude, longitude, responseCallback)
76 }) 79 })
77 this.appObj.callHandler("getERCode", param, function (data, responseCallback) { 80 this.appObj.callHandler("getERCode", param, function (data, responseCallback) {
78 81
79 }); 82 });
83 }
80 setTimeout(function () { 84 setTimeout(function () {
81 if(!isRes){ 85 if(!isRes){
82 layer.open({ 86 layer.open({
...@@ -85,9 +89,6 @@ AppClient.prototype.getERCode = function (jsonStr, callback) { ...@@ -85,9 +89,6 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
85 callback(30.2741500000, 120.1551500000, function(){}) 89 callback(30.2741500000, 120.1551500000, function(){})
86 } 90 }
87 }, 3000) 91 }, 3000)
88
89
90 }
91 }; 92 };
92 AppClient.prototype.getGPS = function (jsonStr, callback) { 93 AppClient.prototype.getGPS = function (jsonStr, callback) {
93 var dataParams = ""; 94 var dataParams = "";
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!