|
@@ -229,7 +229,26 @@
|
|
that.latitude = pos.coords.latitude;
|
|
that.latitude = pos.coords.latitude;
|
|
that.longitude = pos.coords.longitude;
|
|
that.longitude = pos.coords.longitude;
|
|
that.getCityNameByLonLat(that.latLongItude)
|
|
that.getCityNameByLonLat(that.latLongItude)
|
|
- })
|
|
|
|
|
|
+ },function(err){
|
|
|
|
+ // 错误处理
|
|
|
|
+ switch(err.code) {
|
|
|
|
+ case 1:
|
|
|
|
+ alert("位置服务被拒绝。");
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 2:
|
|
|
|
+ alert("暂时获取不到位置信息。");
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 3:
|
|
|
|
+ alert("获取信息超时。");
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ alert("未知错误。");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}else{
|
|
}else{
|
|
console.log("当前系统不支持GPS API")
|
|
console.log("当前系统不支持GPS API")
|
|
};
|
|
};
|