jiangping
2024-05-31 6be28040e74e1ff7764478174a9b5d706fe4fc39
h5/pages/changePassword/changePassword.vue
@@ -7,7 +7,7 @@
               <text>*</text>
            </view>
            <view class="list_item_content">
               <input type="number" maxlength="11" placeholder="请输入旧密码" placeholder-style="color: #999999;" />
               <input type="password" v-model="param.oldPwd" :maxlength="32" placeholder="请输入旧密码" placeholder-style="color: #999999;" />
            </view>
         </view>
         <view class="list_item">
@@ -16,7 +16,7 @@
               <text>*</text>
            </view>
            <view class="list_item_content">
               <input type="number" maxlength="11" placeholder="请输入6-18位数字、字母组合" placeholder-style="color: #999999;" />
               <input type="password" v-model="param.newPwd" :maxlength="32" placeholder="请输入6-18位数字、字母组合" placeholder-style="color: #999999;" />
            </view>
         </view>
         <view class="list_item">
@@ -25,7 +25,7 @@
               <text>*</text>
            </view>
            <view class="list_item_content">
               <input type="number" maxlength="11" placeholder="请再输一次新密码" placeholder-style="color: #999999;" />
               <input type="password" v-model="param.newPwdTemp" :maxlength="32" placeholder="请再输一次新密码" placeholder-style="color: #999999;" />
            </view>
         </view>
      </view>
@@ -34,17 +34,55 @@
         <text>如密码遗忘,请联系园区系统管理员重置</text>
      </view>
      <view class="footer-box">
         <view class="submit-button">提交</view>
         <view class="submit-button" @click="onSubmit">提交</view>
      </view>
   </view>
</template>
<script>
import { uploadPassword } from '@/api'
   export default {
      data() {
         return {
            param: {}
         };
      },
      methods: {
         onSubmit() {
      const { param } = this
      if (!param.oldPwd) return uni.showToast({
        title: '旧密码不能为空',
        icon: 'none'
      })
      if (!param.newPwd) return uni.showToast({
        title: '新密码不能为空',
        icon: 'none'
      })
      if (!param.newPwdTemp) return uni.showToast({
        title: '确认密码不能为空',
        icon: 'none'
      })
      if (param.newPwdTemp != param.newPwd) return uni.showToast({
        title: '两次输入密码不一致',
        icon: 'none'
      })
      uploadPassword({
        ...param
      }).then(res => {
        if (res && res.code == 200) {
          setTimeout(() => {
            uni.showToast({
              title: '密码修改成功,请重新登录',
              icon: 'success',
              duration: 2000
            })
          })
          uni.redirectTo({
            url: "/pages/staffLogin/login"
          })
        }
      })
    }
      }
   }
</script>