优化修改密码

This commit is contained in:
zjl 2024-12-17 15:03:34 +08:00
parent b60ff97f57
commit 05addc0b37

View File

@ -21,6 +21,9 @@
import { BasicForm, FormSchema, useForm } from '@/components/Form/index';
import { changePassword } from '@/api/system/user';
/**
* 定义表单
*/
const schemas: FormSchema[] = [
{
name: 'password',
@ -53,6 +56,9 @@
const modalRef: any = ref(null);
/**
* 定义页面
*/
const [register, { submit, resetFields, getFieldsValue }] = useForm({
colProps: { span: 24 },
labelCol: { span: 5 },
@ -61,16 +67,22 @@
schemas,
});
/**
* 定义模态
*/
const [modalRegister, { openModal, closeModal, setSubLoading }] = useModal({
title: '修改密码',
subBtuText: '提交修改',
});
/**
* 执行提交表单
*/
async function formSubmit() {
const formRes = await submit();
if (formRes) {
try {
await changePassword(getFieldsValue())
await changePassword(getFieldsValue());
closeModal();
message.success('修改成功');
} catch (e) {
@ -82,16 +94,26 @@
}
}
/**
* 显示弹窗
*/
async function showModal() {
openModal();
await nextTick()
resetFields()
await nextTick();
resetFields();
}
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) {
console.log(values);
}
/**
* 定义函数
*/
defineExpose({
showModal,
});