From 97821d9dee53908fa60dea1ac70160ada189c880 Mon Sep 17 00:00:00 2001 From: yezian Date: Fri, 27 Dec 2024 00:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=85=E5=80=BC=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E5=90=8E=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0cookie?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CheckVip/index.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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: "是否开通会员",