|
|
@ -1,6 +1,6 @@
|
|
|
|
'use client';
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
|
|
import { useRef } from 'react';
|
|
|
|
import { useRef, useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
import Link from 'next/link';
|
|
|
|
import Link from 'next/link';
|
|
|
|
|
|
|
|
|
|
|
@ -17,12 +17,15 @@ export default function Home() {
|
|
|
|
const firstScreenRef = useRef<HTMLDivElement>(null);
|
|
|
|
const firstScreenRef = useRef<HTMLDivElement>(null);
|
|
|
|
const { inWX } = useUA();
|
|
|
|
const { inWX } = useUA();
|
|
|
|
const nav = useNav();
|
|
|
|
const nav = useNav();
|
|
|
|
|
|
|
|
const downloadBtnRef = useRef<HTMLButtonElement>(null);
|
|
|
|
|
|
|
|
|
|
|
|
const handleDownload = () => {
|
|
|
|
const handleDownload = () => {
|
|
|
|
if (!inWX) {
|
|
|
|
if (!inWX) {
|
|
|
|
download();
|
|
|
|
download();
|
|
|
|
} else {
|
|
|
|
} 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' });
|
|
|
|
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 (
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<main className="max-w-screen-sm min-h-screen mx-auto flex flex-col items-center text-white font-normal">
|
|
|
|
<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 />
|
|
|
|
<WXShareBtn />
|
|
|
|
{/* 下载 */}
|
|
|
|
{/* 下载 */}
|
|
|
|
<button
|
|
|
|
<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}
|
|
|
|
onClick={handleDownload}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
下载【雀乐】APP
|
|
|
|
下载【雀乐】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>
|
|
|
|
<button className="w-[283px] h-[48px] flex justify-center" onClick={handleSlideDown}>
|
|
|
|
<button className="w-[283px] h-[48px] flex justify-center" onClick={handleSlideDown}>
|
|
|
|
<ImageWithBasePath
|
|
|
|
<ImageWithBasePath
|
|
|
|