1cffe74c by ex

无法获取定位提示

1 parent 5cf7468e
...@@ -53,41 +53,42 @@ AppClient.prototype.getERCode = function (jsonStr, callback) { ...@@ -53,41 +53,42 @@ 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) {
60 isRes = true
61 var latitude = ''
62 var longitude = ''
63 var result = /\{([\s\S]*)\}/.exec(data);
64 var arr = result[1].split(',')
65 latitude = arr[0].split('=')[1]
66 longitude = arr[1].split('=')[1]
67 callback(latitude, longitude, responseCallback)
68 })
59 } else { 69 } else {
60 var isRes = false
61 this.appObj.registerHandler("postERCOde", function (data, responseCallback) { 70 this.appObj.registerHandler("postERCOde", function (data, responseCallback) {
62 isRes = true 71 isRes = true
63 var latitude = '' 72 var latitude = ''
64 var longitude = '' 73 var longitude = ''
65 var result = /\{([\s\S]*)\}/.exec(data); 74 var result = /\{([\s\S]*)\}/.exec(data);
66 var arr = result[1].split(',') 75 var arr = result[1].split(',')
67 if(isAndroid){ 76 latitude = arr[0].split(':')[1]
68 latitude = arr[0].split('=')[1] 77 longitude = arr[1].split(':')[1]
69 longitude = arr[1].split('=')[1]
70 } else {
71 latitude = arr[0].split(':')[1]
72 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 });
80 setTimeout(function () {
81 if(!isRes){
82 layer.open({
83 content: '无法获取定位信息,检查定位设置,或重新开发'
84 })
85 callback(30.2741500000, 120.1551500000, function(){})
86 }
87 }, 3000)
88
89
90 } 83 }
84 setTimeout(function () {
85 if(!isRes){
86 layer.open({
87 content: '无法获取定位信息,检查定位设置,或重新开发'
88 })
89 callback(30.2741500000, 120.1551500000, function(){})
90 }
91 }, 3000)
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!