diff --git a/src/layout/header/index.tsx b/src/layout/header/index.tsx index 0f6f498..2a4576b 100644 --- a/src/layout/header/index.tsx +++ b/src/layout/header/index.tsx @@ -32,11 +32,6 @@ const Header = () => { const logout = async () => { const [error] = await runAsync(); if (error) return; - - useGlobalStore.setState({ - token: '', - refreshToken: '' - }); } return ( @@ -140,13 +135,13 @@ const Header = () => { >

- {currentUser?.nickName} + {currentUser?.userName}

{currentUser?.phoneNumber}

- {currentUser?.email} + {currentUser?.emailAddress}


@@ -158,8 +153,8 @@ const Header = () => { }} >
- {currentUser?.avatarPath ? ( - + {currentUser?.avatarUrl ? ( + ) : ( } /> )} diff --git a/src/models/index.ts b/src/models/index.ts index a864daa..b421474 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -4,3 +4,16 @@ export interface PageData { data: T[]; total: number; } + + +export interface Announcement { + id: number, + name: string, + detail: string, + expiryTime: string, + roleId: number, + flag: number, + createTime: string, + createOperId: number, + top: number +} diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index fd2c6d2..60c1930 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -1,14 +1,26 @@ import { t } from '@/utils/i18n'; -import { IconBuguang } from '@/assets/icons/buguang' +import { IconBuguang } from '@/assets/icons/buguang'; import { LockOutlined, UserOutlined } from '@ant-design/icons'; import { Button, Form, Input, Carousel } from 'antd'; import { useNavigate } from 'react-router-dom'; +import { useRequest } from '@/hooks/use-request'; +import { useUserStore } from '@/store/global/user'; +import loginService from '@/request/service/login'; +import { LoginDTO } from '@/models'; import './index.css' const Login = () => { const navigate = useNavigate(); - const onFinish = async () => { + const { runAsync: login, loading } = useRequest(loginService.login, { manual: true }); + const { setCurrentUser } = useUserStore(); + const onFinish = async (values: LoginDTO) => { + const [loginError, data] = await login(values); + if (loginError) { + return; + } + data.data.avatarUrl = 'https://test.vogocm.com:9010/eshop/eshop_img/2023/5/24/43853633d16749bfb291f81bebb73451_20230524150631A001.jpg' + setCurrentUser(data.data); navigate('/'); }; @@ -22,7 +34,7 @@ const Login = () => {

旺嘉-ERP Admin

- {t("wbTMzvDM" /* 一个高颜值后台管理系统 */)} + {t("wbTMzvDM" /* 旺嘉-ERP后台管理系统 */)}

{