fix:[FL-16][用户管理页面优化]

1. 去掉搜索按钮,输入关键字时自动触发查询(500ms防抖)
2. 修复卡片视图展示时出现的横向滚动条问题

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
chengkai3
2026-06-19 13:25:48 +08:00
parent c529c40739
commit 31b686543d
2 changed files with 20 additions and 14 deletions
+18 -13
View File
@@ -88,6 +88,7 @@ export default function AdminUsersPage() {
const [keywordInput, setKeywordInput] = useState("");
const [searchKeyword, setSearchKeyword] = useState("");
const [statusFilter, setStatusFilter] = useState<"active" | "disabled" | undefined>(undefined);
const keywordDebounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const [pagination, setPagination] = useState({ current: 1, pageSize: 20 });
const [tableScrollY, setTableScrollY] = useState(USERS_TABLE_MIN_SCROLL_Y);
const tableScrollAnchorRef = useRef<HTMLDivElement | null>(null);
@@ -584,11 +585,19 @@ export default function AdminUsersPage() {
createForm.resetFields();
};
const handleSearch = () => {
setSearchKeyword(keywordInput);
setPagination((prev) => ({ ...prev, current: 1 }));
setCardViewPage(1);
setAllLoadedUsers([]);
const handleKeywordChange = (value: string) => {
setKeywordInput(value);
if (keywordDebounceTimeoutRef.current) {
clearTimeout(keywordDebounceTimeoutRef.current);
}
keywordDebounceTimeoutRef.current = setTimeout(() => {
setSearchKeyword(value);
setPagination((prev) => ({ ...prev, current: 1 }));
setCardViewPage(1);
setAllLoadedUsers([]);
}, 500);
};
const queryError =
@@ -691,6 +700,9 @@ export default function AdminUsersPage() {
if (userIdCheckTimeoutRef.current) {
clearTimeout(userIdCheckTimeoutRef.current);
}
if (keywordDebounceTimeoutRef.current) {
clearTimeout(keywordDebounceTimeoutRef.current);
}
};
}, []);
@@ -1004,8 +1016,7 @@ export default function AdminUsersPage() {
allowClear
placeholder="按用户 ID/邮箱/用户名搜索"
value={keywordInput}
onChange={(event) => setKeywordInput(event.target.value)}
onPressEnter={handleSearch}
onChange={(event) => handleKeywordChange(event.target.value)}
/>
</Form.Item>
@@ -1024,12 +1035,6 @@ export default function AdminUsersPage() {
}}
/>
</Form.Item>
<Form.Item>
<Button type="primary" onClick={handleSearch}>
</Button>
</Form.Item>
</Form>
{viewMode === "table" ? (
+2 -1
View File
@@ -299,7 +299,8 @@ body {
.admin-users-card-view-content {
min-height: 0;
flex: 1;
overflow: auto;
overflow-x: hidden;
overflow-y: auto;
padding: 2px 2px 4px;
}