diff --git a/.env.development b/.env.development index 39143b7..fd551ad 100644 --- a/.env.development +++ b/.env.development @@ -1,10 +1,10 @@ ### # @LastEditors: John # @Date: 2024-06-18 10:12:21 - # @LastEditTime: 2024-06-25 14:04:33 + # @LastEditTime: 2024-06-27 15:35:23 # @Author: John ### -VITE_BASE_URL=http://192.168.10.167:5173/ +VITE_BASE_URL= VITE_BASE_API_URL=/dev VITE_PARTICIPATE_CHAIN_ID=97 VITE_PURCHASED_CONTRACT_ADDRESS=0x7aAe4f2CA23482B58D6f9e8d1fBb5e413e7013c8 diff --git a/src/components/Header.tsx b/src/components/Header.tsx index fc89403..7b7426f 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -57,7 +57,7 @@ export default function () {
- {t("红魔NFT")} + {t("红魔股权NFT")} - `${import.meta.env.VITE_BASE_URL}#/?${UrlQueryParamsKey.INVITE_CODE}=${ + `${location.origin}/#/?${UrlQueryParamsKey.INVITE_CODE}=${ userData?.invitationCode || "" }`, [userData] @@ -87,8 +87,6 @@ export default function () { {shortenString(address, 6, 4)} { - const { connector } = getAccount(config); - await disconnect(config, { connector }); loginOut(); }} name="tuichu" @@ -433,7 +431,7 @@ function ReceiveCom({ {tokenName} - {tokenNum} + {tokenNum + toReceive}
{t("待领取")} - {tokenNum + toReceive} + {toReceive}
; + return
{getLevelName(row.level, row.userType)}
; }, }, { diff --git a/src/pages/LevelUp.tsx b/src/pages/LevelUp.tsx index 98a2930..33365d3 100644 --- a/src/pages/LevelUp.tsx +++ b/src/pages/LevelUp.tsx @@ -95,7 +95,12 @@ export default function () {
{t("当前级别")} - {getLevelName(userUpgradeInfo?.level || 0)} + + {getLevelName( + userUpgradeInfo?.level || 0, + userUpgradeInfo?.active + )} +
{ }); } catch (error) { // 用户拒绝签名或者遇到错误,断开链接 - const { connector } = getAccount(config); - await disconnect(config, { connector }); loadingToast.close(); loginOut(); throw new Error("用户拒绝签名或者遇到错误,断开链接"); @@ -127,33 +125,21 @@ export async function signAndLogin(address?: `0x${string}`): Promise { useUserStore.setState((state) => { return { ...state, Token: loginInfoData.data?.token }; }); - - // TODO 判断用户是否绑定关系✔ - const { data } = - await api_query_whether_the_user_is_binding_relationship().send({}); - if ( - typeof data?.data.result == "boolean" && - data?.data.result === false - ) { - const inviteCode = getUrlQueryParam(UrlQueryParamsKey.INVITE_CODE); - if (inviteCode) { - const { data } = await api_binding_invitation_relationship().send({ - data: { - shareCode: inviteCode, - }, - }); - } - } reslove(); loadingToast.close(); } } else { + const inviteCode = getUrlQueryParam(UrlQueryParamsKey.INVITE_CODE); + if (!inviteCode) { + Toast.show({ icon: "fail", content: i18next.t("无效的邀请链接") }); + return loginOut(); + } // 注册 await api_signUp().send({ data: { account: address, publicKey, - shareCode: "", + shareCode: inviteCode, chainType: 2, }, }); @@ -164,7 +150,9 @@ export async function signAndLogin(address?: `0x${string}`): Promise { }); } -export function loginOut() { +export async function loginOut() { + const { connector } = getAccount(config); + await disconnect(config, { connector }); useUserStore.setState((state) => { return { ...state, Address: "", Token: "" }; });