Browse Source

feat(layout): 集成百度统计脚本并优化组件结构- 添加百度统计异步脚本到页面头部
- 引入 ChatWidget 和 Script 组件- 注释掉未使用的 ChatWidget 组件调用- 更新图像域名配置以支持本地开发环境
- 将 MainTitle 中的 p 标签替换为 div 标签以解决样式问题

nahida 7 months ago
parent
commit
f11277f661
3 changed files with 24 additions and 5 deletions
  1. 6 0
      next.config.ts
  2. 13 1
      src/app/layout.tsx
  3. 5 4
      src/components/MainTitle.tsx

+ 6 - 0
next.config.ts

@@ -10,6 +10,12 @@ const nextConfig: NextConfig = {
         port: '8040',
         pathname: '/**',
       },
+      {
+        protocol: 'http',
+        hostname: '47.107.107.47',
+        port: '8040',
+        pathname: '/**',
+      },
     ],
   }
 };

+ 13 - 1
src/app/layout.tsx

@@ -4,6 +4,7 @@ import {AntdRegistry} from "@ant-design/nextjs-registry";
 import '@ant-design/v5-patch-for-react-19';
 import HeaderBlock from "@/components/headerBlock";
 import FooterBlock from "@/components/footerBlock";
+import Script from "next/script";
 
 export const metadata: Metadata = {
   title: "中科盛阳信息技术有限公司",
@@ -18,16 +19,27 @@ export default function RootLayout({
 }: Readonly<{
   children: React.ReactNode;
 }>) {
-  console.log(123);
   return (
     <html lang="en">
     <body>
     <AntdRegistry>
       <HeaderBlock/>
       {children}
+      {/*<ChatWidget/>*/}
       <FooterBlock/>
     </AntdRegistry>
     </body>
+    <Script id="baidu-tongji">
+      {`
+        var _hmt = _hmt || [];
+        (function() {
+          var hm = document.createElement("script");
+          hm.src = "https://hm.baidu.com/hm.js?4ef580994251660ce8c45997f722da54";
+          var s = document.getElementsByTagName("script")[0]; 
+          s.parentNode.insertBefore(hm, s);
+        })();
+      `}
+    </Script>
     </html>
   );
 }

+ 5 - 4
src/components/MainTitle.tsx

@@ -13,7 +13,8 @@ export default function MainTitle({ title, titleLetter }: MainTitleProps) {
   return (
     <div className="text-center w-full mx-auto">
       {/* 主标题 */}
-      <p className="relative text-2xl lg:text-[34px] font-extrabold text-[#244D8F] z-10">
+      {/*帮我看看这为什么有34像素的下外边距 margin*/}
+      <div className="relative text-2xl lg:text-[34px] font-extrabold text-[#244D8F] z-10">
         {title}
         <Image
           src="/assets/home/13.png"
@@ -22,12 +23,12 @@ export default function MainTitle({ title, titleLetter }: MainTitleProps) {
           height={20}
           className="absolute w-10 -top-1.5 inline-block"
         />
-      </p>
+      </div>
 
       {/* 副标题 */}
-      <p className="text-base lg:text-2xl text-[#1652B4] opacity-15 font-bold z-0 -translate-y-5 tracking-tight">
+      <div className="text-base lg:text-2xl text-[#1652B4] opacity-15 font-bold z-0 -translate-y-5 tracking-tight">
         {(titleLetter?.toUpperCase())}
-      </p>
+      </div>
     </div>
   )
 }