|
@@ -144,7 +144,7 @@ Page({
|
|
|
visitPhoto: this.data.visitPhoto,
|
|
|
lat: this.data.lat,
|
|
|
lng: this.data.lng,
|
|
|
- visitLocation:this.data.visitLocation
|
|
|
+ visitLocation: this.data.visitLocation
|
|
|
}
|
|
|
wx.request({
|
|
|
url: app.globalData.publicUrl + '/visit/add',
|
|
@@ -168,7 +168,7 @@ Page({
|
|
|
})
|
|
|
} else if (res.data.code == 1) {
|
|
|
console.log("进来了啊");
|
|
|
-
|
|
|
+
|
|
|
wx.showModal({
|
|
|
showCancel: false,
|
|
|
content: res.data.message,
|
|
@@ -199,6 +199,10 @@ Page({
|
|
|
|
|
|
//获取位置
|
|
|
getSelfLocation: function (varSendOrgId) {
|
|
|
+ console.log(this.data.info, "老人的信心呢锕");
|
|
|
+ let split = this.data.info.photoAndLocation.split("/");
|
|
|
+ let lon = parseFloat(split[0])
|
|
|
+ let lat = parseFloat(split[1])
|
|
|
|
|
|
// 实例化API核心类
|
|
|
var qqmapsdk = new QQMapWX({
|
|
@@ -210,13 +214,48 @@ Page({
|
|
|
type: 'gcj02',
|
|
|
success: function (res) {
|
|
|
console.log(res, "0000000");
|
|
|
- var latitude = res.latitude;
|
|
|
- var longitude = res.longitude;
|
|
|
+ var latitude = parseFloat(res.latitude);
|
|
|
+ var longitude = parseFloat(res.longitude);
|
|
|
+ console.log(lat);
|
|
|
+ console.log(lon);
|
|
|
+ console.log(latitude);
|
|
|
+ console.log(longitude);
|
|
|
that.setData({
|
|
|
lng: longitude, //经度
|
|
|
lat: latitude, //纬度
|
|
|
});
|
|
|
// 调用sdk接口
|
|
|
+ qqmapsdk.calculateDistance({
|
|
|
+ mode: 'walking', //步行,驾车为'driving'
|
|
|
+ to: [{
|
|
|
+ latitude: lat,
|
|
|
+ longitude: lon
|
|
|
+ }, {
|
|
|
+ latitude: latitude,
|
|
|
+ longitude: longitude
|
|
|
+ }],
|
|
|
+ // to: [{
|
|
|
+ // latitude: lat,
|
|
|
+ // longitude: lon,
|
|
|
+ // }, {
|
|
|
+ // latitude: longitude,
|
|
|
+ // longitude: longitude,
|
|
|
+ // }],
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res.result.elements[0].distance, "距离的");
|
|
|
+ if (res.result.elements[0].distance > 1000) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '当前位置超出老人家范围,请重新扫码定位',
|
|
|
+ success() {
|
|
|
+ wx.switchTab({
|
|
|
+ url: '/pages/index/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
qqmapsdk.reverseGeocoder({
|
|
|
location: {
|
|
|
latitude: res.latitude,
|
|
@@ -257,6 +296,7 @@ Page({
|
|
|
this.setData({
|
|
|
info: res.data.data
|
|
|
})
|
|
|
+ this.getSelfLocation();
|
|
|
} else {
|
|
|
wx.showModal({
|
|
|
showCancel: false,
|
|
@@ -324,10 +364,8 @@ Page({
|
|
|
},
|
|
|
|
|
|
onLoad: function (opotions) {
|
|
|
- console.log(opotions,"dayin");
|
|
|
-
|
|
|
+ console.log(opotions, "dayin");
|
|
|
this.time();
|
|
|
- this.getSelfLocation();
|
|
|
this.oldsInfo(opotions.id);
|
|
|
this.setData({
|
|
|
imgPath: [],
|