| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-01-17 20:44:02 |
| 4 | * @LastEditTime: 2025-02-08 10:19:52 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: 账户 |
| 7 | */ |
| 8 | |
| 9 | import React, { useCallback, useState } from 'react'; |
| 10 | |
| 11 | import styles from './account.module.scss'; |
| 12 | import AccountSidebar from './components/AccountSidebar/AccountSidebar'; |
| 13 | import WebView from '@/components/WebView'; |
| 14 | import { AccountInfo, AccountPlatInfoMap } from '@/views/account/comment'; |
| 15 | |
| 16 | const Account: React.FC = () => { |
| 17 | const [activeAccountId, setActiveAccountId] = useState(-1); |
| 18 | const [accountInfo, setAccountInfo] = useState<AccountInfo>(); |
| 19 | |
| 20 | return ( |
| 21 | <div className={styles.account}> |
| 22 | <AccountSidebar |
| 23 | activeAccountId={activeAccountId} |
| 24 | onAccountChange={useCallback((info) => { |
| 25 | setActiveAccountId(info.id); |
| 26 | setAccountInfo(info); |
| 27 | }, [])} |
| 28 | /> |
| 29 | <div className="account-con"> |
| 30 | {accountInfo ? ( |
| 31 | <WebView |
| 32 | url={AccountPlatInfoMap.get(accountInfo.type)!.url!} |
| 33 | cookieParams={{ |
| 34 | cookies: JSON.parse(accountInfo.loginCookie), |
| 35 | }} |
| 36 | key={activeAccountId} |
| 37 | /> |
| 38 | ) : ( |
| 39 | <div className="account-noSelect">未选择账户</div> |
| 40 | )} |
| 41 | </div> |
| 42 | </div> |
| 43 | ); |
| 44 | }; |
| 45 | |
| 46 | export default Account; |
| 47 |