|
@@ -21,17 +21,20 @@ import { Badge, Button, Mask, ProgressBar, Toast } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import Image from "next/image";
|
|
|
import { Fragment, useEffect, useRef, useState } from "react";
|
|
|
-
|
|
|
+import { shallow } from "zustand/shallow";
|
|
|
type Props = {
|
|
|
userInfo: UserInfoRep;
|
|
|
};
|
|
|
const VipCard = () => {
|
|
|
const t = useTranslations("ProfilePage");
|
|
|
- const userVip = useVipStore((state) => state.vipData);
|
|
|
+ const vip_score_exp = useVipStore((state) => state.vipData!.vip_score_exp);
|
|
|
+ const vip_level = useVipStore((state) => state.vipData!.vip_level);
|
|
|
+ const vip_next_level = useVipStore((state) => state.vipData!.vip_next_level);
|
|
|
+ const vip_exp = useVipStore((state) => state.vipData!.vip_exp);
|
|
|
|
|
|
// Vip 图标
|
|
|
const vipIconElement = vipImages.map((item, index) => {
|
|
|
- if (item.leve === userVip?.vip_level) {
|
|
|
+ if (item.leve === vip_level) {
|
|
|
return (
|
|
|
<Fragment key={index}>
|
|
|
<Image src={item.src} alt={"vip"} height={110} width={100} />
|
|
@@ -43,7 +46,7 @@ const VipCard = () => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- if (!userVip) return null;
|
|
|
+ // if (!userVip) return null;
|
|
|
return (
|
|
|
<div className={"vip-card"}>
|
|
|
<div className={"vip-card__icon"}>{vipIconElement}</div>
|
|
@@ -51,7 +54,7 @@ const VipCard = () => {
|
|
|
{/*<div className={"process-top"}>{userVip.vip_exp}xp</div>*/}
|
|
|
<div>
|
|
|
<ProgressBar
|
|
|
- percent={percentage(userVip?.vip_exp, userVip?.vip_score_exp)}
|
|
|
+ percent={percentage(vip_exp, vip_score_exp)}
|
|
|
style={{
|
|
|
"--fill-color": "#bd37e0",
|
|
|
"--track-color": "#65609b",
|
|
@@ -60,15 +63,15 @@ const VipCard = () => {
|
|
|
/>
|
|
|
</div>
|
|
|
<div className={"process-bottom text-[#e581ff]"}>
|
|
|
- <span>VIP{userVip?.vip_level}</span>
|
|
|
+ <span>VIP{vip_level}</span>
|
|
|
<span className={"process-bottom-desc"}>
|
|
|
{t("expTips", {
|
|
|
- exp: flatPoint(userVip.vip_score_exp - userVip.vip_exp),
|
|
|
+ exp: flatPoint(vip_score_exp - vip_exp),
|
|
|
})}
|
|
|
</span>
|
|
|
<span>
|
|
|
VIP
|
|
|
- {userVip.vip_next_level}
|
|
|
+ {vip_next_level}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -77,8 +80,30 @@ const VipCard = () => {
|
|
|
};
|
|
|
|
|
|
const WalletCard = () => {
|
|
|
- // const { userMoney } = props;
|
|
|
- const userMoney = useWalletStore((state) => state.wallet);
|
|
|
+ const {
|
|
|
+ score,
|
|
|
+ point,
|
|
|
+ free_score,
|
|
|
+ free_transfer_min,
|
|
|
+ lose_transfer_min,
|
|
|
+ is_point_transfer,
|
|
|
+ is_free_transfer,
|
|
|
+ is_lose_transfer,
|
|
|
+ lose_score,
|
|
|
+ } = useWalletStore((state) => {
|
|
|
+ return {
|
|
|
+ score: state.wallet.score,
|
|
|
+ point: state.wallet.point,
|
|
|
+ free_score: state.wallet.free_score,
|
|
|
+ free_transfer_min: state.wallet.free_transfer_min,
|
|
|
+ lose_transfer_min: state.wallet.lose_transfer_min,
|
|
|
+ is_point_transfer: state.wallet.is_point_transfer,
|
|
|
+ is_free_transfer: state.wallet.is_free_transfer,
|
|
|
+ is_lose_transfer: state.wallet.is_lose_transfer,
|
|
|
+ lose_score: state.wallet.lose_score,
|
|
|
+ };
|
|
|
+ }, shallow);
|
|
|
+
|
|
|
const t = useTranslations("ProfilePage");
|
|
|
const tcdoe = useTranslations();
|
|
|
|
|
@@ -159,19 +184,19 @@ const WalletCard = () => {
|
|
|
</div>
|
|
|
}
|
|
|
>
|
|
|
- {/*现金*/}
|
|
|
- {tipsStatus === WalletEnum.Balance ? <BalanceContent wallet={userMoney} /> : null}
|
|
|
- {/* 彩金*/}
|
|
|
+ {/*/!*现金*!/*/}
|
|
|
+ {tipsStatus === WalletEnum.Balance ? <BalanceContent /> : null}
|
|
|
+ {/*/!* 彩金*!/*/}
|
|
|
{tipsStatus === WalletEnum.Bonus ? (
|
|
|
- <BonusContent wallet={userMoney} handleAcquire={handleAcquire} />
|
|
|
+ <BonusContent handleAcquire={handleAcquire} />
|
|
|
) : null}
|
|
|
- {/* 免费币 */}
|
|
|
+ {/*/!* 免费币 *!/*/}
|
|
|
{tipsStatus === WalletEnum.Free ? (
|
|
|
- <FreeContent wallet={userMoney} handleAcquire={handleAcquire} />
|
|
|
+ <FreeContent handleAcquire={handleAcquire} />
|
|
|
) : null}
|
|
|
- {/* 重玩币 */}
|
|
|
+ {/*/!* 重玩币 *!/*/}
|
|
|
{tipsStatus === WalletEnum.Replay ? (
|
|
|
- <ReplayContent wallet={userMoney} handleAcquire={handleAcquire} />
|
|
|
+ <ReplayContent handleAcquire={handleAcquire} />
|
|
|
) : null}
|
|
|
</TipsModal>
|
|
|
{/* 提现拦截 */}
|
|
@@ -217,7 +242,7 @@ const WalletCard = () => {
|
|
|
</div>
|
|
|
<div className="num">
|
|
|
<span className="uppercase">brl </span>
|
|
|
- <span>{userMoney?.score || 0.0}</span>
|
|
|
+ <span>{score}</span>
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|
|
@@ -226,7 +251,7 @@ const WalletCard = () => {
|
|
|
onClick={() => modalHandler(WalletEnum.Bonus)}
|
|
|
>
|
|
|
<Badge
|
|
|
- content={userMoney?.is_point_transfer ? Badge.dot : null}
|
|
|
+ content={is_point_transfer ? Badge.dot : null}
|
|
|
style={{ right: "10px" }}
|
|
|
>
|
|
|
<div className="wallet-right-icon">
|
|
@@ -240,7 +265,7 @@ const WalletCard = () => {
|
|
|
</div>
|
|
|
<div className="num">
|
|
|
<span className="uppercase">brl </span>
|
|
|
- <span>{userMoney?.point || 0.0}</span>
|
|
|
+ <span>{point || 0.0}</span>
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|
|
@@ -250,8 +275,7 @@ const WalletCard = () => {
|
|
|
>
|
|
|
<Badge
|
|
|
content={
|
|
|
- userMoney.is_free_transfer &&
|
|
|
- userMoney.free_score >= (userMoney?.free_transfer_min || 0)
|
|
|
+ is_free_transfer && free_score >= (free_transfer_min || 0)
|
|
|
? Badge.dot
|
|
|
: null
|
|
|
}
|
|
@@ -268,7 +292,7 @@ const WalletCard = () => {
|
|
|
</div>
|
|
|
<div className="num">
|
|
|
<span className="uppercase">brl </span>
|
|
|
- <span>{userMoney.free_score || 0.0}</span>
|
|
|
+ <span>{free_score || 0.0}</span>
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|
|
@@ -278,8 +302,7 @@ const WalletCard = () => {
|
|
|
>
|
|
|
<Badge
|
|
|
content={
|
|
|
- userMoney.is_lose_transfer &&
|
|
|
- userMoney.lose_score >= (userMoney?.lose_transfer_min || 0)
|
|
|
+ is_lose_transfer && lose_score >= (lose_transfer_min || 0)
|
|
|
? Badge.dot
|
|
|
: null
|
|
|
}
|
|
@@ -297,7 +320,7 @@ const WalletCard = () => {
|
|
|
</div>
|
|
|
<div className="num">
|
|
|
<span className="uppercase">brl </span>
|
|
|
- <span>{userMoney.lose_score || 0.0}</span>
|
|
|
+ <span>{lose_score || 0.0}</span>
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|