819527061@qq.com
2024-06-11 7f482f8e9e8b4900a890b571c75a02efc1bd25cc
pages/login/resetPassword/resetPassword.vue
@@ -5,21 +5,24 @@
         :rules="rules"
         ref="uForm"
         label-width="80px">
      <u-form-item prop="originalPassword"
                   label="原密码"
                   required
                   borderBottom>
        <u-input v-if='inputType==="password"'
                 v-model="modelForm.originalPassword"
                 border="surround"
                 placeholder="请输入密码(仅支持数字字母下划线)"
                 :type='inputType' />
        <u-input v-else
                 v-model="modelForm.originalPassword"
                 border="surround"
                 placeholder="请输入密码(仅支持数字字母下划线)"
                 :type='inputType' />
      </u-form-item>
      <template v-if="isShowPassword">
        <u-form-item
            prop="originalPassword"
            label="原密码"
            required
            borderBottom>
          <u-input v-if='inputType==="password"'
                   v-model="modelForm.originalPassword"
                   border="surround"
                   placeholder="密码应由8-16位数字、字母、符号组成。"
                   :type='inputType' />
          <u-input v-else
                   v-model="modelForm.originalPassword"
                   border="surround"
                   placeholder="密码应由8-16位数字、字母、符号组成。"
                   :type='inputType' />
        </u-form-item>
      </template>
         <u-form-item prop="password"
            label="新密码"
            required
@@ -27,12 +30,12 @@
            <u-input v-if='inputType==="password"'
               v-model="modelForm.password"
               border="surround"
               placeholder="请输入密码(仅支持数字字母下划线)"
               placeholder="密码应由8-16位数字、字母、符号组成。"
               :type='inputType' />
            <u-input v-else
               v-model="modelForm.password"
               border="surround"
               placeholder="请输入密码(仅支持数字字母下划线)"
               placeholder="密码应由8-16位数字、字母、符号组成。"
               :type='inputType' />
         </u-form-item>
      <view class="intensity">
@@ -57,12 +60,12 @@
            <u-input v-if='inputType==="password"'
               v-model="modelForm.secondPassword"
               border="surround"
               placeholder="请再次输入密码(仅支持数字字母下划线)"
               placeholder="请再次输入密码"
               type='password' />
            <u-input v-else
               v-model="modelForm.secondPassword"
               border="surround"
               placeholder="请再次输入密码(仅支持数字字母下划线)"
               placeholder="请再次输入密码"
               type='text' />
         </u-form-item>
         <u-form-item>
@@ -139,7 +142,7 @@
        }else if(/^[A-Za-z\d]+$/.test(value)) {
          this.level.push('low')
          this.level.push('middle')
          return callback()
          return callback('密码强度过低')
        }else if(
            /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、\d]+$/.test(
                value
@@ -147,7 +150,7 @@
        ) {
          this.level.push('low')
          this.level.push('middle')
          return callback()
          return callback('密码强度过低')
        }else if(
            /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、A-Za-z]+$/.test(
                value
@@ -155,7 +158,7 @@
        ) {
          this.level.push('low')
          this.level.push('middle')
          return callback()
          return callback('密码强度过低')
        } else if (
            /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、A-Za-z\d]+$/.test(
                value
@@ -168,6 +171,7 @@
        return callback()
      };
         return {
        isShowPassword: true,
        level:[], //密码强度数组
            userInfo: {},
            checkboxValue: [],
@@ -176,13 +180,15 @@
            modelForm: {
          originalPassword:'',  //原始密码
               password: '',  //新密码
               secondPassword: ''  //二次确认密码
               secondPassword: '',  //二次确认密码
          username:'',
          userId:''
            },
            processLoading: false,
            rules: {
          originalPassword: [{
                     type: 'string',
                     required: true,
                     required: this.isShowPassword,
                     message: '请填写密码',
                     trigger: ['blur', 'change']
                  }
@@ -205,7 +211,9 @@
            return uni.getStorageSync('roleType')
         },
      userId() {
        console.log(uni.getStorageSync('userId'),'userId=========')
        if(uni.getStorageSync('userId')) {
          this.modelForm.userId = uni.getStorageSync('userId')
        }
        return uni.getStorageSync('userId')
      }
      },
@@ -215,7 +223,18 @@
         } else {
            this.getUserInfo(params.phone, params.idCard)
         }
      if(params.userInfo) {
        console.log(JSON.parse(params.userInfo),'userInfo====')
        this.modelForm.username = JSON.parse(params.userInfo).username
        this.modelForm.userId = JSON.parse(params.userInfo).userId.toString()   //userId
        if(JSON.parse(params.userInfo).isShowPassword) {
          this.isShowPassword = false
        }else {
          this.isShowPassword = true
        }
      }else {
        this.isShowPassword = true
      }
      },
      onReady() {
         this.$refs.uForm.setRules(this.rules)
@@ -250,9 +269,7 @@
        }
            this.$refs.uForm.validate().then(res => {
          this.processLoading = true;
          let params = Object.assign({},this.modelForm, {userId:this.userId.toString()})
          console.log(params,'params=====')
          this.$reqAllJson('appUpdateById', params, { method: 'PUT', 'Content-type': 'application/json' }).then(res => {
          this.$reqAllJson('appUpdateById', this.modelForm, { method: 'PUT', 'Content-type': 'application/json' }).then(res => {
            this.processLoading = false;
            if (res.code === 0) {
              this.$u.toast('修改成功,即将回到首页')
@@ -269,10 +286,7 @@
          }).finally(() => {
            this.processLoading = false;
          })
        }).catch(errors => {
          uni.$u.toast('请填写完整信息')
        })
            // }).catch(errors => {
            //    uni.$u.toast('校验失败')
            // })