diff --git a/frontend/src/components/GlobalConfig.jsx b/frontend/src/components/GlobalConfig.jsx index 2dff426..da63533 100644 --- a/frontend/src/components/GlobalConfig.jsx +++ b/frontend/src/components/GlobalConfig.jsx @@ -909,6 +909,32 @@ const GlobalConfig = () => { } + const loadUsersAndAccounts = async () => { + if (!isAdmin) return + try { + setBusy(true) + const [users, accounts] = await Promise.all([ + api.getUsersDetailed ? api.getUsersDetailed() : api.get('/admin/users/detailed').then(r => r.data), + api.getAccounts(), + ]) + setUsersDetailed(Array.isArray(users) ? users : []) + setAccountsAdmin(Array.isArray(accounts) ? accounts : []) + const initMap = {} + ;(Array.isArray(users) ? users : []).forEach(u => { + initMap[u.id] = '' + }) + setLinkAccountMap(initMap) + } catch (e) { + setMessage(e?.message || '加载失败') + } finally { + setBusy(false) + } + } + + useEffect(() => { + if (isAdmin) loadUsersAndAccounts() + }, [isAdmin]) + if (loading) { return