72 lines
1.9 KiB
React
72 lines
1.9 KiB
React
|
"use client";
|
|||
|
|
|||
|
import React, { useState, useEffect } from "react";
|
|||
|
import { Dialog, Toast } from "antd-mobile";
|
|||
|
import { checkRole } from "@/utils/auth";
|
|||
|
// import { useRouter } from "next/navigation";
|
|||
|
import baseRequest from "@/utils/baseRequest";
|
|||
|
export default function CheckVip({ children, isVipToPassFun, router }) {
|
|||
|
// const router = useRouter();
|
|||
|
const base = baseRequest();
|
|||
|
useEffect(() => {}, []);
|
|||
|
const handleCheck = () => {
|
|||
|
const isVip = checkRole();
|
|||
|
if (!isVip) {
|
|||
|
const showMobal = Dialog.show({
|
|||
|
title: "是否开通会员",
|
|||
|
content: (
|
|||
|
<div>
|
|||
|
<div>会员可无限制保存图片,查看原图,一次开通永久有效。</div>
|
|||
|
</div>
|
|||
|
),
|
|||
|
bodyStyle: {
|
|||
|
maxHeight: "none",
|
|||
|
width: "80vw",
|
|||
|
position: "fixed",
|
|||
|
top: "200px",
|
|||
|
left: "10vw",
|
|||
|
"--text-color": "#fff",
|
|||
|
color: "#fff",
|
|||
|
},
|
|||
|
// cancelText:"确认",
|
|||
|
// confirmText:"取消",
|
|||
|
style: {
|
|||
|
"--text-color": "#fff",
|
|||
|
},
|
|||
|
closeOnAction: true,
|
|||
|
actions: [
|
|||
|
[
|
|||
|
{
|
|||
|
key: "close",
|
|||
|
text: "取消",
|
|||
|
bold: true,
|
|||
|
style: { color: "#ffffff80" },
|
|||
|
onClick: () => {
|
|||
|
showMobal?.close();
|
|||
|
},
|
|||
|
},
|
|||
|
{
|
|||
|
key: "submit",
|
|||
|
text: "确认",
|
|||
|
style: { color: "#fff" },
|
|||
|
onClick: () => {
|
|||
|
showMobal.close();
|
|||
|
console.log("showMobal", showMobal);
|
|||
|
router.push(
|
|||
|
`/webView/${encodeURIComponent(
|
|||
|
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
|
|||
|
)}`
|
|||
|
);
|
|||
|
},
|
|||
|
},
|
|||
|
],
|
|||
|
],
|
|||
|
});
|
|||
|
return;
|
|||
|
} else {
|
|||
|
isVipToPassFun();
|
|||
|
}
|
|||
|
};
|
|||
|
return <div onClick={handleCheck}>{children}</div>;
|
|||
|
}
|