|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useRef } from 'react';
|
|
|
|
|
import { useRef, useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
import Link from 'next/link';
|
|
|
|
|
|
|
|
|
@ -17,12 +17,15 @@ export default function Home() {
|
|
|
|
|
const firstScreenRef = useRef<HTMLDivElement>(null);
|
|
|
|
|
const { inWX } = useUA();
|
|
|
|
|
const nav = useNav();
|
|
|
|
|
const downloadBtnRef = useRef<HTMLButtonElement>(null);
|
|
|
|
|
|
|
|
|
|
const handleDownload = () => {
|
|
|
|
|
if (!inWX) {
|
|
|
|
|
download();
|
|
|
|
|
} else {
|
|
|
|
|
nav.push({ path: '/download' });
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
nav.push({ path: '/download' });
|
|
|
|
|
}, 1500);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -30,6 +33,21 @@ export default function Home() {
|
|
|
|
|
window.scrollTo({ top: firstScreenRef?.current?.offsetHeight, behavior: 'smooth' });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const handleLaunch = () => {
|
|
|
|
|
console.log('success');
|
|
|
|
|
};
|
|
|
|
|
const handleError = (e: any) => {
|
|
|
|
|
console.log('fail', e.detail);
|
|
|
|
|
};
|
|
|
|
|
downloadBtnRef.current?.addEventListener('launch', handleLaunch);
|
|
|
|
|
downloadBtnRef.current?.addEventListener('error', handleError);
|
|
|
|
|
return () => {
|
|
|
|
|
downloadBtnRef.current?.removeEventListener('launch', handleLaunch);
|
|
|
|
|
downloadBtnRef.current?.removeEventListener('error', handleError);
|
|
|
|
|
};
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<main className="max-w-screen-sm min-h-screen mx-auto flex flex-col items-center text-white font-normal">
|
|
|
|
@ -49,10 +67,21 @@ export default function Home() {
|
|
|
|
|
<WXShareBtn />
|
|
|
|
|
{/* 下载 */}
|
|
|
|
|
<button
|
|
|
|
|
className="w-[283px] h-[48px] flex items-center justify-center bg-[#C43737] font-medium text-[17px] rounded-full mb-[16px]"
|
|
|
|
|
ref={downloadBtnRef}
|
|
|
|
|
className="relative w-[283px] h-[48px] flex items-center justify-center bg-[#C43737] font-medium text-[17px] rounded-full mb-[16px]"
|
|
|
|
|
onClick={handleDownload}
|
|
|
|
|
>
|
|
|
|
|
下载【雀乐】APP
|
|
|
|
|
<wx-open-launch-app
|
|
|
|
|
id="launch-btn"
|
|
|
|
|
appid="wxae6fb76efa147314"
|
|
|
|
|
extinfo="your-extinfo"
|
|
|
|
|
style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}
|
|
|
|
|
>
|
|
|
|
|
<script type="text/wxtag-template">
|
|
|
|
|
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', opacity: 0 }} />
|
|
|
|
|
</script>
|
|
|
|
|
</wx-open-launch-app>
|
|
|
|
|
</button>
|
|
|
|
|
<button className="w-[283px] h-[48px] flex justify-center" onClick={handleSlideDown}>
|
|
|
|
|
<ImageWithBasePath
|
|
|
|
|