feat: 替换img标签支持静态资源打包

style
icefire 2024-10-16 16:45:16 +08:00
parent 77362e3d6b
commit 2f829ba584
6 changed files with 30 additions and 18 deletions

View File

@ -1,6 +1,15 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: 'export' output: 'export',
async redirects() {
return [
{
source: '/',
destination: '/zh/home',
permanent: true,
},
];
},
}; };
export default nextConfig; export default nextConfig;

View File

@ -1,5 +1,3 @@
import Image from "next/image";
export default function Form() { export default function Form() {
return ( return (
@ -27,7 +25,7 @@ export default function Form() {
style={{background: 'linear-gradient(155deg, #A4D5FF 55%, #82B2FF 99%)'}} style={{background: 'linear-gradient(155deg, #A4D5FF 55%, #82B2FF 99%)'}}
> >
<div className="text-[#fff] text-[24px] font-semibold"></div> <div className="text-[#fff] text-[24px] font-semibold"></div>
<Image <img
src="/home/submit_icon.png" src="/home/submit_icon.png"
width={26} width={26}
height={22} height={22}

View File

@ -6,7 +6,7 @@ export async function generateStaticParams() {
import Image from "next/image";
import { getDictionary } from '@/dictionaries'; import { getDictionary } from '@/dictionaries';
import Form from "./components/form"; import Form from "./components/form";
import Header from "@/app/components/header"; import Header from "@/app/components/header";
@ -73,7 +73,7 @@ export default async function Home (props: PropsType) {
</div> </div>
</section> </section>
<div className="w-full h-[428px] relative"> <div className="w-full h-[428px] relative">
<Image <img
src="/home/img_bg2.png" src="/home/img_bg2.png"
width={745} width={745}
height={428} height={428}
@ -85,7 +85,7 @@ export default async function Home (props: PropsType) {
</div> </div>
</div> </div>
<div className="w-full h-[403px] relative"> <div className="w-full h-[403px] relative">
<Image <img
className="absolute right-[0]" className="absolute right-[0]"
src="/home/img_AB.png" src="/home/img_AB.png"
width={787} width={787}
@ -101,7 +101,7 @@ export default async function Home (props: PropsType) {
</div> </div>
</div> </div>
<div className="w-full h-[392px] relative"> <div className="w-full h-[392px] relative">
<Image <img
className="absolute" className="absolute"
src="/home/img_mutilan.png" src="/home/img_mutilan.png"
width={698} width={698}
@ -117,7 +117,7 @@ export default async function Home (props: PropsType) {
</div> </div>
</div> </div>
<div className="w-full h-[317px] relative mt-[83px]"> <div className="w-full h-[317px] relative mt-[83px]">
<Image <img
className="absolute right-[0]" className="absolute right-[0]"
src="/home/img_Omnichannel.png" src="/home/img_Omnichannel.png"
width={742} width={742}
@ -133,7 +133,7 @@ export default async function Home (props: PropsType) {
</div> </div>
</div> </div>
<div className="w-full h-[317px] relative mt-[83px]"> <div className="w-full h-[317px] relative mt-[83px]">
<Image <img
className="absolute" className="absolute"
src="/home/img_3.png" src="/home/img_3.png"
width={881} width={881}
@ -167,7 +167,7 @@ export default async function Home (props: PropsType) {
{ {
caseList.map((item: CaseType, index: number) => { caseList.map((item: CaseType, index: number) => {
return <div key={'key'+index} className="cursor-pointer"> return <div key={'key'+index} className="cursor-pointer">
<Image <img
className="hover:scale-[1.17] hover:shadow-[0px_0px_20px_8px_#0988FF] rounded-[60px] className="hover:scale-[1.17] hover:shadow-[0px_0px_20px_8px_#0988FF] rounded-[60px]
transition ease-in-out duration-300" transition ease-in-out duration-300"
src={item.img} src={item.img}

View File

@ -1,11 +1,11 @@
import Image from "next/image"
export default function Footer(props: {dict: Record<string, string>}) { export default function Footer(props: {dict: Record<string, string>}) {
const { dict } = props const { dict } = props
return ( return (
<footer> <footer>
<div className="flex items-start justify-between w-full px-[304px]"> <div className="flex items-start justify-between w-full px-[304px]">
<div className=" w-[166px] flex flex-col items-center mb-[15px]"> <div className=" w-[166px] flex flex-col items-center mb-[15px]">
<Image <img
className="mb-[16px]" className="mb-[16px]"
src="/home/qrcode.png" src="/home/qrcode.png"
width={151} width={151}

View File

@ -1,5 +1,4 @@
'use client' 'use client'
import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { useState } from "react"; import { useState } from "react";
@ -16,14 +15,14 @@ function SplitButton(props: {dict: Record<string, string>, lang: string}) {
<div className="flex items-center w-[129px] h-[28px] bg-[#EEF1F6] <div className="flex items-center w-[129px] h-[28px] bg-[#EEF1F6]
border-[1px] border-[#eeeeee] rounded-[3px] px-[10px] mt-[18px] cursor-pointer" border-[1px] border-[#eeeeee] rounded-[3px] px-[10px] mt-[18px] cursor-pointer"
onClick={() => setShow(!show)}> onClick={() => setShow(!show)}>
<Image <img
src="/common/earth.png" src="/common/earth.png"
width={16.5} width={16.5}
height={16.5} height={16.5}
alt="logo" alt="logo"
/> />
<div className="flex-1 text-[14px] text-[#333333] mx-[9px]">{ dict?.lang }</div> <div className="flex-1 text-[14px] text-[#333333] mx-[9px]">{ dict?.lang }</div>
<Image <img
src="/common/arrow.png" src="/common/arrow.png"
width={10} width={10}
height={5} height={5}
@ -65,7 +64,7 @@ export default function Header(props: {dict: Record<string, string>, lang: strin
] ]
return (<> return (<>
<div className={"flex items-center px-[20px] h-[80px]"}> <div className={"flex items-center px-[20px] h-[80px]"}>
<Image <img
src="/common/logo.png" src="/common/logo.png"
width={180} width={180}
height={47} height={47}
@ -79,7 +78,7 @@ export default function Header(props: {dict: Record<string, string>, lang: strin
<div className="my-[10px] w-[144px] text-[18px]">{ item.name }</div> <div className="my-[10px] w-[144px] text-[18px]">{ item.name }</div>
{ {
activeTab === item.name ? activeTab === item.name ?
<Image src="/common/tab_checked.png" width={144} height={8} alt="" /> : <img src="/common/tab_checked.png" width={144} height={8} alt="" /> :
<div className="h-[8px]"></div> <div className="h-[8px]"></div>
} }
</div> </div>

View File

@ -20,6 +20,12 @@ export const metadata: Metadata = {
}; };
function RootLayout({ children }:{ children: ReactNode } ): ReactElement { function RootLayout({ children }:{ children: ReactNode } ): ReactElement {
// const languages = navigator.languages;
// if(languages[0] === 'zh-CN') {
// redirect('/zh/home')
// } else {
// redirect('/en/home')
// }
return ( return (
<html lang="en"> <html lang="en">
<body <body