fix(ui): 完善界面交互与开发配置
This commit is contained in:
@@ -78,6 +78,12 @@ const OrgLogin = () => {
|
||||
const [pendingLoginName, setPendingLoginName] = useState(loginParam);
|
||||
// 实际生效模式:系统未开直登则始终走企业标识
|
||||
const effectiveMode = directLoginEnabled ? loginMode : 'identifier';
|
||||
// Step1 受控输入的前端必填提示:失焦后仍为空时在框下提示(不改变按钮禁用与提交逻辑)
|
||||
const [blurred, setBlurred] = useState({});
|
||||
const markBlurred = (key) =>
|
||||
setBlurred((prev) => (prev[key] ? prev : { ...prev, [key]: true }));
|
||||
const emptyHelp = (key, empty, message) =>
|
||||
blurred[key] && empty ? { validateStatus: 'error', help: message } : {};
|
||||
|
||||
const logo = getLogo();
|
||||
const systemName = getSystemName();
|
||||
@@ -497,6 +503,11 @@ const OrgLogin = () => {
|
||||
label={t('登录名')}
|
||||
htmlFor='org-direct-login-name'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'login_name',
|
||||
!directForm.login_name.trim(),
|
||||
t('请输入登录名'),
|
||||
)}
|
||||
>
|
||||
<Input
|
||||
id='org-direct-login-name'
|
||||
@@ -505,6 +516,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setDirectForm({ ...directForm, login_name: v })
|
||||
}
|
||||
onBlur={() => markBlurred('login_name')}
|
||||
placeholder={t('请输入登录名')}
|
||||
size='default'
|
||||
autoFocus
|
||||
@@ -514,6 +526,11 @@ const OrgLogin = () => {
|
||||
label={t('密码')}
|
||||
htmlFor='org-direct-password'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'password',
|
||||
!directForm.password,
|
||||
t('请输入密码'),
|
||||
)}
|
||||
>
|
||||
<Input
|
||||
id='org-direct-password'
|
||||
@@ -522,6 +539,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setDirectForm({ ...directForm, password: v })
|
||||
}
|
||||
onBlur={() => markBlurred('password')}
|
||||
mode='password'
|
||||
placeholder={t('请输入密码')}
|
||||
size='default'
|
||||
@@ -563,6 +581,11 @@ const OrgLogin = () => {
|
||||
label={t('企业名称/代码')}
|
||||
htmlFor='org-login-identifier'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'identifier',
|
||||
!identifier.trim(),
|
||||
t('请输入企业名称/代码'),
|
||||
)}
|
||||
>
|
||||
<AutoComplete
|
||||
id='org-login-identifier'
|
||||
@@ -572,6 +595,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setIdentifier(typeof v === 'string' ? v : '')
|
||||
}
|
||||
onBlur={() => markBlurred('identifier')}
|
||||
onSearch={handleSuggestSearch}
|
||||
onSelect={(code) => {
|
||||
setIdentifier(code);
|
||||
@@ -656,7 +680,9 @@ const OrgLogin = () => {
|
||||
size='default'
|
||||
autoFocus={!prefilledLoginName}
|
||||
autoComplete='username'
|
||||
rules={[{ required: true, message: t('请输入登录名') }]}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入企业内登录名') },
|
||||
]}
|
||||
/>
|
||||
<Form.Input
|
||||
field='password'
|
||||
@@ -730,6 +756,7 @@ const OrgLogin = () => {
|
||||
placeholder={t('请输入新密码')}
|
||||
mode='password'
|
||||
size='default'
|
||||
required
|
||||
autoFocus
|
||||
autoComplete='new-password'
|
||||
onKeyDown={handleCapsLock}
|
||||
@@ -747,11 +774,12 @@ const OrgLogin = () => {
|
||||
placeholder={t('请再次输入新密码')}
|
||||
mode='password'
|
||||
size='default'
|
||||
required
|
||||
autoComplete='new-password'
|
||||
onKeyDown={handleCapsLock}
|
||||
onKeyUp={handleCapsLock}
|
||||
validate={(value, values) => {
|
||||
if (!value) return t('请再次输入新密码');
|
||||
if (!value) return t('请输入确认新密码');
|
||||
if (value !== values.new_password)
|
||||
return t('两次输入的新密码不一致');
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user