diff --git a/components/CheckVip/index.jsx b/components/CheckVip/index.jsx index af5fc22..5b3fd89 100644 --- a/components/CheckVip/index.jsx +++ b/components/CheckVip/index.jsx @@ -1,19 +1,21 @@ "use client"; -import React, { useState, useEffect } from "react"; -import { Dialog, Toast } from "antd-mobile"; -import { checkRole } from "@/utils/auth"; +import React, { useEffect } from "react"; +import { Dialog } from "antd-mobile"; // import { useRouter } from "next/navigation"; import baseRequest from "@/utils/baseRequest"; -import { get } from "@/utils/storeInfo"; +import { save } from "@/utils/storeInfo"; +import { getUserInfo } from "@/api/public"; export default function CheckVip({ children, isVipToPassFun, router }) { - // const router = useRouter(); const base = baseRequest(); useEffect(() => {}, []); - const handleCheck = () => { - const account = get("account"); + const handleCheck = async () => { + //向服务器请求新的账号信息并保存到本地 + const account = await getUserInfo(); + save("account", JSON.stringify(account)); const isVip = account?.is_a_member; + if (!isVip) { const showMobal = Dialog.show({ title: "是否开通会员",