2615f045 by unknown

提示运行环境

1 parent e8101757
......@@ -14,11 +14,22 @@ function isJson(str) {
}
return true;
}
// var str = '{latitude:30.2741500000,longitude:120.1551500000}'
console.log(toJson(str))
function toJson(str) {
var i = str.index('{')
try {
var arr = str.split(2,str.length - 4)
console.log(arr)
if(str.length > 2){
var result = /\{([\s\S]*)\}/.exec(str);
}
var arr = result[1].split(',')
var obj = {}
arr.forEach(function (value) {
var key = value.split(':')[0]
var val = value.split(':')[1]
obj[key] = val
})
return obj
} catch (e) {
return {}
}
......@@ -41,7 +52,7 @@ AppClient.prototype.getERCode = function (jsonStr, callback) {
window.WebViewJavascriptBridge.registerHandler('postERCode', callback);
} else {
this.appObj.registerHandler("postERCOde", callback)
this.appObj.callHandler("getERCode", param, function (data, resCallback) {
this.appObj.callHandler("getERCode", param, function (data, responseCallback) {
});
}
......@@ -59,7 +70,7 @@ AppClient.prototype.getGPS = function (jsonStr, callback) {
window.WebViewJavascriptBridge.callHandler('getGPS', jsonStr, callback);
} else {
this.appObj.registerHandler("postGPS", callback)
this.appObj.callHandler("getGPS", param, function (data, resCallback) {
this.appObj.callHandler("getGPS", param, function (data, responseCallback) {
});
}
......
......@@ -160,7 +160,13 @@ angular.module('myApp')
$rootScope.openScan = false;
if(isAndroid){
if(!appClient){
layer.open({
content: '调起摄像头失败',
time:2
});
} else {
appClient.getERCode('', function (data, cb) {
layer.open({
content: data,
......@@ -188,11 +194,6 @@ angular.module('myApp')
// // time: 10
// // });
// }, '')
} else {
layer.open({
content: '调起摄像头失败',
time:2
});
}
// wx.scanQRCode({
......
......@@ -303,10 +303,12 @@ angular.module('myApp')
},1000)
} else {
appClient.getGPS('', function (data, cb) {
onSuccess({
latitude:30.2741500000,
longitude:120.1551500000
})
var obj = toJson(data)
onSuccess(obj)
// onSuccess({
// latitude:30.2741500000,
// longitude:120.1551500000
// })
layer.open({
content: data,
time: 2
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!