zengh
2021-07-07 7001de2b8cd0b94d22815b4df65cbeb47e1ee216
pages/registerUser/registerUser.vue
@@ -3,7 +3,7 @@
      <u-form :model="form" ref="uForm">
         <u-form-item :label="item.title" :prop="item.froms" label-width="200" :left-icon="item.img" :required="true"
            v-for="(item, index) in list" :key="index">
            <u-input v-model="form[item.froms]" />
            <u-input v-model="form[item.froms]"  :placeholder="item.placeholder" />
         </u-form-item>
         <u-form-item style="display: none;" label="选择部门" left-icon="account-fill" label-width="200" :required="true">
            <u-input v-model="form.obj" type="select" :border="true" @click="show = true" />
@@ -17,9 +17,9 @@
            </u-radio-group>
         </u-form-item>
      </u-form>
      <u-button @click="camera" :style="{backgroundColor:facebc,color:faceco,border: `1px solid ${facebc}`}">
         人脸验证{{faceMsg}}</u-button>
      <u-button @click="submit">提交</u-button>
      <u-button class="submit" @click="camera">
         下一步{{faceMsg}}</u-button>
      <!-- <u-button class="submit" @click="submit">提交</u-button> -->
   </view>
</template>
@@ -31,33 +31,38 @@
            list: [{
                  title: '账号',
                  img: 'man-add-fill',
                  froms: 'user'
                  froms: 'user',
                  placeholder: '请输入帐号'
               },
               {
                  title: '密码',
                  img: 'lock-fill',
                  froms: 'pass'
                  froms: 'pass',
                  placeholder: '请输入密码'
               },
               {
                  title: '再输密码',
                  title: '确认密码',
                  img: 'lock-fill',
                  froms: 'passTwo'
                  froms: 'passTwo',
                  placeholder: '请确认密码'
               },
               {
                  title: '姓名',
                  img: 'account',
                  froms: 'name'
                  froms: 'name',
                  placeholder: '请输入姓名'
               },
               {
                  title: '身份证',
                  img: 'fingerprint',
                  froms: 'carId'
                  froms: 'carId',
                  placeholder: '请输入身份证'
               },
               {
                  title: '手机号',
                  img: 'phone-fill',
                  froms: 'phone'
                  froms: 'phone',
                  placeholder: '请输入手机号'
               }
            ],
            sex: [{
@@ -165,79 +170,84 @@
      methods: {
         camera() {
            let that = this;
            uni.showLoading({
               title: '加载中'
            uni.showToast({
               title: '功能研发中',
               icon:'none',
               duration: 2000
            });
            var i = 0;
            var time = setTimeout(() => {
               if (i == 0) {
                  uni.showToast({
                     title: '未进行验证!',
                     icon: "none",
                     duration: 1000
                  });
                  clearTimeout(time);
                  time = null;
               } else {
                  // console.log('进行验证')
               }
            }, 2000)
            uni.chooseImage({
               count: 1, //默认9
               sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
               // sourceType: 'camera', //从相册选择
               sourceType: ['camera', 'album'], //从相册选择
               success: function(res) {
                  i = 1;
                  var img = res.tempFiles;
                  console.log('img', img)
                  // imgToBase64(res)
                  var url = that.$store.state.piAPI + 'blade-user/faceCompare',
                     // var url = 'http://192.168.0.114:82/' + 'blade-user/faceCompare',
                     data = {
                        "name": that.form.name,
                        "idCardNo": that.form.carId
                     };
                  uni.uploadFile({
                     url: url,
                     filePath: img[0].path,
                     name: 'file',
                     formData: data,
                     success: (data) => {
                        if (data.statusCode == 200) {
                           var data = JSON.parse(data.data);
                           if (data.data.result == 0) {
                              that.faceState = 1;
                              uni.showToast({
                                 title: '人脸识别成功!',
                                 icon: "none",
                                 duration: 1000
                              });
                           } else {
                              that.faceState = -1;
                              uni.showToast({
                                 title: data.data.errMsg == "pic not has face" ?
                                    '未检测到人脸' : data.data.errMsg,
                                 icon: "none",
                                 duration: 1000
                              });
                           }
                        } else {
                           that.faceState = 0;
                           uni.showToast({
                              title: '服务器连接失败!',
                              icon: "none",
                              duration: 1000
                           });
                        }
                        console.log(data)
                     }
                  });
               },
               complete: function() {
                  console.log(4534)
               }
            })
            // uni.showLoading({
            //    title: '加载中'
            // });
            // var i = 0;
            // var time = setTimeout(() => {
            //    if (i == 0) {
            //       uni.showToast({
            //          title: '未进行验证!',
            //          icon: "none",
            //          duration: 1000
            //       });
            //       clearTimeout(time);
            //       time = null;
            //    } else {
            //       // console.log('进行验证')
            //    }
            // }, 2000)
            // uni.chooseImage({
            //    count: 1, //默认9
            //    sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
            //    // sourceType: 'camera', //从相册选择
            //    sourceType: ['camera', 'album'], //从相册选择
            //    success: function(res) {
            //       i = 1;
            //       var img = res.tempFiles;
            //       console.log('img', img)
            //       // imgToBase64(res)
            //       var url = that.$store.state.piAPI + 'blade-user/faceCompare',
            //          // var url = 'http://192.168.0.114:82/' + 'blade-user/faceCompare',
            //          data = {
            //             "name": that.form.name,
            //             "idCardNo": that.form.carId
            //          };
            //       uni.uploadFile({
            //          url: url,
            //          filePath: img[0].path,
            //          name: 'file',
            //          formData: data,
            //          success: (data) => {
            //             if (data.statusCode == 200) {
            //                var data = JSON.parse(data.data);
            //                if (data.data.result == 0) {
            //                   that.faceState = 1;
            //                   uni.showToast({
            //                      title: '人脸识别成功!',
            //                      icon: "none",
            //                      duration: 1000
            //                   });
            //                } else {
            //                   that.faceState = -1;
            //                   uni.showToast({
            //                      title: data.data.errMsg == "pic not has face" ?
            //                         '未检测到人脸' : data.data.errMsg,
            //                      icon: "none",
            //                      duration: 1000
            //                   });
            //                }
            //             } else {
            //                that.faceState = 0;
            //                uni.showToast({
            //                   title: '服务器连接失败!',
            //                   icon: "none",
            //                   duration: 1000
            //                });
            //             }
            //             console.log(data)
            //          }
            //       });
            //    },
            //    complete: function() {
            //       console.log(4534)
            //    }
            // })
         },
         startRecord() {
            this.flag = true;
@@ -321,6 +331,33 @@
</script>
<style lang="scss" scoped>
   .submit {
      margin: 30rpx 50rpx 0;
      border: none;
      width: 572rpx;
      height: 86rpx;
      line-height: 86rpx;
      box-sizing: border-box;
      border-radius: 15rpx;
      background-color: #14b9c8;
      color: #ffffff;
      &::after {
         content: none;
      }
      &::before {
         content: none;
      }
      &[disabled='true'] {
         background: #e4e4e4;
         font-size: 36rpx;
         font-family: Source Han Sans CN;
         font-weight: 500;
         color: #ffffff;
      }
   }
   .registerUser {
      padding: 0 1.2rem;
   }