diff --git a/components/WithAuth/index.js b/components/WithAuth/index.js index 0144c3f..146a613 100644 --- a/components/WithAuth/index.js +++ b/components/WithAuth/index.js @@ -6,11 +6,23 @@ import { Toast } from "antd-mobile"; import { save } from "@/utils/storeInfo"; import { removeUserInfo } from "@/utils/storeInfo"; import { Dialog } from "antd-mobile"; +import clipboard from "copy-to-clipboard"; export default function WithAuth(WrappedComponent) { const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); + + //保存内容到剪贴板 + const copy = (_data) => { + clipboard(_data); + Toast.show({ + icon: "success", + content: "已复制到剪贴板,请前往Safari打开", + position: "top", + }); + }; + useEffect(() => { const ua = navigator.userAgent.toLowerCase(); if ( @@ -20,8 +32,17 @@ export default function WithAuth(WrappedComponent) { // 夸克浏览器 Dialog.show({ title: "提示", - content: "暂时不支持此浏览器,请使用Safari访问铁粉空间!", - // buttonText: "确认", + actions: [ + { + key: "redirect", + text: "复制网址", + onClick: () => { + const currentUrl = window.location.href; + copy(currentUrl); + }, + }, + ], + content: "暂时不支持此浏览器,请使用Safari访问!", bodyStyle: { maxHeight: "none", width: "80vw", @@ -31,8 +52,6 @@ export default function WithAuth(WrappedComponent) { "--text-color": "#fff", color: "#fff", }, - // cancelText:"确认", - // confirmText:"取消", style: { "--text-color": "#fff", },