yangan
2024-06-21 07c0f76a80262cf48da3438dffd3ad3c04f9cf44
pages/register/register.vue
@@ -82,7 +82,7 @@
               label="身份证过期时间"
               labelWidth="20%"
               borderBottom>
               <uni-datetime-picker v-model="registerFormModel.expirationTimeIdcard" type="datetime"  />
               <uni-datetime-picker v-model="registerFormModel.expirationTimeIdcard" type="datetime" :start="minDate" />
            </u-form-item>
            <u-form-item prop="phone"
               label="手机号"
@@ -102,6 +102,7 @@
                  placeholder="请输入内容"
                  password
                  clearable></u--input>
               <span> 密码应由8-16位数字、字母、符号组成。请不要使用容易被猜到的密码</span>
            </u-form-item>
            <u-form-item prop="confirmPassword"
               label="确认密码"
@@ -179,7 +180,7 @@
               labelWidth="20%"
               borderBottom
               v-if="radiovalue1 == '司机'">
               <uni-datetime-picker v-model="registerFormModel.expirationTimeDriving" type="datetime"  />
               <uni-datetime-picker v-model="registerFormModel.expirationTimeDriving" type="datetime"  :start="minDate" />
            </u-form-item>
            <u-form-item prop="driverImg"
               label="驾驶证"
@@ -205,14 +206,13 @@
               labelWidth="20%"
               borderBottom
               v-if="radiovalue1 == '司机'">
               <uni-datetime-picker v-model="registerFormModel.expirationTimeDriver" type="datetime"  />
               <uni-datetime-picker v-model="registerFormModel.expirationTimeDriver" type="datetime"  :start="minDate" />
            </u-form-item>
            <u-form-item prop="tradeQualificationImg"
               label="从业资格证"
               labelWidth="24%"
               borderBottom
               v-if="radiovalue1 == '司机'"
               required
               @click="beforeRead">
               <u-upload :fileList="fileList4"
                  deletable
@@ -234,25 +234,11 @@
               labelWidth="20%"
               borderBottom
               v-if="radiovalue1 == '司机'">
               <uni-datetime-picker v-model="registerFormModel.expirationTimeTradequalification" type="datetime"  />
            </u-form-item>
            <u-form-item label="是否非煤车辆"
               v-if="radiovalue1 == '司机'"
               labelWidth="30%"
               borderBottom
               prop="isNonCoal">
               <u-checkbox-group v-model="registerFormModel.isNonCoal"
                  placement="row"
                  size="40"
                  @change="isNonCoalChange">
                  <u-checkbox name="是"
                     label-size="30">
                  </u-checkbox>
               </u-checkbox-group>
               <uni-datetime-picker v-model="registerFormModel.expirationTimeTradequalification" type="datetime"  :start="minDate" />
            </u-form-item>
            <u-form-item labelWidth="20%"
               v-if="radiovalue1 == '司机'"
               label="车辆类型"
               label="环保类型"
               borderBottom
               prop="countryNumberCar">
               <u-radio-group v-model="registerFormModel.countryNumberCar"
@@ -301,7 +287,49 @@
         }
      },
      data() {
         const checkPassword = (rule, value, callback) => {
               let passL = 8;
               if(!value) {   //不必填
                 return callback()
               }
               if(value && value.length < passL) {
                 return callback(`密码不能少于${passL}位`)
               }
               if(value && value.length > 16) {
                 return callback('密码不能大于16位')
               }
               //校验是数字
               const regex1 = /^\d+$/
               // 校验字母
               const regex2 = /^[A-Za-z]+$/
               // 校验符号
               const regex3 =
                 /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]+$/
               if(regex1.test(value)) {
                 return callback('密码强度过低')
               }else if(regex2.test(value)) {
                 return callback('密码强度过低')
               }else if(regex3.test(value)) {
                 return callback('密码强度过低')
               }else if(/^[A-Za-z\d]+$/.test(value)) {
                 return callback('密码强度过低')
               }else if(
                 /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、\d]+$/.test(
                   value
                 )
               ) {
                 return callback('密码强度过低')
               }else if(
                 /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、A-Za-z]+$/.test(
                   value
                 )
               ) {
                 return callback('密码强度过低')
               }
               return callback()
             }
         return {
            minDate: this.getToday(),
            // 车牌号键盘控制
            carNumShow: false,
            keyValue: '',
@@ -320,10 +348,8 @@
               confirmPassword: '',
               tradeQualificationImg: '',
               driverImg: '',
               isNonCoal: [],
               isCoalCar: 1, //是否为煤炭车辆(司机使用字段) 1 是 2 不是
               countryNumberCar: 0, //车辆类型;国五 1,国六 2
               carType:0
               countryNumberCar: 2, //环保类型;国五 1,国六 2
               carType:0,
            },
            fileList1: [],
            fileList2: [],
@@ -390,10 +416,11 @@
                     trigger: ['blur', 'change']
                  },
                  {
                     min: 6,
                     max: 12,
                     message: '长度在6-12个字符之间'
                  }
                     min: 8,
                     max: 16,
                     message: '长度在8-16个字符之间'
                  },
                   {validator: checkPassword, trigger: 'change'}
               ],
               confirmPassword: [{
                     required: true,
@@ -529,6 +556,20 @@
      },
      methods: {
         ...mapMutations(['changeisUploadimg']),
         getToday() {
           let now = new Date();
           let year = now.getFullYear();
           let month = this.padStart(now.getMonth() + 1); // 月份是从0开始的
           let day = this.padStart(now.getDate());
           let hour = this.padStart(now.getHours());
           let minute = this.padStart(now.getMinutes());
           let second = this.padStart(now.getSeconds());
           console.log(`${year}-${month}-${day} ${hour}:${minute}:${second}`)
           return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
         },
         padStart(value) {
           return value.toString().padStart(2, '0');
         },
         productcarTypeChange(e){
            console.log(this.registerFormModel.carType,this.radiolist2.find(v => v.value === e).value)
            this.registerFormModel.carType = this.radiolist2.find(v => v.value === e).value
@@ -573,7 +614,7 @@
                                 uni.redirectTo({ url: '/pages/login/login' });
                              }, 1000);
                           } else {
                              this.$u.toast(res.data.msg ? res.data.msg : '添加失败');
                              this.$u.toast(res.msg ? res.msg : '添加失败');
                           }
                        })
                        .catch(err => {
@@ -697,9 +738,6 @@
            this.$nextTick(() => {
               this.editRoleModelShow = false;
            });
         },
         isNonCoalChange() {
            this.registerFormModel.isCoalCar = this.registerFormModel.isNonCoal.length !== 0 ? 1 : 2
         }
      }
   };