修掉下拉浮层被自己 layer 上的 fixed 废掉避让:Radix 的 translate 在它外层 wrapper 上,面板再写 position:fixed 就脱离文档流、wrapper 量到的高度是 0,flip/size 全按 0 高算——1280x720 贴近视口底边的下拉要么该翻不翻被压成 35px,要么翻了不减高度掉出屏幕 125px,右侧还会溢出视口 45px;去掉 fixed 后 19 个下半屏下拉全部完整落在视口内、三个宽度下无横向裁切。顺手把 /account 两列与三列两张卡也接进 FormGrid 基准栅格,多栅格容器错位归零。

main
mula.liu 2026-11-02 15:20:16 +08:00
parent 139db20320
commit e70c508044
2 changed files with 53 additions and 48 deletions

View File

@ -37,7 +37,10 @@ export const triggerLayer = cva([
* 直接消费它们,就不需要旧 use-popup.ts 里手算 left/top/maxH 与二次纠正。
*/
export const contentLayer = [
'fixed z-[400] flex flex-col overflow-hidden',
// 不能写 fixed:Radix 的定位在它外层 wrapper 上(translate 摆位置),
// 面板自己再 fixed 就脱离文档流,wrapper 量到的高度是 0,
// flip/size 全按 0 高算——贴近视口底边时「该翻不翻」或「翻了不减高度」,面板掉到屏幕外。
'z-[400] flex flex-col overflow-hidden',
'rounded-[10px] border border-line-strong bg-panel shadow-pop',
// 宽度三段式:至少和触发器一样宽(面板不会缩成一条)、按最长选项自然展开
// (长标签不该被挤成两行)、超过 440 或视口放不下才换行

View File

@ -12,7 +12,7 @@ import { describeUserAgent, fmtAgo, fmtTime } from '../lib/format'
import { useAutoRefresh } from '../hooks/use-auto-refresh'
import { SecretInput } from '../components/forms'
import {
Actions, Button, CardRow, Empty, ErrorText, Field, FormRow, Layout, Notice, PageHead, Panel, PanelHead, Stack, Tag
Actions, Button, CardRow, Empty, ErrorText, Field, FormGrid, FormRow, Layout, Notice, PageHead, Panel, PanelHead, Stack, Tag
} from '../components/ui'
import { login, roleLabel, setUser, useAuthStore } from '../stores/auth'
@ -107,53 +107,55 @@ export default function Account() {
<Layout>
<Stack>
<Panel>
<PanelHead title="基本资料" />
<FormRow cols={2}>
<Field label="登录名"><input value={auth.user?.username || ''} disabled /></Field>
<Field label="显示名">
<input value={profile.display_name} maxLength={80} placeholder="同事看到的名字"
onChange={(e) => setProfile((p) => ({ ...p, display_name: e.target.value }))} />
</Field>
<Field label="邮箱">
<input value={profile.email} maxLength={160} placeholder="用于通知,可留空"
onChange={(e) => setProfile((p) => ({ ...p, email: e.target.value }))} />
</Field>
<Field label="角色"><input value={role + '(由管理员分配)'} disabled /></Field>
</FormRow>
<Actions>
<Button variant="primary" disabled={!!busy} onClick={saveProfile}>保存资料</Button>
</Actions>
</Panel>
<FormGrid>
<Panel>
<PanelHead title="基本资料" />
<FormRow cols={2}>
<Field label="登录名"><input value={auth.user?.username || ''} disabled /></Field>
<Field label="显示名">
<input value={profile.display_name} maxLength={80} placeholder="同事看到的名字"
onChange={(e) => setProfile((p) => ({ ...p, display_name: e.target.value }))} />
</Field>
<Field label="邮箱">
<input value={profile.email} maxLength={160} placeholder="用于通知,可留空"
onChange={(e) => setProfile((p) => ({ ...p, email: e.target.value }))} />
</Field>
<Field label="角色"><input value={role + '(由管理员分配)'} disabled /></Field>
</FormRow>
<Actions>
<Button variant="primary" disabled={!!busy} onClick={saveProfile}>保存资料</Button>
</Actions>
</Panel>
<Panel>
<PanelHead title="修改密码" />
<FormRow cols={3}>
<Field label="当前密码">
<SecretInput value={pwd.current_password} autocomplete="current-password" placeholder="当前密码"
onChange={(v) => setPwd((p) => ({ ...p, current_password: v }))} />
</Field>
<Field label="新密码" hint={RULES_HINT}>
<SecretInput value={pwd.new_password} autocomplete="new-password" placeholder="新密码"
onChange={(v) => setPwd((p) => ({ ...p, new_password: v }))} />
</Field>
<Field label="确认新密码" hint="改完后其它设备会被注销">
<SecretInput value={pwd.confirm} autocomplete="new-password" placeholder="再输入一次"
onChange={(v) => setPwd((p) => ({ ...p, confirm: v }))}
onKeyUp={(e) => { if (e.key === 'Enter') void changePassword() }} />
</Field>
</FormRow>
<Actions>
<Button variant="primary" disabled={!!busy} title="改密后其它设备的会话会自动注销,本机保留。"
onClick={changePassword}>
修改密码
</Button>
<Button variant="outline" disabled={!!busy || !pwd.new_password || pwd.new_password !== pwd.confirm}
onClick={relogin}>
用新密码重新登录本机
</Button>
</Actions>
</Panel>
<Panel>
<PanelHead title="修改密码" />
<FormRow cols={3}>
<Field label="当前密码">
<SecretInput value={pwd.current_password} autocomplete="current-password" placeholder="当前密码"
onChange={(v) => setPwd((p) => ({ ...p, current_password: v }))} />
</Field>
<Field label="新密码" hint={RULES_HINT}>
<SecretInput value={pwd.new_password} autocomplete="new-password" placeholder="新密码"
onChange={(v) => setPwd((p) => ({ ...p, new_password: v }))} />
</Field>
<Field label="确认新密码" hint="改完后其它设备会被注销">
<SecretInput value={pwd.confirm} autocomplete="new-password" placeholder="再输入一次"
onChange={(v) => setPwd((p) => ({ ...p, confirm: v }))}
onKeyUp={(e) => { if (e.key === 'Enter') void changePassword() }} />
</Field>
</FormRow>
<Actions>
<Button variant="primary" disabled={!!busy} title="改密后其它设备的会话会自动注销,本机保留。"
onClick={changePassword}>
修改密码
</Button>
<Button variant="outline" disabled={!!busy || !pwd.new_password || pwd.new_password !== pwd.confirm}
onClick={relogin}>
用新密码重新登录本机
</Button>
</Actions>
</Panel>
</FormGrid>
</Stack>
<Stack>