diff --git a/.gitignore b/.gitignore index b7d1578..e330f35 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ # next.js /.next/ /out/ -/html/ +/dist/ *.zip *.rar diff --git a/next.config.mjs b/next.config.mjs index 84977bd..927d961 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,12 +1,7 @@ /** @type {import('next').NextConfig} */ - -const basePath = '/html'; - const nextConfig = { output: 'export', - basePath, - env: { basePath }, - ...(process.env.NODE_ENV === 'production' ? { distDir: 'html' } : {}), + ...(process.env.NODE_ENV === 'production' ? { distDir: 'dist' } : {}), }; export default nextConfig; diff --git a/package.json b/package.json index 44089d4..ed46175 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "rm -rf html & next dev -p 80", - "build": "rm -rf html & next build", + "dev": "rm -rf dist & next dev -p 80", + "build": "rm -rf dist & next build", "start": "next start -p 80", "lint": "eslint src --fix --ext .ts,.tsx,.js,.jsx,.mdx,.md,.json,.mjs --max-warnings 0" }, diff --git a/src/app/page.tsx b/src/app/page.tsx index 00e4920..0e18ce2 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,7 +3,7 @@ import { useRef } from 'react'; import Link from 'next/link'; -// import { useRouter } from 'next/navigation'; +import { useRouter } from 'next/navigation'; import AppLogo from '@/components/AppLogo'; import ImageWithBasePath from '@/components/ImageWithBasePath'; @@ -14,7 +14,7 @@ import { download } from '@/utils/download'; import useUA from '@/hooks/useUA'; export default function Home() { - // const router = useRouter(); + const router = useRouter(); const firstScreenRef = useRef(null); const { inWX } = useUA(); @@ -22,8 +22,7 @@ export default function Home() { if (!inWX) { download(); } else { - // router.push('/download'); - window.location.href = '/html/download.html'; + router.push('/download'); } }; @@ -37,8 +36,7 @@ export default function Home() { {/* 首屏 */}
{/* title */} {!inWX &&

雀乐

} diff --git a/src/components/EnterQueyueBtn/index.tsx b/src/components/EnterQueyueBtn/index.tsx index ece608b..cf31aff 100644 --- a/src/components/EnterQueyueBtn/index.tsx +++ b/src/components/EnterQueyueBtn/index.tsx @@ -2,12 +2,12 @@ import { useState } from 'react'; -// import { useRouter } from 'next/navigation'; +import { useRouter } from 'next/navigation'; import useUA from '@/hooks/useUA'; export default function EnterQueyueBtn() { - // const router = useRouter(); + const router = useRouter(); const [opening, setOpening] = useState(false); const { inWX } = useUA(); @@ -20,10 +20,8 @@ export default function EnterQueyueBtn() { if (result) { window.location.href = `queyue://play/${songId}`; // 打开某手机上的某个app应用 setTimeout(function () { - // alert('打开应用无效跳转下载页'); - // router.push('/download'); - window.location.href = '/html/download.html'; - }, 2000); + router.push('/download'); + }, 500); setOpening(false); } else { setOpening(false); diff --git a/src/components/ImageWithBasePath/index.tsx b/src/components/ImageWithBasePath/index.tsx index ad0c5cf..1ec30b9 100644 --- a/src/components/ImageWithBasePath/index.tsx +++ b/src/components/ImageWithBasePath/index.tsx @@ -1,6 +1,6 @@ import Image from 'next/image'; export default function ImageWithBasePath(props: any) { - const imgSrc = process.env.NODE_ENV === 'development' ? `${process.env.basePath}/${props?.src || ''}` : props?.src; + const imgSrc = props?.src; return {props?.alt}; } diff --git a/src/components/InviteBanner/index.tsx b/src/components/InviteBanner/index.tsx index 87680a9..1048587 100644 --- a/src/components/InviteBanner/index.tsx +++ b/src/components/InviteBanner/index.tsx @@ -1,14 +1,13 @@ 'use client'; -// import { useRouter } from 'next/navigation'; +import { useRouter } from 'next/navigation'; import ImageWithBasePath from '@/components/ImageWithBasePath'; export default function InviteBanner() { - // const router = useRouter(); + const router = useRouter(); const handleClick = () => { - // router.push('/download'); - window.location.href = '/html/index.html'; + router.push('/'); }; return (
{ - // router.push('/download'); - window.location.href = '/html/download.html'; + router.push('/download'); }; return (
diff --git a/src/components/MusicBanner/index.tsx b/src/components/MusicBanner/index.tsx index 90d2536..36d198e 100644 --- a/src/components/MusicBanner/index.tsx +++ b/src/components/MusicBanner/index.tsx @@ -1,14 +1,13 @@ 'use client'; -// import { useRouter } from 'next/navigation'; +import { useRouter } from 'next/navigation'; import ImageWithBasePath from '@/components/ImageWithBasePath'; export default function MusicBanner() { - // const router = useRouter(); + const router = useRouter(); const handleClick = () => { - // router.push('/download'); - window.location.href = '/html/index.html'; + router.push('/'); }; return (
{ - // router.push(`/music?id=${id}`); - window.location.href = `/html/music.html?id=${id}`; + router.push(`/music?id=${id}`); }; // 点击歌曲信息播放歌曲 @@ -31,8 +30,7 @@ export default function SongItem(props: { data: ISong }) { // 点击右侧图标,弹出弹窗(目前先跳转到下载页) const handleBudsClick = () => { - // router.push('/download'); - window.location.href = '/html/download.html'; + router.push('/download'); }; return ( diff --git a/tsconfig.json b/tsconfig.json index 8310551..b41ab02 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,6 @@ { "compilerOptions": { - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -22,20 +18,9 @@ } ], "paths": { - "@/*": [ - "./src/*" - ] + "@/*": ["./src/*"] } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - "html/types/**/*.ts", - "out/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "dist/types/**/*.ts", "out/types/**/*.ts"], + "exclude": ["node_modules"] }