import TemplateContainer from '@/pages/TemplateContainer'; import { GetUserAgentInfo, GetUserInfo } from '@/services/services/user'; import { RedoOutlined } from '@ant-design/icons'; import { useModel } from '@umijs/max'; import { Avatar, Button, Card, Col, Input, message, Modal, Row, Spin, Tag } from 'antd'; import React, { useEffect, useState } from 'react'; import UserCenterUserInfo from '../UserCenterUserInfo'; import UserCenterAgentMessage from '../UserCenterAgentMessage'; import { useSoftStore } from '@/store/software'; const UserCenter: React.FC = () => { const { initialState, setInitialState } = useModel('@@initialState'); const [messageApi, messageHolder] = message.useMessage(); const [modalApi, modalHolder] = Modal.useModal(); const { setTopSpinTip, setTopSpinning } = useSoftStore(); const [userAgentUserInfo, setUserAgentUserInfo] = useState(); useEffect(() => { if (initialState?.currentUser?.id) { // 初始化加载用户信息 setTopSpinning(true); setTopSpinTip("正在获取用户信息。。。"); GetUserInfo(initialState?.currentUser?.id).then(async (res) => { setInitialState({ ...initialState, currentUser: res }); localStorage.setItem('userInfo', JSON.stringify(res)); let agentInfo = await GetUserAgentInfo(); setUserAgentUserInfo(agentInfo); }).catch((error) => { console.log(error) }).finally(() => { setTopSpinning(false); }) } }, []) function renderTitie() { return (
{initialState?.currentUser?.userName?.substring(0, 1)}
{"ID: " + initialState?.currentUser?.id} {initialState?.currentUser?.userName}
{initialState?.currentUser?.roleNames?.map((item: any) => { return {item} })}
) } return (
可激活总数
{initialState?.currentUser?.allDeviceCount}
余换绑次数
{initialState?.currentUser?.freeCount}
代理分成
{(initialState?.currentUser?.agentPercent ?? 0.5) * 100}%
邀请码
{initialState?.currentUser?.affiliateCode}
{modalHolder} {messageHolder}
); }; export default UserCenter;