```html
<template>
  <!-- 页面布局 -->
  <div class="margin-5"></div>
  <div class="main-container wrap main-fullScreen">
    <div class="bgd-while textCenter p-20">
      <div class="font-size-30">更改密码</div>
      <div class="center">
        <!-- 表单 -->
        <el-form ref="ruleFormRef" style="max-width: 800px" :model="ruleForm" status-icon :rules="rules"
          label-width="auto" class="demo-ruleForm">
          <el-form-item label="密码" prop="oldPass">
            <el-input v-model="ruleForm.oldPass" type="password" autocomplete="off" placeholder="请输入旧密码" />
          </el-form-item>

          <el-form-item label="新密码" prop="pass">
            <el-input v-model="ruleForm.pass" type="password" autocomplete="off" placeholder="请输入新密码" />
          </el-form-item>
          <el-form-item label="确认密码" prop="checkPass">
            <el-input v-model="ruleForm.checkPass" type="password" autocomplete="off" placeholder="请再次输入新密码" />
          </el-form-item>
          
          <el-form-item style="text-align: center">
            <el-button type="primary" @click="submitForm(ruleFormRef)">
              提交
            </el-button>
            <el-button @click="resetForm(ruleFormRef)">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
  <div class="margin-5"></div>
</template>
<script lang="ts" setup>
import { ref, getCurrentInstance, ComponentInternalInstance, reactive } from 'vue'
document.title = '河南艺体考生专属VIP|' + import.meta.env.VITE_PROGRAM_TYPE;
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
import { checkPhoneAvailable, getScore } from '@/axios/api';
import { passwordChanger, registerUser } from '@/axios/UserApi';
import { useRouter } from "vue-router";
const ruleFormRef = ref<FormInstance>()
const router = useRouter();


const validateOldPass = (rule: any, value: any, callback: any) => {
  if (value === '') {
    callback(new Error('请输入旧密码'))
  } else {
    callback()
  }
}

const validatePass = (rule: any, value: any, callback: any) => {
  if (value === '') {
    callback(new Error('请输入密码'))
  } else if (value.length < 6 || value.length > 20) {
    callback(new Error('密码必须介于6到20位之间'))
  } else {
    if (ruleForm.checkPass !== '') {
      if (!ruleFormRef.value) return
      ruleFormRef.value.validateField('checkPass')
    }
    callback()
  }
}
const validatePass2 = (rule: any, value: any, callback: any) => {
  if (value === '') {
    callback(new Error('请再次输入密码'))
  } else if (value !== ruleForm.pass) {
    callback(new Error("两次输入不一致"))
  } else {
    callback()
  }
}

const ruleForm = reactive({
  oldPass:'',
  pass: '',
  checkPass: '',
  phone: '',
})

const rules = reactive<FormRules<typeof ruleForm>>({
  oldPass: [{ validator: validateOldPass, trigger: 'blur' }],
  pass: [{ validator: validatePass, trigger: 'blur' }],
  checkPass: [{ validator: validatePass2, trigger: 'blur' }],
  //phone: [{ validator: checkphone, trigger: 'blur' }],
})

const submitForm = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.validate(async (valid) => {
    if (valid) {
      console.log(ruleForm)
      const data =await passwordChanger({oldPassword:ruleForm.oldPass,password:ruleForm.pass})
      console.log(data)
      if(data.success){
        //将 用户数据保存到缓存中
          ElMessage.success('修改成功');
          setTimeout(function () {
            router.push({
              path: "/index"
            });
            // setTimeout(function () {
            //   window.location.reload()
            // }, 500);
          }, 1000);
      }else{
        ElMessage.error(data.message);
      }
    }
  })
}

const resetForm = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
}
</script>
<style scoped lang="scss">
.center {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 20em; /* 可根据需要调整高度 */
}
.wrap {
  width: 1210px
}
</style>
```