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 (