Commit 12b2021a by liimin

fix(Login): 修复自动填充输入框淡色背景并调整品牌文案

1 parent e87fc91a
Pipeline #330 for 12b2021a failed in 0 seconds
...@@ -4,3 +4,12 @@ ...@@ -4,3 +4,12 @@
- LoginClock.tsx:原 today/base 仅挂载时算一次、tick 靠 setInterval 累加。新增 document.visibilitychange 监听,页面重新可见时 setToday(new Date()) + setBase(nowTotalSeconds()) + setTick(0) 重新锚定到当前时间;base/today 改为可更新 state。 - LoginClock.tsx:原 today/base 仅挂载时算一次、tick 靠 setInterval 累加。新增 document.visibilitychange 监听,页面重新可见时 setToday(new Date()) + setBase(nowTotalSeconds()) + setTick(0) 重新锚定到当前时间;base/today 改为可更新 state。
- LoginAside.tsx:now 改为可更新 state;新增可见性监听(切回即 setNow(new Date()) 重算 greet/dateText)+ 60s 定时(防前台常开跨午夜变旧)。 - LoginAside.tsx:now 改为可更新 state;新增可见性监听(切回即 setNow(new Date()) 重算 greet/dateText)+ 60s 定时(防前台常开跨午夜变旧)。
- tsc --noEmit 通过(EXIT=0)。 - tsc --noEmit 通过(EXIT=0)。
## 登录框 autofill 背景色修复(09:07)
- 问题:浏览器记住密码→自动填充后,UInput/UInput.Password 输入框被染成默认淡色(淡蓝/淡黄),与白色登录卡片(.uj-login-card 背景 #fff)不搭。
- 根因:autofill 背景是浏览器内联强制画上的,普通 background 改不掉。
- 修法(src/theme/design.css,紧接 .uj-login-card 后新增规则):对 `.uj-login-card input:-webkit-autofill(:hover/:focus/:active)` 用 `box-shadow: 0 0 0 1000px #fff inset` + `transition: background-color 9999s` 覆盖为白;`-webkit-text-fill-color`/`caret-color` 保持深色保证可读。纯 CSS,无 TS 变动。
- 09:12 补充:聚焦(focus)时淡色背景重现。根因:新版 Chrome 在 input 聚焦时会把 autofill 背景重放一遍,且此时 `:-webkit-autofill` 伪类不稳定匹配(背景改由 UA 内联样式绘制),仅靠伪类盖不住。强化:直接对 `.uj-login-card` 内 `.ant-input` / `.ant-input-affix-wrapper` 的所有态(含 focus/hover/active/focused)强制 `background-color:#fff !important` 压过浏览器与 antd 背景,autofill 伪类仅作 box-shadow 兜底。
- 09:18 修正:用户确认淡蓝/淡黄仍未消除。根因非伪类/聚焦,而是特异性不足——antd 6 CSS-in-JS 把 .ant-input 的 background 注入到 head 末尾(晚于 design.css 加载),原选择器被 antd 规则盖过。修正:选择器重复 class 抬特异性(.ant-input.ant-input 等)+ 补全 antd6 变体(outlined/password/focused),background 改简写 #fff !important;autofill 伪类加 background:#fff !important + inset 阴影 + 9999s 过渡。
- 09:29 最终纠正(用户指出"第一版方向对、后续改崩了"):09:12/09:18 两版**方向全错**——autofill 淡色只能用 `box-shadow: 0 0 0 1000px #fff inset` 盖,改 `background` 无效,所以越改越没效果。聚焦态重现的真正根因是 Chrome 聚焦时用标准 `:autofill`(无前缀)伪类,第一版只盖了 `:-webkit-autofill`,漏了 `:autofill`。最终方案:删除所有 background 强制规则,回归 box-shadow inset #fff 方案,并补 `input:autofill(:hover/:focus/:active)` 覆盖聚焦态。纯 CSS,无 TS 变动。
...@@ -11,7 +11,7 @@ export default function Login() { ...@@ -11,7 +11,7 @@ export default function Login() {
<LoginForm /> <LoginForm />
</div> </div>
<UText type="secondary" style={{ marginTop: 24, fontSize: 12 }}> <UText type="secondary" style={{ marginTop: 24, fontSize: 12 }}>
© 2026 优加门店上架系统 · 企业级门店治理平台 © 2026 优加门店上架系统 · 一站式门店治理平台
</UText> </UText>
</main> </main>
</div> </div>
......
...@@ -9,6 +9,7 @@ import { UCard, UForm, UInput, UButton, UAlert, UText, Skeleton } from '@uj/ui'; ...@@ -9,6 +9,7 @@ import { UCard, UForm, UInput, UButton, UAlert, UText, Skeleton } from '@uj/ui';
import { auth, type UserInfo } from '@/api'; import { auth, type UserInfo } from '@/api';
import { useAppStore } from '@/store/useAppStore'; import { useAppStore } from '@/store/useAppStore';
import { useAccess } from '@/access'; import { useAccess } from '@/access';
import { formatDateTime } from '@/utils';
interface PasswordForm { interface PasswordForm {
oldPassword: string; oldPassword: string;
...@@ -16,17 +17,6 @@ interface PasswordForm { ...@@ -16,17 +17,6 @@ interface PasswordForm {
confirmPassword: string; confirmPassword: string;
} }
/** 后端 date-time 字符串 → yyyy-MM-dd hh:mm:ss(本地时区);空值或解析失败回退原值 */
function formatDateTime(input?: string | null): string {
if (!input) return '—';
const d = new Date(input);
if (Number.isNaN(d.getTime())) return input;
const p = (n: number) => String(n).padStart(2, '0');
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(
d.getHours(),
)}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
}
export default function Profile() { export default function Profile() {
const navigate = useNavigate(); const navigate = useNavigate();
const { message } = App.useApp(); const { message } = App.useApp();
......
...@@ -396,6 +396,26 @@ ...@@ -396,6 +396,26 @@
box-shadow: var(--uj-shadow-pop); box-shadow: var(--uj-shadow-pop);
border: 1px solid #eef1f6; border: 1px solid #eef1f6;
} }
/* 浏览器「记住密码」自动填充后,输入框出现默认淡色背景(淡蓝/淡黄),与白色卡片不搭。
autofill 的淡色必须用 inset 阴影盖——普通 background 改不掉它。
Chrome 聚焦态改用标准 :autofill(无前缀)伪类,故 :-webkit-autofill 与 :autofill 都要覆盖,
否则一聚焦淡色就重现。文字/光标保持深色,保证账号密码可读。 */
.uj-login-card input:-webkit-autofill,
.uj-login-card input:-webkit-autofill:hover,
.uj-login-card input:-webkit-autofill:focus,
.uj-login-card input:-webkit-autofill:active,
.uj-login-card input:autofill,
.uj-login-card input:autofill:hover,
.uj-login-card input:autofill:focus,
.uj-login-card input:autofill:active {
-webkit-text-fill-color: #1f2d4d !important;
caret-color: #1f2d4d !important;
-webkit-box-shadow: 0 0 0 1000px #fff inset !important;
box-shadow: 0 0 0 1000px #fff inset !important;
transition:
background-color 9999s ease-in-out 0s,
color 9999s ease-in-out 0s;
}
@media (max-width: 880px) { @media (max-width: 880px) {
.uj-login-aside { .uj-login-aside {
display: none; display: none;
......
/**
* 后端 date-time 字符串(如 ISO 8601)→ `yyyy-MM-dd hh:mm:ss`(本地时区)。
* 空值返回「—」;解析失败(非法串)则原样回退,避免吞掉原始值。
*/
export function formatDateTime(input?: string | null): string {
if (!input) return '—';
const d = new Date(input);
if (Number.isNaN(d.getTime())) return input;
const p = (n: number) => String(n).padStart(2, '0');
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(
d.getHours(),
)}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
}
export * from './datetime';
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!