d7627360 by ex

h5

1 parent 4e46c07e
...@@ -14,11 +14,12 @@ function isJson(str) { ...@@ -14,11 +14,12 @@ function isJson(str) {
14 return true; 14 return true;
15 } 15 }
16 function toJson(str) { 16 function toJson(str) {
17 var i = str.index('"{')
17 try { 18 try {
18 var arr = str.split(2,str.length - 4) 19 var arr = str.split(2,str.length - 4)
19 console.log(arr) 20 console.log(arr)
20 } catch (e) { 21 } catch (e) {
21 return '' 22 return {}
22 } 23 }
23 } 24 }
24 // window.invokeJsPassCompanyCodeAndName = function(_params) { 25 // window.invokeJsPassCompanyCodeAndName = function(_params) {
......
...@@ -161,24 +161,23 @@ angular.module('myApp') ...@@ -161,24 +161,23 @@ angular.module('myApp')
161 161
162 162
163 if(isAndroid){ 163 if(isAndroid){
164 // appClient.appObj.registerHandler('postERCode', function(data, responseCallback) { 164 window.WebViewJavascriptBridge.registerHandler('postERCode', function(data, responseCallback) {
165 // layer.open({ 165 // layer.open({
166 // content: JSON.stringify(data), 166 // content: JSON.stringify(data),
167 // time: 10 167 // time: 10
168 // }); 168 // });
169 // // log('ObjC called testJavascriptHandler with', data)
170 // // var responseData = { 'Javascript Says':'Right back atcha!' }
171 // // log('JS responding with', responseData)
172 // // responseCallback(responseData)
173 // })
174 window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
175 // var data = JSON.parse(res
176 layer.open({ 169 layer.open({
177 content: res, 170 content: data,
178 time: 2 171 time: 10
179 }); 172 });
180 // onSuccess(data) 173 // log('ObjC called testJavascriptHandler with', data)
174 // var responseData = { 'Javascript Says':'Right back atcha!' }
175 // log('JS responding with', responseData)
176 // responseCallback(responseData)
177 })
178 window.WebViewJavascriptBridge.callHandler('getERCode', function(data, responseCallback) {
181 }) 179 })
180
182 // window.WebViewJavascriptBridge.callHandler('getGPS', function (res) { 181 // window.WebViewJavascriptBridge.callHandler('getGPS', function (res) {
183 // layer.open({ 182 // layer.open({
184 // content: res, 183 // content: res,
...@@ -197,7 +196,7 @@ angular.module('myApp') ...@@ -197,7 +196,7 @@ angular.module('myApp')
197 // log('JS responding with', responseData) 196 // log('JS responding with', responseData)
198 // responseCallback(responseData) 197 // responseCallback(responseData)
199 }) 198 })
200 appClient.getERCode('postERCode', function (res) { 199 appClient.getERCode('getERCode', function (res) {
201 // layer.open({ 200 // layer.open({
202 // content: JSON.stringify(res) + 'cb', 201 // content: JSON.stringify(res) + 'cb',
203 // time: 10 202 // time: 10
......
...@@ -298,10 +298,19 @@ angular.module('myApp') ...@@ -298,10 +298,19 @@ angular.module('myApp')
298 // } 298 // }
299 // }); 299 // });
300 if(isAndroid){ 300 if(isAndroid){
301 // window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
302 // var res = JSON.parse(data)
303 // layer.open({
304 // content: data,
305 // time: 2
306 // });
307 // onSuccess(data)
308 // })
301 window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) { 309 window.WebViewJavascriptBridge.callHandler('getGPS', '', function(res, responseCallback) {
302 var res = JSON.parse(data) 310 // var data = JSON.parse(res
311 // var data = eval(res)
303 layer.open({ 312 layer.open({
304 content: data, 313 content: res,
305 time: 2 314 time: 2
306 }); 315 });
307 onSuccess(data) 316 onSuccess(data)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!