liuyg
2022-02-21 e3dcaeb0180a4e37347ac9ceb44c8a59ae7af37f
pages/registerUser/registerUser.vue
@@ -35,21 +35,22 @@
            (功能研发中)
         </u-form-item>
      </u-form>
         <view class="agree">
            注册即代表同意
            <text class="a">《用户协议》</text>
            和
            <text class="a">《隐私政策》</text>
         </view>
      <div v-show="mapShow">
         <div class="login-map-bc" @click="mapShow = false">
      <view class="agree">
         注册即代表同意
         <text class="a">《用户协议》</text>
         和
         <text class="a">《隐私政策》</text>
      </view>
      <div class="login-map-bc" v-if="mapShow">
         <div @click="mapShow = false">
         </div>
         <div class="login-map-content">
            <u-icon class="login-map-close" name="close" @click="mapShow = false"></u-icon>
            <iframe style="width: 100%; height: 100%; position: absolute; " :src="loginMapUrl">
            </iframe>
            <view style="width: 100%; height: 100%; position: absolute; ">
               <web-view :src="loginMapUrl"></web-view>
            </view>
         </div>
      </div>
@@ -63,6 +64,29 @@
<script>
   export default {
      data() {
         var validateUser = (rule, value, callback) => {
            var phone = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
            var identity =
               /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
            if (value.length <= 11) {
               if (phone.test(value)) {
                  return true
               } else {
                  return callback(new Error('手机号格式不正确'));
               }
            }
            if (value.length <= 18) {
               if (identity.test(value)) {
                  return true
               } else {
                  return callback(new Error('身份证号格式不正确'));
               }
            }
         };
         return {
            regionName: '',
            loginMapUrl: "",
@@ -110,7 +134,7 @@
                  img: 'man-add-fill',
                  froms: 'user',
                  requireds: true,
                  placeholder: '请输入身份证号'
                  placeholder: '请输入身份证号或手机号'
               },
               {
                  title: '密码',
@@ -173,16 +197,13 @@
            },
            rules: {
               user: [{
                  required: true,
                  message: '请输入身份证号',
                  // 可以单个或者同时写两个触发验证方式
                  /*
                   u-form提供的可直接调用的js验证,
                   具体有哪些可以观看官方文档,这里就不在赘述了。
                  */
                  validator: validateUser,
                  trigger: ['change', 'blur'],
               }, {
                  pattern: /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
                  message: '证件号码格式有误!',
                  trigger: 'blur'
               }],
               }, ],
               pass: [{
                  required: true,
                  message: '请输入6~16位密码',
@@ -298,7 +319,27 @@
            ]
         };
      },
      onShow() {
         let that = this
         uni.$on('updateDataRegionName', function(data) {
            that.regionName = data
            that.form.xq = that.regionName
         })
      },
      methods: {
         handleMessage(name) {
            console.log(name)
            if (name.indexOf('区') != -1) {
               that.regionName = name.replace('区', '派出所');
            } else if (name.indexOf('县') != -1) {
               that.regionName = name.replace('县', '派出所');
            } else if (name.indexOf('市') != -1) {
               that.regionName = name.replace('市', '市派出所');
            }
         },
         openLoginMap() {
            var that = this
            uni.getLocation({
@@ -329,45 +370,54 @@
                     "jd": res.longitude,
                     "wd": res.latitude
                  }]
                  data = JSON.stringify(data);
                  uni.navigateTo({
                     url: '/pages/currentMap/currentMap?data=' + JSON.stringify(data)
                  })
                  // that.loginMapUrl = 'http://127.0.0.1:5500/leafletMapOur/loginMap/loginMap.html?data=' +
                  //    data
                  // that.loginMapUrl =
                  //    'http://192.168.0.115:5500/leafletMapOur/loginMap/loginMap.html?data=' + data
                  that.loginMapUrl = 'http://223.82.109.183:2082/loginMap/loginMap.html?data=' + data
                  that.mapShow = true
                  // // that.loginMapUrl = 'http://223.82.109.183:2082/loginMap/loginMap.html?data=' + data
                  // that.mapShow = true
               }
            })
         },
         zc() {
            var that = this;
            uni.request({
               url: that.$store.state.piAPI + '/zc/inster',
               method: 'POST',
               url: that.$store.state.piAPI + '/zc/inspect',
               method: 'GET',
               data: {
                  username: this.form.user
               },
               success: (res) => {
                  uni.showToast({
                     title: '注册成功,请等待审核',
                     icon: 'none',
                     duration: 2000
                  if (res.data.code == 400) {
                     uni.showToast({
                        title: res.data.msg,
                        icon: 'none',
                        duration: 2000
                     });
                     return
                  }
                  that.$refs.uForm.validate(valid => {
                     if (valid) {
                        var d = that.form;
                        uni.navigateTo({
                           url: '/pages/registerUser/idphoto?data= ' +
                              encodeURIComponent(JSON.stringify(
                                 d))
                        });
                     }
                  });
               }
            });
            var that = this;
            this.$refs.uForm.validate(valid => {
               if (valid) {
                  var d = this.form;
                  uni.navigateTo({
                     url: '/pages/registerUser/idphoto?data= ' + encodeURIComponent(JSON.stringify(
                        d))
                  });
               }
            });
         },
         depl() {
@@ -508,20 +558,6 @@
      },
      onReady() {
         this.$refs.uForm.setRules(this.rules);
         var that = this
         window.getRegionName = function(name) {
            console.log(name)
            if (name.indexOf('区') != -1) {
               that.regionName = name.replace('区', '派出所');
            } else if (name.indexOf('县') != -1) {
               that.regionName = name.replace('县', '派出所');
            } else if (name.indexOf('市') != -1) {
               that.regionName = name.replace('市', '市派出所');
            }
            that.form.xq = that.regionName
            that.mapShow = false
         }
      },
      watch: {
         faceState() {
@@ -540,6 +576,7 @@
               this.faceMsg = '(服务连接失败!)';
            }
         }
      }
   };
</script>
@@ -561,7 +598,7 @@
      bottom: 0;
      left: 0;
      width: 100%;
      height: 60%;
      height: 100%;
      z-index: 222;
      border-radius: 15px 15px 0 0;
      overflow: hidden;
@@ -624,7 +661,7 @@
   .registerUser {
      padding: 0 1.2rem;
   }
   .agree {
      margin: 27rpx 95rpx 0;
      font-size: 22rpx;
@@ -632,10 +669,9 @@
      font-weight: normal;
      color: #cacaca;
      line-height: 34rpx;
      .a {
         color: #000000;
      }
   }
</style>