|
|
@@ -1,5 +1,5 @@
|
|
|
-import { useCallback, useEffect, useRef, useState, useSyncExternalStore, type FormEvent } from "react";
|
|
|
-import { ArrowUpRight, Eye, EyeOff, Image as ImageIcon, Layers3, LoaderCircle, LockKeyhole, ShieldCheck, UserRound, X } from "lucide-react";
|
|
|
+import { useCallback, useEffect, useRef, useState, useSyncExternalStore, type FormEvent, type KeyboardEvent } from "react";
|
|
|
+import { ArrowUpRight, ChevronRight, Eye, EyeOff, Image as ImageIcon, Layers3, LoaderCircle, LockKeyhole, RotateCw, ShieldCheck, UserRound, X } from "lucide-react";
|
|
|
import { Link, useLocation, useNavigate } from "react-router";
|
|
|
import { Button } from "../components/ui/button";
|
|
|
import { Input } from "../components/ui/input";
|
|
|
@@ -132,6 +132,13 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
const passwordRef = useRef<HTMLInputElement>(null);
|
|
|
const captchaRef = useRef<HTMLInputElement>(null);
|
|
|
|
|
|
+ function focusNext(event: KeyboardEvent<HTMLInputElement>, next: HTMLInputElement | null) {
|
|
|
+ if (mobile && event.key === "Enter" && !event.nativeEvent.isComposing && next) {
|
|
|
+ event.preventDefault();
|
|
|
+ next.focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const refreshToken = useCallback(async () => {
|
|
|
try {
|
|
|
setCaptchaImage(await createCaptcha());
|
|
|
@@ -217,7 +224,7 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
|
|
|
return (
|
|
|
<main className={`illustrated-login${mobile ? " illustrated-login--mobile" : ""}`}>
|
|
|
- <section className="illustrated-login__brand" aria-labelledby="illustrated-brand-title">
|
|
|
+ <section className={mobile ? "field-login__hero" : "illustrated-login__brand"} aria-labelledby="illustrated-brand-title">
|
|
|
<div className="illustrated-login__identity">
|
|
|
<span className="illustrated-login__logo"><Layers3 size={23} strokeWidth={1.6} aria-hidden="true" /></span>
|
|
|
<div><p>运营支撑系统</p><span>OPERATIONS SUPPORT</span></div>
|
|
|
@@ -231,9 +238,17 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
<div className="illustrated-login__keywords"><span>账户管理</span><i aria-hidden="true" /><span>运维执行</span><i aria-hidden="true" /><span>计费与对账</span></div>
|
|
|
</div>
|
|
|
)}
|
|
|
- {mobile && <h1 id="illustrated-brand-title" className="sr-only">运维现场登录</h1>}
|
|
|
+ {mobile && (
|
|
|
+ <>
|
|
|
+ <div className="field-login__intro">
|
|
|
+ <h1 id="illustrated-brand-title">运维现场登录</h1>
|
|
|
+ <p>查看待办工单,回填现场记录。</p>
|
|
|
+ </div>
|
|
|
+ <img className="field-login__scene" src="/images/operations-login-diorama-service.webp" width="1536" height="1024" alt="" />
|
|
|
+ </>
|
|
|
+ )}
|
|
|
</section>
|
|
|
- <section className="illustrated-login__access" aria-labelledby="illustrated-login-title">
|
|
|
+ <section className="illustrated-login__access" aria-labelledby={mobile ? "illustrated-brand-title" : "illustrated-login-title"}>
|
|
|
{!mobile && (
|
|
|
<>
|
|
|
<svg className="illustrated-login__ambient illustrated-login__ambient--top" viewBox="0 0 390 320" fill="none" aria-hidden="true" focusable="false">
|
|
|
@@ -254,22 +269,22 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
</svg>
|
|
|
</>
|
|
|
)}
|
|
|
- <div className="relative isolate w-full max-w-[460px]">
|
|
|
- <div className="absolute -left-4 -top-4 -z-10 hidden h-24 w-24 rounded-[30px] border border-primary-border/35 bg-primary-soft/70 lg:block" />
|
|
|
- <div className="rounded-[24px] border border-border/80 bg-card p-6 shadow-[var(--shadow-panel)] sm:p-8 lg:p-9">
|
|
|
- <div className="mb-8">
|
|
|
+ <div className={mobile ? "field-login__panel" : "relative isolate w-full max-w-[460px]"}>
|
|
|
+ {!mobile && <div className="absolute -left-4 -top-4 -z-10 hidden h-24 w-24 rounded-[30px] border border-primary-border/35 bg-primary-soft/70 lg:block" />}
|
|
|
+ <div className={mobile ? undefined : "rounded-[24px] border border-border/80 bg-card p-6 shadow-[var(--shadow-panel)] sm:p-8 lg:p-9"}>
|
|
|
+ {!mobile && <div className="mb-8">
|
|
|
<div>
|
|
|
<p className="font-mono text-xs font-semibold tracking-[0.16em] text-primary">
|
|
|
- {mobile ? "FIELD ACCESS" : "ACCOUNT ACCESS"}
|
|
|
+ ACCOUNT ACCESS
|
|
|
</p>
|
|
|
<h2 id="illustrated-login-title" className="mt-3 font-serif text-[1.75rem] font-medium tracking-tight sm:text-[2.25rem]">
|
|
|
- {mobile ? "运维现场" : "运营工作台"}
|
|
|
+ 运营工作台
|
|
|
</h2>
|
|
|
<p className="mt-2 text-sm leading-6 text-muted-foreground text-pretty">
|
|
|
- {mobile ? "登录后继续处理待办工单与现场回填。" : "按权限查看订阅、跟进工单和查阅账单。"}
|
|
|
+ 按权限查看订阅、跟进工单和查阅账单。
|
|
|
</p>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>}
|
|
|
|
|
|
{sessionNotice && (
|
|
|
<div className="mb-5 flex items-start justify-between gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-3 text-sm leading-5 text-amber-900" role="status">
|
|
|
@@ -278,7 +293,7 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
</div>
|
|
|
)}
|
|
|
|
|
|
- <form className="space-y-5" noValidate onSubmit={handleSubmit}>
|
|
|
+ <form className={mobile ? "field-login__form" : "space-y-5"} noValidate onSubmit={handleSubmit}>
|
|
|
<div>
|
|
|
<label className="field-label mb-2 block text-sm" htmlFor="illustrated-account">
|
|
|
账号
|
|
|
@@ -292,6 +307,11 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
/>
|
|
|
<Input
|
|
|
autoComplete="username"
|
|
|
+ autoCapitalize="none"
|
|
|
+ autoCorrect="off"
|
|
|
+ spellCheck={false}
|
|
|
+ enterKeyHint={mobile ? "next" : undefined}
|
|
|
+ onKeyDown={(event) => focusNext(event, passwordRef.current)}
|
|
|
ref={accountRef}
|
|
|
required
|
|
|
className="h-12 w-full rounded-xl border-input bg-card pl-11 pr-4 text-sm outline-none transition-colors placeholder:text-muted-foreground hover:border-border-hover focus:border-ring focus:ring-2 focus:ring-ring/15 aria-invalid:border-destructive aria-invalid:focus:ring-destructive/15"
|
|
|
@@ -333,6 +353,11 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
/>
|
|
|
<Input
|
|
|
autoComplete="current-password"
|
|
|
+ autoCapitalize="none"
|
|
|
+ autoCorrect="off"
|
|
|
+ spellCheck={false}
|
|
|
+ enterKeyHint={mobile ? "next" : undefined}
|
|
|
+ onKeyDown={(event) => focusNext(event, captchaRef.current)}
|
|
|
ref={passwordRef}
|
|
|
required
|
|
|
className="h-12 w-full rounded-xl border-input bg-card pl-11 pr-12 text-sm outline-none transition-colors placeholder:text-muted-foreground hover:border-border-hover focus:border-ring focus:ring-2 focus:ring-ring/15 aria-invalid:border-destructive aria-invalid:focus:ring-destructive/15"
|
|
|
@@ -385,6 +410,9 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
<ImageIcon className="illustrated-login__captcha-icon" size={17} strokeWidth={1.7} aria-hidden="true" />
|
|
|
<Input
|
|
|
autoComplete="off"
|
|
|
+ autoCapitalize="none"
|
|
|
+ autoCorrect="off"
|
|
|
+ enterKeyHint={mobile ? "go" : undefined}
|
|
|
ref={captchaRef}
|
|
|
required
|
|
|
className="illustrated-login__captcha-input text-sm placeholder:text-muted-foreground md:placeholder:text-[13px]"
|
|
|
@@ -418,6 +446,7 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
) : (
|
|
|
<span className="text-xs text-muted-foreground">点击获取</span>
|
|
|
)}
|
|
|
+ {mobile && <RotateCw size={15} aria-hidden="true" />}
|
|
|
</button>
|
|
|
</div>
|
|
|
{errors.captcha && (
|
|
|
@@ -451,17 +480,17 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
) : (
|
|
|
<>
|
|
|
登录
|
|
|
- <ArrowUpRight
|
|
|
+ {!mobile && <ArrowUpRight
|
|
|
aria-hidden="true"
|
|
|
className="transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"
|
|
|
size={16}
|
|
|
- />
|
|
|
+ />}
|
|
|
</>
|
|
|
)}
|
|
|
</Button>
|
|
|
</form>
|
|
|
|
|
|
- <div className="mt-6 border-t border-border pt-4">
|
|
|
+ {!mobile && <div className="mt-6 border-t border-border pt-4">
|
|
|
<p className="text-xs text-muted-foreground">
|
|
|
本机联调账号(点击填登录名,口令仍需手输)
|
|
|
</p>
|
|
|
@@ -480,18 +509,26 @@ export function IllustratedLoginPage({ variant = "desktop" }: { variant?: LoginV
|
|
|
</button>
|
|
|
))}
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>}
|
|
|
|
|
|
- <div className="mt-4 flex items-start gap-2 border-t border-border pt-4 text-[13px] leading-5 text-muted-foreground">
|
|
|
+ {mobile ? (
|
|
|
+ <div className="field-login__activation">
|
|
|
+ <Link to="/activate" state={{ mobileLogin: true, from: redirectTo }}>
|
|
|
+ 首次激活账号 <ChevronRight size={16} aria-hidden="true" />
|
|
|
+ </Link>
|
|
|
+ </div>
|
|
|
+ ) : <div className="mt-4 flex items-start gap-2 border-t border-border pt-4 text-[13px] leading-5 text-muted-foreground">
|
|
|
<span aria-hidden="true" className="grid h-5 shrink-0 place-items-center text-icon">
|
|
|
<ShieldCheck size={14} />
|
|
|
</span>
|
|
|
<p className="flex-1">如无法登录,请联系系统管理员。</p>
|
|
|
<Link className="shrink-0 font-medium text-primary underline-offset-4 hover:underline" to="/activate">首次激活账号</Link>
|
|
|
- </div>
|
|
|
+ </div>}
|
|
|
</div>
|
|
|
</div>
|
|
|
- <footer className="illustrated-login__footer"><span>© 2026 运营支撑系统</span></footer>
|
|
|
+ {mobile ? (
|
|
|
+ <footer className="field-login__support"><ShieldCheck size={15} aria-hidden="true" />如无法登录,请联系系统管理员。</footer>
|
|
|
+ ) : <footer className="illustrated-login__footer"><span>© 2026 运营支撑系统</span></footer>}
|
|
|
</section>
|
|
|
</main>
|
|
|
);
|