|
@@ -2,14 +2,24 @@
|
|
import { FC, PropsWithChildren } from "react";
|
|
import { FC, PropsWithChildren } from "react";
|
|
import { useRouter } from "@/i18n";
|
|
import { useRouter } from "@/i18n";
|
|
// import ButtonOwn from "@/components/ButtonOwn";
|
|
// import ButtonOwn from "@/components/ButtonOwn";
|
|
|
|
+import ItemCom from "./component/ItemCom";
|
|
import './page.scss'
|
|
import './page.scss'
|
|
|
|
+import { useGlobalStore } from '@/stores';
|
|
|
|
+import {getLogoutApi} from "@/api/user";
|
|
|
|
|
|
interface Props {}
|
|
interface Props {}
|
|
|
|
|
|
const Profile: FC<PropsWithChildren<Props>> = (props) => {
|
|
const Profile: FC<PropsWithChildren<Props>> = (props) => {
|
|
- // let [amount, setAmount] = React.useState(0)
|
|
|
|
- let amount = 50
|
|
|
|
- let amountList = [10,20,50,100,200,500,1000,5000,10000,500,1000,5000,10000]
|
|
|
|
|
|
+ const { token, setToken, userInfo, setUserInfo } = useGlobalStore();
|
|
|
|
+
|
|
|
|
+ const logoutRequest = async () => {
|
|
|
|
+ let res = await getLogoutApi()
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ setUserInfo('')
|
|
|
|
+ setToken('')
|
|
|
|
+ router.replace('/login')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const goPage = (path = '/') => {
|
|
const goPage = (path = '/') => {
|
|
@@ -17,43 +27,51 @@ const Profile: FC<PropsWithChildren<Props>> = (props) => {
|
|
}
|
|
}
|
|
|
|
|
|
return (
|
|
return (
|
|
- <div className="main">
|
|
|
|
|
|
+ <div className="profile-box">
|
|
<div className="userContent">
|
|
<div className="userContent">
|
|
<div className="userInfo">
|
|
<div className="userInfo">
|
|
<div>
|
|
<div>
|
|
<div className="bgImg"></div>
|
|
<div className="bgImg"></div>
|
|
- <div>
|
|
|
|
- <span>Conta</span>
|
|
|
|
- <span className="phone">5516982013895</span>
|
|
|
|
- </div>
|
|
|
|
|
|
+ {
|
|
|
|
+ token && (
|
|
|
|
+ <div>
|
|
|
|
+ <span>{userInfo?.user_name || ''}</span>
|
|
|
|
+ <span className="phone">{userInfo?.user_phone || ''}</span>
|
|
|
|
+ </div>
|
|
|
|
+ )
|
|
|
|
+ }
|
|
</div>
|
|
</div>
|
|
<div className="goto" onClick={() => goPage('/login')}>
|
|
<div className="goto" onClick={() => goPage('/login')}>
|
|
- <span>Login</span>
|
|
|
|
|
|
+ { !token && <span>Login</span> }
|
|
<span className="iconfont icon-xiangzuo1"></span>
|
|
<span className="iconfont icon-xiangzuo1"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div className="coin">
|
|
|
|
- <div>
|
|
|
|
- <span className="iconfont icon-wallet"></span>
|
|
|
|
- <div>
|
|
|
|
- <span> Saldo </span>
|
|
|
|
- <div className="num">
|
|
|
|
- <span className="uppercase">brl </span>
|
|
|
|
- <span>0.00</span>
|
|
|
|
|
|
+ {
|
|
|
|
+ token && (
|
|
|
|
+ <div className="coin">
|
|
|
|
+ <div>
|
|
|
|
+ <span className="iconfont icon-wallet"></span>
|
|
|
|
+ <div>
|
|
|
|
+ <span> Saldo </span>
|
|
|
|
+ <div className="num">
|
|
|
|
+ <span className="uppercase">brl </span>
|
|
|
|
+ <span>0.00</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div>
|
|
|
|
- <span className="iconfont icon-gift2"></span>
|
|
|
|
- <div>
|
|
|
|
- <span> Bônus </span>
|
|
|
|
- <div className="num">
|
|
|
|
- <span className="uppercase">brl </span>
|
|
|
|
- <span>0.00</span>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <span className="iconfont icon-gift2"></span>
|
|
|
|
+ <div>
|
|
|
|
+ <span> Bônus </span>
|
|
|
|
+ <div className="num">
|
|
|
|
+ <span className="uppercase">brl </span>
|
|
|
|
+ <span>0.00</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ )
|
|
|
|
+ }
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div className="link">
|
|
<div className="link">
|
|
@@ -63,21 +81,13 @@ const Profile: FC<PropsWithChildren<Props>> = (props) => {
|
|
<ButtonOwn active={true}>Sacar</ButtonOwn> */}
|
|
<ButtonOwn active={true}>Sacar</ButtonOwn> */}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <ul>
|
|
|
|
- {
|
|
|
|
- amountList.map((item, index) => (
|
|
|
|
- <li className={index==0?'free':''} key={index}>
|
|
|
|
- <div className="content"> Afiliado - Ganhe R$ 10.000 por dia | 9F.COM
|
|
|
|
- <span data-v-5c42ece6="" className="iconfont icon-hot"></span>
|
|
|
|
- <div data-v-5c42ece6=""></div>
|
|
|
|
- </div>
|
|
|
|
- <div><span className="iconfont icon-xiangyou1"></span></div>
|
|
|
|
- </li>
|
|
|
|
- ))
|
|
|
|
- }
|
|
|
|
- </ul>
|
|
|
|
|
|
+ <ItemCom />
|
|
|
|
|
|
- <span className="logOut" onClick={() => goPage('/login')}>Login</span>
|
|
|
|
|
|
+ {
|
|
|
|
+ token ? <span className="logOut" onClick={logoutRequest}>Sair</span> : (
|
|
|
|
+ <span className="logOut" onClick={() => goPage('/login')}>Login</span>
|
|
|
|
+ )
|
|
|
|
+ }
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
};
|
|
};
|