From b264af3265e5c78606c1a07a002ee1686b398fbb Mon Sep 17 00:00:00 2001 From: fadeaway Date: Thu, 28 Mar 2024 21:36:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/EnterQueyueBtn/index.tsx | 18 +++++- src/hooks/useUA.ts | 2 +- src/utils/download.ts | 76 +++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 9 deletions(-) diff --git a/src/components/EnterQueyueBtn/index.tsx b/src/components/EnterQueyueBtn/index.tsx index 8ed8bca..61fb39e 100644 --- a/src/components/EnterQueyueBtn/index.tsx +++ b/src/components/EnterQueyueBtn/index.tsx @@ -1,19 +1,31 @@ 'use client'; +import { useState } from 'react'; + import { useRouter } from 'next/navigation'; export default function EnterQueyueBtn() { const router = useRouter(); + const [opening, setOpening] = useState(false); + const handleEnterQueyue = () => { + if (opening) return; + setOpening(true); + const { searchParams } = new URL(window.location.href); + const songId = (searchParams as any)?.get('id'); const result = confirm('离开微信,打开第三方应用'); if (result) { - alert('打开应用无效跳转下载页'); - window.location.href = 'queyue://'; // 打开某手机上的某个app应用 + window.location.href = `queyue://play/${songId}`; // 打开某手机上的某个app应用 setTimeout(function () { + // alert('打开应用无效跳转下载页'); router.push('/download'); - }, 500); + }, 2000); + setOpening(false); + } else { + setOpening(false); } }; + return (