roose há 4 anos atrás
pai
commit
6e6396af86
4 ficheiros alterados com 102 adições e 63 exclusões
  1. 6 3
      pages/finishInfo/finishInfo.js
  2. 70 57
      pages/love/love.js
  3. 26 2
      pages/visitandinfo/visitandinfo.js
  4. 0 1
      utils/photoUrl.wxs

+ 6 - 3
pages/finishInfo/finishInfo.js

@@ -83,6 +83,7 @@ Page({
       },
     ],
   },
+  // 百度身份证OCR接口 首先去后台获得token
   goOcr() {
     wx.request({
       url: app.globalData.publicUrl + '/applet/getToken',
@@ -104,11 +105,10 @@ Page({
               sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
               sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
               success: function (res) {
-                // console.log('拍照获取图片路径',res);
-                // 读取本地文件内容
                 wx.showLoading({
                   title: '加载中',
                 })
+                // 拿文件转换base64
                 wx.getFileSystemManager().readFile({
                   filePath: res.tempFilePaths[0],
                   encoding: 'base64',
@@ -128,6 +128,7 @@ Page({
                       },
                       dataType: 'json',
                       success: (e) => {
+                        // 扫描后赋值 
                         if (e.data.idcard_number_type == 1) {
                           let result = e.data.words_result
                           console.log(result, "00000000");
@@ -181,7 +182,7 @@ Page({
       posttext: '',
     })
   },
-
+  
   incomeListChange: function (e) {
     this.setData({
       incomeindex: e.detail.value,
@@ -270,6 +271,7 @@ Page({
     //验证通过以后->
     this.submitInfo(params);
   },
+  //修改信息接口
   submitInfo(params) {
     wx.request({
       url: app.globalData.publicUrl + '/applet/suppleUserInfo',
@@ -286,6 +288,7 @@ Page({
       }
     })
   },
+  //获得当前登陆人的信息
   userInfo() {
     wx.request({
       url: app.globalData.publicUrl + '/sys/login/session',

+ 70 - 57
pages/love/love.js

@@ -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: [],

+ 26 - 2
pages/visitandinfo/visitandinfo.js

@@ -94,7 +94,7 @@ Page({
   visitJilu(e) {
     console.log(e.currentTarget.dataset.infos, "000");
     let photos = e.currentTarget.dataset.infos.visitPhoto.split(",");
-    console.log(photos,"打印下锕");
+    console.log(photos, "打印下锕");
     
     this.setData({
       show: true,
@@ -110,7 +110,31 @@ Page({
   //删除
   deletes() {
     console.log("ssss");
-
+    wx.showModal({
+      content: '该操作会将所有选中数据删除", "是否删除?',
+      success(res) {
+        if (res.confirm) {
+          //确定绑定的操作
+        } else if (res.cancel) {
+          //取消绑定的操作
+        }
+      }
+    })
+  },
+  deleteById(id) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wxinfo/delete',
+      method: "GET",
+      header: {
+        appletsId: wx.getStorageSync('openId')
+      },
+      data: {
+        id: id
+      },
+      success: (res) => {
+        console.log(res, "000");
+      }
+    })
   },
   //全选与反全选
   selectall: function (e) {

+ 0 - 1
utils/photoUrl.wxs

@@ -1,5 +1,4 @@
 var url = function (val) {
-  console.log( 'http://info.windd.cn:8080/test' + val ,"打印锕少时诵诗书所");
   
   return  'http://info.windd.cn:8080/test' + val
 }