|
@@ -10,15 +10,14 @@ Page({
|
|
|
visitLocation: '',
|
|
|
info: '', //老人锕
|
|
|
imgPath: [{
|
|
|
-
|
|
|
}, {
|
|
|
-
|
|
|
}],
|
|
|
isTrue: true,
|
|
|
index: 0,
|
|
|
visitPhoto: '',
|
|
|
infoId: '',
|
|
|
},
|
|
|
+ // 老人点击后去跳转采集页面
|
|
|
oldClick(e) {
|
|
|
let fid = e.currentTarget.dataset.infos.fid;
|
|
|
let name = e.currentTarget.dataset.infos.name;
|
|
@@ -34,6 +33,7 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 获得当前时间
|
|
|
time() {
|
|
|
var timestamp = Date.parse(new Date());
|
|
|
var date = new Date(timestamp);
|
|
@@ -47,6 +47,7 @@ Page({
|
|
|
time: Y + '-' + M + '-' + D
|
|
|
})
|
|
|
},
|
|
|
+ // 选择照片上传并后台接口
|
|
|
zhaopian() {
|
|
|
var that = this;
|
|
|
wx.chooseImage({
|
|
@@ -90,6 +91,7 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 删除照片
|
|
|
closeImage(e) {
|
|
|
console.log(e.currentTarget.dataset.index, "00");
|
|
|
this.data.imgPath.splice(e.currentTarget.dataset.index, 1);
|
|
@@ -107,7 +109,7 @@ Page({
|
|
|
}
|
|
|
console.log(this.data.imgPath, "00000000000");
|
|
|
},
|
|
|
-
|
|
|
+ //提交(表单验证)
|
|
|
formSubmit(e) {
|
|
|
console.log(e.detail, "daying");
|
|
|
/***4-3(表单提交校验)*/
|
|
@@ -121,6 +123,7 @@ Page({
|
|
|
//验证通过以后->
|
|
|
this.submitInfo(params);
|
|
|
},
|
|
|
+ // 真正提交 人脸比对
|
|
|
submitInfo(params) {
|
|
|
console.log(params);
|
|
|
console.log(this.data.visitPhoto, "照片");
|
|
@@ -135,53 +138,68 @@ Page({
|
|
|
lng: this.data.lng,
|
|
|
visitLocation: this.data.visitLocation
|
|
|
}
|
|
|
- console.log(obj,"78787878");
|
|
|
-
|
|
|
-
|
|
|
- // wx.request({
|
|
|
- // url: app.globalData.publicUrl + '/visit/doFace3',
|
|
|
- // method: "POST",
|
|
|
- // header: {
|
|
|
- // appletsId: wx.getStorageSync('openId')
|
|
|
- // },
|
|
|
- // data: {
|
|
|
- // infoId: this.data.infoId,
|
|
|
- // visitPhoto: this.data.visitPhoto,
|
|
|
- // },
|
|
|
- // success: (res) => {
|
|
|
- // console.log(res);
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
- //提交的接口
|
|
|
-
|
|
|
+ // 比对接口
|
|
|
wx.request({
|
|
|
- url: app.globalData.publicUrl + '/visit/add',
|
|
|
+ url: app.globalData.publicUrl + '/visit/doFace3',
|
|
|
method: "POST",
|
|
|
header: {
|
|
|
appletsId: wx.getStorageSync('openId')
|
|
|
},
|
|
|
- data: obj,
|
|
|
+ data: {
|
|
|
+ infoId: this.data.infoId,
|
|
|
+ visitPhoto: this.data.visitPhoto,
|
|
|
+ },
|
|
|
success: (res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: '提交成功',
|
|
|
- success() {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/index/index',
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (res.data.code == 1) {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: res.data.message,
|
|
|
- success() {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/index/index',
|
|
|
- })
|
|
|
- }
|
|
|
+ console.log(res.data.data, "分数是");
|
|
|
+ // 如果上传不是人脸图片 则没有score
|
|
|
+ if (res.data.data.score) {
|
|
|
+ console.log(res.data.data.score, "分数是");
|
|
|
+ if (res.data.data.score > 60) {
|
|
|
+ console.log("比对成功了");
|
|
|
+ //提交的接口
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/visit/add',
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ appletsId: wx.getStorageSync('openId')
|
|
|
+ },
|
|
|
+ data: obj,
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '提交成功',
|
|
|
+ success() {
|
|
|
+ wx.switchTab({
|
|
|
+ url: '/pages/index/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (res.data.code == 1) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: res.data.message,
|
|
|
+ success() {
|
|
|
+ wx.switchTab({
|
|
|
+ url: '/pages/index/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '人脸比对相似度过低,请重新拍照!',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '人脸比对失败,请传老人现场照片',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -205,6 +223,7 @@ 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])
|
|
@@ -219,17 +238,14 @@ Page({
|
|
|
type: 'gcj02',
|
|
|
success: function (res) {
|
|
|
console.log(res, "0000000");
|
|
|
+ // 返回当前定位的经纬度
|
|
|
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: [{
|
|
@@ -239,13 +255,6 @@ Page({
|
|
|
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) {
|
|
@@ -284,7 +293,7 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 获取老人详情
|
|
|
+ // 获取当前扫码老人的id
|
|
|
oldsInfo(id) {
|
|
|
wx.request({
|
|
|
url: app.globalData.publicUrl + '/info/one',
|
|
@@ -301,6 +310,7 @@ Page({
|
|
|
this.setData({
|
|
|
info: res.data.data
|
|
|
})
|
|
|
+ // 去定位
|
|
|
this.getSelfLocation();
|
|
|
} else {
|
|
|
wx.showModal({
|
|
@@ -317,6 +327,7 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 表单验证规则
|
|
|
initValidate() {
|
|
|
const rules = {
|
|
|
health: {
|
|
@@ -370,7 +381,9 @@ Page({
|
|
|
|
|
|
onLoad: function (opotions) {
|
|
|
console.log(opotions, "dayin");
|
|
|
+ // 获得当前时间
|
|
|
this.time();
|
|
|
+ // 扫码传参 获得老人的id
|
|
|
this.oldsInfo(opotions.id);
|
|
|
this.setData({
|
|
|
imgPath: [],
|