From 41f54af2affb55720531bb5b7b1d0341c6bb2c1a Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 27 二月 2024 13:25:34 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/User/Login/index.jsx | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/zy-asrs-flow/src/pages/User/Login/index.jsx b/zy-asrs-flow/src/pages/User/Login/index.jsx
index bca7dea..b318220 100644
--- a/zy-asrs-flow/src/pages/User/Login/index.jsx
+++ b/zy-asrs-flow/src/pages/User/Login/index.jsx
@@ -51,6 +51,7 @@
const storedValue = localStorage.getItem('rememberData');
return storedValue !== null ? JSON.parse(storedValue) : true;
});
+ const [hostList, setHostList] = useState([]);
useEffect(() => {
form.setFieldsValue({
@@ -67,6 +68,23 @@
localStorage.setItem('rememberData', JSON.stringify(rememberData));
}, [rememberData])
+ useEffect(() => {
+ const fetchHostList = async () => {
+ const resp = await Http.doGet('api/auth/host');
+ const list = resp.data.map(item => ({
+ label: item.name,
+ value: item.id
+ }));
+ setHostList(list);
+ if (list && list.length > 0) {
+ form.setFieldsValue({
+ hostId: list[0].value
+ });
+ }
+ }
+ fetchHostList();
+ }, []);
+
const fetchUserInfo = async () => {
const userInfo = await initialState?.fetchUserInfo?.();
if (userInfo) {
@@ -79,11 +97,6 @@
}
};
- const fetchHostList = async () => {
- const res = await Http.doGet('api/auth/host', {})
- console.log(res.data);
- }
- fetchHostList();
const handleSubmit = async (values) => {
try {
@@ -144,6 +157,8 @@
onFinish={async (values) => {
await handleSubmit(values);
}}
+ initialValue={{
+ }}
>
<Tabs
centered
@@ -165,14 +180,7 @@
message: '璇烽�夋嫨鏈烘瀯!',
},
]}
- debounceTime={300}
- request={async ({ keyWords }) => {
- const resp = await Http.doGet('api/auth/host', {});
- return resp.data.map(item => ({
- label: item.name,
- value: item.id
- }));
- }}
+ options={hostList}
/>
<ProFormText
name="username"
@@ -312,4 +320,4 @@
<Page />
</ProConfigProvider>
);
-};
\ No newline at end of file
+};
--
Gitblit v1.9.1