From 3f22fb15308099916bbb02988e7c0cccb8bd8860 Mon Sep 17 00:00:00 2001 From: yezian Date: Thu, 18 Jul 2024 19:20:16 +0800 Subject: [PATCH] =?UTF-8?q?ios=E5=AE=89=E8=A3=85=E6=97=B6=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=BC=B9=E7=AA=97=E6=95=99=E5=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/download/[user_id]/page.jsx | 33 ++++--- app/page.jsx | 14 +++ components/IosInstallStepModal/page.jsx | 111 ++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 10 deletions(-) create mode 100644 components/IosInstallStepModal/page.jsx diff --git a/app/download/[user_id]/page.jsx b/app/download/[user_id]/page.jsx index ff69da6..25c50ab 100644 --- a/app/download/[user_id]/page.jsx +++ b/app/download/[user_id]/page.jsx @@ -6,6 +6,7 @@ import baseRequest from "@/utils/baseRequest"; import { generateSignature } from "@/utils/crypto"; import { Toast } from "antd-mobile"; import copy from "@/utils/copy"; +import IosInstallStepModal from "@/components/IosInstallStepModal/page"; export default function Download({ params }) { const [deviceType, setDeviceType] = useState(""); @@ -66,6 +67,10 @@ export default function Download({ params }) { getData(); }, []); + //ios安装教程Modal是否展示 + const [isIosInstallStepModalVisible, setIsIosInstallStepModalVisible] = + useState(false); + return (
@@ -168,21 +173,29 @@ export default function Download({ params }) {
{deviceType !== "pc" && ( - <> - { + copyInviter(); + if (deviceType === "ios") setIsIosInstallStepModalVisible(true); + const url = deviceType === "ios" ? "itms-services://?action=download-manifest&url=https://filecdn01.tiefen.fun/appdownload/ironfans.plist" - : "https://filecdn01.tiefen.fun/appdownload/ironfans1.4.6.apk" + : "https://filecdn01.tiefen.fun/appdownload/ironfans1.4.6.apk"; + window.location.href = url; + if (deviceType === "ios") { + setIsIosInstallStepModalVisible(true); } - > - 安装 - - + }} + > + 安装 +
)} +
@@ -153,11 +159,15 @@ export default function Home() {
{ + if (deviceType === "ios") setIsIosInstallStepModalVisible(true); const url = deviceType === "ios" ? "itms-services://?action=download-manifest&url=https://filecdn01.tiefen.fun/appdownload/ironfans.plist" : "https://filecdn01.tiefen.fun/appdownload/ironfans1.4.6.apk"; window.location.href = url; + if (deviceType === "ios") { + setIsIosInstallStepModalVisible(true); + } }} > 安装 @@ -176,6 +186,10 @@ export default function Home() { )}
+
); diff --git a/components/IosInstallStepModal/page.jsx b/components/IosInstallStepModal/page.jsx new file mode 100644 index 0000000..d977fc2 --- /dev/null +++ b/components/IosInstallStepModal/page.jsx @@ -0,0 +1,111 @@ +"use client"; + +import React, { useEffect, useState } from "react"; +import { Mask } from "antd-mobile"; +import Link from "next/link"; + +export default function IosInstallStepModal({ isVisible, setIsVisible }) { + const [stepIndex, setStepIndex] = useState(1); + useEffect(() => { + if (!isVisible) { + setStepIndex(1); + return; + } + const timeoutId = setTimeout( + () => + setStepIndex((prev) => { + if (prev === 6) return 1; + return prev + 1; + }), + 3000 + ); + return () => { + clearTimeout(timeoutId); + }; + }, [isVisible, stepIndex]); + + return ( + setIsVisible(false)} + opacity="thick" + > +
+
+ setIsVisible(!isVisible)} + className="absolute right-4 top-4" + viewBox="0 0 1024 1024" + width="20" + height="20" + > + + + +
+

+ 请等待安装完成,然后开始设置 +

+

+ 若安装后无法正常使用,请删除旧版APP +

+

+ 请务必按以下步骤进行设置,详细 + + 安装教程 + +

+
+ +
+ {stepIndex === 1 && ( +

+ 第1步:打开【设置】 +

+ )} + {stepIndex === 2 && ( +

+ 第2步:点击【通用】 +

+ )} + {stepIndex === 3 && ( +

+ 第3步:点击【VPN与设备管理】 +

+ )} + {stepIndex === 4 && ( +

+ 第4步:点击【证书】 +

+ )} + {stepIndex === 5 && ( +

+ 第5步:点击【信任证书】 +

+ )} + {stepIndex === 6 && ( +

+ 第6步:在弹出页点击【信任】 +

+ )} +
+
+
+
+ ); +}