e4cf8852 by unknown

提示运行环境

1 parent 253ed433
......@@ -14,24 +14,25 @@ function isJson(str) {
}
return true;
}
// var str = '{latitude:30.2741500000,longitude:120.1551500000}'
// console.log(toJson(str))
var str = '{latitude:30.2741500000,longitude:120.1551500000}'
var obj = toJson(str)
console.log(obj.latitude)
function toJson(str) {
try {
if(str.length > 2){
var result = /\{([\s\S]*)\}/.exec(str);
}
debugger
var arr = result[1].split(',')
var obj = {}
arr.forEach(function (value) {
var key, val
if(isAndroid){
var key = value.split('=')[0]
var val = value.split('=')[1]
}
if(isiOS) {
var key = value.split(':')[0]
var val = value.split(':')[1]
key = value.split('=')[0]
val = value.split('=')[1]
} else {
key = value.split(':')[0]
val = value.split(':')[1]
}
obj[key] = val
......
......@@ -306,7 +306,7 @@ angular.module('myApp')
var obj = toJson(data)
layer.open({
content: data,
content: JSON.stringify(obj),
time: 5
})
// layer.open({
......@@ -323,8 +323,8 @@ angular.module('myApp')
// })
// onSuccess(obj)
onSuccess({
latitude: obj['latitude'],
longitude: obj['longitude']
latitude: obj.latitude,
longitude: obj.longitude
})
})
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!