登录修改密码
This commit is contained in:
@ -54,7 +54,7 @@ const QualificationFormModal: React.FC<QualificationFormModalProps> = ({
|
|||||||
termOfValidity: data.termOfValidity ? moment(data.termOfValidity) : undefined,
|
termOfValidity: data.termOfValidity ? moment(data.termOfValidity) : undefined,
|
||||||
|
|
||||||
attachment: data.accessory
|
attachment: data.accessory
|
||||||
? [{ uid: '-1', name: data.accessory, url: data.accessory, status: 'done', response: { url: data.accessory } }]
|
? [{ uid: '-1', name: '附件', url: data.accessory, status: 'done', response: { url: data.accessory } }]
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
console.log(fields, 'fields');
|
console.log(fields, 'fields');
|
||||||
@ -166,7 +166,7 @@ const QualificationFormModal: React.FC<QualificationFormModalProps> = ({
|
|||||||
<Descriptions.Item label="附件">
|
<Descriptions.Item label="附件">
|
||||||
{viewData.attachment?.[0]?.url ? (
|
{viewData.attachment?.[0]?.url ? (
|
||||||
<a href={viewData.attachment[0].url} target="_blank" rel="noopener noreferrer">
|
<a href={viewData.attachment[0].url} target="_blank" rel="noopener noreferrer">
|
||||||
{viewData.attachment[0].name || '查看附件'}
|
查看附件
|
||||||
</a>
|
</a>
|
||||||
) : '无'}
|
) : '无'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
@ -39,7 +39,7 @@ const LoginPage: React.FC = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
form.setFieldsValue( { password: 'cosco2025', identifying: '1' } )
|
form.setFieldsValue({ password: 'cosco2025', identifying: '1' })
|
||||||
|
|
||||||
|
|
||||||
}, [activeKey]);
|
}, [activeKey]);
|
||||||
@ -56,26 +56,26 @@ const LoginPage: React.FC = () => {
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
}, [form]);
|
}, [form]);
|
||||||
|
|
||||||
// 修改密码确认回调
|
// 修改密码确认回调
|
||||||
const handleChangePwd = async (values: { userId: string; newPassword: string; confirmPassword: string; }) => {
|
const handleChangePwd = async (values: { userId: string; newPassword: string; confirmPassword: string; }) => {
|
||||||
try {
|
try {
|
||||||
await changePasswordOnFirstLogin({
|
await changePasswordOnFirstLogin({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
newPassword: encryptWithRsa(values.newPassword, false),
|
newPassword: encryptWithRsa(values.newPassword, false),
|
||||||
confirmPassword: encryptWithRsa(values.confirmPassword, false)
|
confirmPassword: encryptWithRsa(values.confirmPassword, false)
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if(res.data) {
|
if (res.data) {
|
||||||
setShowChangePwd(false);
|
setShowChangePwd(false);
|
||||||
message.success('修改成功,请重新登录');
|
message.success('修改成功,请重新登录');
|
||||||
} else {
|
} else {
|
||||||
message.success('修改密码失败');
|
message.success('修改密码失败');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
message.error(e?.message || '修改密码失败');
|
message.error(e?.message || '修改密码失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onFinish = async (values: any) => {
|
const onFinish = async (values: any) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@ -100,34 +100,29 @@ const LoginPage: React.FC = () => {
|
|||||||
//存入供应商用户id
|
//存入供应商用户id
|
||||||
if (activeKey === 'supplierLogin') {
|
if (activeKey === 'supplierLogin') {
|
||||||
sessionStorage.setItem('userId', loginRes.data.supplierUser.userId);
|
sessionStorage.setItem('userId', loginRes.data.supplierUser.userId);
|
||||||
|
if (loginRes.data?.supplierUser?.firstLogin === 1) {
|
||||||
|
setUserId(loginRes.data.supplierUser.userId)
|
||||||
|
setShowChangePwd(true);
|
||||||
|
return
|
||||||
|
}
|
||||||
} else if (activeKey === 'expertLogin') {
|
} else if (activeKey === 'expertLogin') {
|
||||||
//存入专家用户id
|
//存入专家用户id
|
||||||
// sessionStorage.setItem('userId', loginRes.data.expertUser.userId);
|
// sessionStorage.setItem('userId', loginRes.data.expertUser.userId);
|
||||||
} else if (activeKey === 'accountLogin') {
|
} else if (activeKey === 'accountLogin') {
|
||||||
//存入招标代理用户id
|
//存入招标代理用户id
|
||||||
sessionStorage.setItem('userId', loginRes.data.user.userId);
|
sessionStorage.setItem('userId', loginRes.data.user.userId);
|
||||||
//部门
|
|
||||||
// queryUserOrgAll().then((res) => {
|
|
||||||
// const { code, data } = res;
|
|
||||||
// if (code == 200) {
|
|
||||||
// sessionStorage.setItem('userOrgAll', JSON.stringify(data) );
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
sessionStorage.setItem('currentUser', JSON.stringify(loginRes.data));
|
sessionStorage.setItem('currentUser', JSON.stringify(loginRes.data));
|
||||||
|
|
||||||
await getUserinfo().then(async (res) => {
|
await getUserinfo().then(async (res) => {
|
||||||
const roleIdList = res.authorityList.map((item: any) => item.roleId);
|
const roleIdList = res.authorityList.map((item: any) => item.roleId);
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
setUserId(res.userId)
|
|
||||||
sessionStorage.setItem('Userinfo', JSON.stringify(res));
|
sessionStorage.setItem('Userinfo', JSON.stringify(res));
|
||||||
const menuList: any = await findMenuList({ roleIdList });
|
const menuList: any = await findMenuList({ roleIdList });
|
||||||
sessionStorage.setItem('menuList', JSON.stringify(menuList.data));
|
sessionStorage.setItem('menuList', JSON.stringify(menuList.data));
|
||||||
//新用户需要修改一次密码
|
message.success('登录成功');
|
||||||
if (loginRes.data?.supplierUser?.firstLogin === 1) {
|
if (activeKey === 'supplierLogin') {
|
||||||
setShowChangePwd(true);
|
history.push('/backend/workbenches');
|
||||||
} else {
|
} else {
|
||||||
message.success('登录成功');
|
|
||||||
history.push('/index');
|
history.push('/index');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -191,99 +186,99 @@ const LoginPage: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ChangePasswordModal
|
<ChangePasswordModal
|
||||||
visible={showChangePwd}
|
visible={showChangePwd}
|
||||||
onOk={handleChangePwd}
|
onOk={handleChangePwd}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className='login-page'>
|
<div className='login-page'>
|
||||||
<div className='login-container'>
|
<div className='login-container'>
|
||||||
{/* <div className='back-home'>
|
{/* <div className='back-home'>
|
||||||
<a onClick={() => history.push('/index')}>
|
<a onClick={() => history.push('/index')}>
|
||||||
<HomeOutlined /> {intl.formatMessage({ id: 'login.back.home' })}
|
<HomeOutlined /> {intl.formatMessage({ id: 'login.back.home' })}
|
||||||
</a>
|
</a>
|
||||||
</div> */}
|
</div> */}
|
||||||
|
|
||||||
<div className='login-title'>{intl.formatMessage({ id: 'login.title' })}</div>
|
<div className='login-title'>{intl.formatMessage({ id: 'login.title' })}</div>
|
||||||
|
|
||||||
<div className="login-tab-container">
|
<div className="login-tab-container">
|
||||||
<Tabs activeKey={activeKey} onChange={handleTabChange} className='login-tabs'>
|
<Tabs activeKey={activeKey} onChange={handleTabChange} className='login-tabs'>
|
||||||
<TabPane tab={intl.formatMessage({ id: 'login.tab.supplier' })} key="supplierLogin" />
|
<TabPane tab={intl.formatMessage({ id: 'login.tab.supplier' })} key="supplierLogin" />
|
||||||
{/* <TabPane tab={intl.formatMessage({ id: 'login.tab.expert' })} key="expertLogin" /> */}
|
{/* <TabPane tab={intl.formatMessage({ id: 'login.tab.expert' })} key="expertLogin" /> */}
|
||||||
<TabPane tab={intl.formatMessage({ id: 'login.tab.agent' })} key="accountLogin" />
|
<TabPane tab={intl.formatMessage({ id: 'login.tab.agent' })} key="accountLogin" />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
name="login"
|
name="login"
|
||||||
className='login-form'
|
className='login-form'
|
||||||
initialValues={{ remember: false }}
|
initialValues={{ remember: false }}
|
||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
name="account"
|
|
||||||
rules={[{ required: true, message: intl.formatMessage({ id: 'login.username.placeholder' }) + '!' }]}
|
|
||||||
>
|
>
|
||||||
<Input
|
<Form.Item
|
||||||
prefix={<UserOutlined className="site-form-item-icon" />}
|
name="account"
|
||||||
placeholder={intl.formatMessage({ id: 'login.username.placeholder' })}
|
rules={[{ required: true, message: intl.formatMessage({ id: 'login.username.placeholder' }) + '!' }]}
|
||||||
size="large"
|
>
|
||||||
/>
|
<Input
|
||||||
</Form.Item>
|
prefix={<UserOutlined className="site-form-item-icon" />}
|
||||||
|
placeholder={intl.formatMessage({ id: 'login.username.placeholder' })}
|
||||||
|
size="large"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="password"
|
name="password"
|
||||||
rules={[{ required: true, message: intl.formatMessage({ id: 'login.password.placeholder' }) + '!' }]}
|
rules={[{ required: true, message: intl.formatMessage({ id: 'login.password.placeholder' }) + '!' }]}
|
||||||
>
|
>
|
||||||
<Input.Password
|
<Input.Password
|
||||||
prefix={<LockOutlined className="site-form-item-icon" />}
|
prefix={<LockOutlined className="site-form-item-icon" />}
|
||||||
placeholder={intl.formatMessage({ id: 'login.password.placeholder' })}
|
placeholder={intl.formatMessage({ id: 'login.password.placeholder' })}
|
||||||
iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
|
iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
|
||||||
size="large"
|
size="large"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="identifying"
|
name="identifying"
|
||||||
rules={[{ required: true, message: intl.formatMessage({ id: 'login.captcha.placeholder' }) + '!' }]}
|
rules={[{ required: true, message: intl.formatMessage({ id: 'login.captcha.placeholder' }) + '!' }]}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder={intl.formatMessage({ id: 'login.captcha.placeholder' })}
|
placeholder={intl.formatMessage({ id: 'login.captcha.placeholder' })}
|
||||||
size="large"
|
size="large"
|
||||||
maxLength={6}
|
maxLength={6}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
prefix={null}
|
prefix={null}
|
||||||
suffix={
|
suffix={
|
||||||
<img
|
<img
|
||||||
src={`data:image/png;base64,${captchaImg}`}
|
src={`data:image/png;base64,${captchaImg}`}
|
||||||
alt="验证码"
|
alt="验证码"
|
||||||
style={{ cursor: 'pointer', height: 32, verticalAlign: 'middle' }}
|
style={{ cursor: 'pointer', height: 32, verticalAlign: 'middle' }}
|
||||||
onClick={fetchCaptcha}
|
onClick={fetchCaptcha}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<div className='login-options'>
|
<div className='login-options'>
|
||||||
<Form.Item name="remember" valuePropName="checked" noStyle>
|
<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||||
<Checkbox>{intl.formatMessage({ id: 'login.remember' })}</Checkbox>
|
<Checkbox>{intl.formatMessage({ id: 'login.remember' })}</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="link" onClick={() => onForgot()} className="login-form-forgot" href="">
|
<Button type="link" onClick={() => onForgot()} className="login-form-forgot" href="">
|
||||||
{intl.formatMessage({ id: 'login.forgot' })}
|
{intl.formatMessage({ id: 'login.forgot' })}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item>
|
||||||
|
<Button type="primary" htmlType="submit" className="login-form-button" loading={loading} size="large">
|
||||||
|
{intl.formatMessage({ id: 'login.button' })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
{activeKey !== 'accountLogin' && renderRegisterLink()}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
<Form.Item>
|
</div>
|
||||||
<Button type="primary" htmlType="submit" className="login-form-button" loading={loading} size="large">
|
|
||||||
{intl.formatMessage({ id: 'login.button' })}
|
|
||||||
</Button>
|
|
||||||
{activeKey !== 'accountLogin' && renderRegisterLink()}
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user