#
luxiaotao1123
2024-02-28 d5c82c6aaff716a2ff3a4e0134a77d62a7be63c4
zy-asrs-flow/src/pages/account/setting/components/security.jsx
@@ -7,19 +7,20 @@
import { useModel } from '@umijs/max';
import Http from '@/utils/http';
const resetPwd = async (val) => {
  const hide = message.loading('正在更新');
const resetPwd = async (val, form) => {
  const hide = message.loading('正在修改');
  try {
    const resp = await Http.doPost('api/user/update', val);
    const resp = await Http.doPost('api/user/reset/pwd', val);
    if (resp.code === 200) {
      message.success('更新成功');
      message.success('修改成功');
      form.resetFields();
      return true;
    } else {
      message.error(resp.msg);
      return false;
    }
  } catch (error) {
    message.error('配置失败请重试!');
    message.error('修改失败请重试!');
    return false;
  } finally {
    hide();
@@ -32,7 +33,7 @@
  const { currentUser } = initialState || {};
  const handleFinish = (values) => {
    resetPwd({...values, userId: currentUser.id});
    resetPwd({...values, id: currentUser.id}, form);
  }
  return (
@@ -51,7 +52,7 @@
        >
          <ProFormText.Password
            width="md"
            name="currentPwd"
            name="oldPwd"
            label="当前密码"
            rules={[
              {
@@ -62,7 +63,7 @@
          />
          <ProFormText.Password
            width="md"
            name="newPwd"
            name="password"
            label="新密码"
            rules={[
              {
@@ -81,7 +82,7 @@
          />
          <ProFormText.Password
            width="md"
            name="newPwdRepeat"
            name="passwordRepeat"
            label="确认密码"
            rules={[
              {
@@ -90,7 +91,7 @@
              },
              {
                validator(_, value) {
                  if (form.getFieldValue('newPwd') === value) return Promise.resolve();
                  if (form.getFieldValue('password') === value) return Promise.resolve();
                  return Promise.reject(new Error('两次输入的密码不相符!'));
                }
              }