Merge branch 'main' into fix/hexo_404

This commit is contained in:
tangly1024
2025-04-11 22:34:59 +08:00
committed by GitHub
42 changed files with 1455 additions and 1142 deletions

View File

@@ -22,7 +22,7 @@ function SiteInfo({ title }) {
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={siteConfig('BEI_AN_LINK')} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<br />

View File

@@ -215,6 +215,7 @@ const LayoutArchive = props => {
*/
const Layout404 = props => {
const router = useRouter()
const { locale } = useGlobal()
useEffect(() => {
// 延时3秒如果加载失败就返回首页
setTimeout(() => {
@@ -232,7 +233,7 @@ const Layout404 = props => {
<div className='dark:text-gray-200'>
<h2 className='inline-block border-r-2 border-gray-600 mr-2 px-3 py-2 align-top'><i className='mr-2 fas fa-spinner animate-spin' />404</h2>
<div className='inline-block text-left h-32 leading-10 items-center'>
<h2 className='m-0 p-0'>页面无法加载即将返回首页</h2>
<h2 className='m-0 p-0'>{locale.NAV.PAGE_NOT_FOUND_REDIRECT}</h2>
</div>
</div>
</div>

View File

@@ -6,9 +6,11 @@ import NotionPage from '@/components/NotionPage'
import { PWA as initialPWA } from '@/components/PWA'
import ShareBar from '@/components/ShareBar'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import { loadWowJS } from '@/lib/plugins/wow'
import { deepClone, isBrowser, shuffleArray } from '@/lib/utils'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { createContext, useContext, useEffect, useRef, useState } from 'react'
import Announcement from './components/Announcement'
import { ArticleLock } from './components/ArticleLock'
@@ -30,7 +32,6 @@ import SideBarContent from './components/SideBarContent'
import SideBarDrawer from './components/SideBarDrawer'
import CONFIG from './config'
import { Style } from './style'
import { useRouter } from 'next/router'
// const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
@@ -354,6 +355,7 @@ const LayoutSlug = props => {
*/
const Layout404 = props => {
const router = useRouter()
const { locale } = useGlobal()
useEffect(() => {
// 延时3秒如果加载失败就返回首页
setTimeout(() => {
@@ -366,16 +368,21 @@ const Layout404 = props => {
}, 3000)
}, [])
return <>
<div className='md:-mt-20 text-black w-full h-screen text-center justify-center content-center items-center flex flex-col'>
<div className='dark:text-gray-200'>
<h2 className='inline-block border-r-2 border-gray-600 mr-2 px-3 py-2 align-top'><i className='mr-2 fas fa-spinner animate-spin' />404</h2>
<div className='inline-block text-left h-32 leading-10 items-center'>
<h2 className='m-0 p-0'>页面无法加载即将返回首页</h2>
</div>
</div>
return (
<>
<div className='md:-mt-20 text-black w-full h-screen text-center justify-center content-center items-center flex flex-col'>
<div className='dark:text-gray-200'>
<h2 className='inline-block border-r-2 border-gray-600 mr-2 px-3 py-2 align-top'>
<i className='mr-2 fas fa-spinner animate-spin' />
404
</h2>
<div className='inline-block text-left h-32 leading-10 items-center'>
<h2 className='m-0 p-0'>{locale.NAV.PAGE_NOT_FOUND_REDIRECT}</h2>
</div>
</div>
</div>
</>
)
}
/**

View File

@@ -33,7 +33,7 @@ const Footer = ({ siteInfo }) => {
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />{' '}
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={siteConfig('BEI_AN_LINK')} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<BeiAnGongAn />

View File

@@ -438,6 +438,7 @@ const LayoutArchive = props => {
*/
const Layout404 = props => {
const router = useRouter()
const { locale } = useGlobal()
useEffect(() => {
// 延时3秒如果加载失败就返回首页
setTimeout(() => {
@@ -455,7 +456,7 @@ const Layout404 = props => {
<div className='dark:text-gray-200'>
<h2 className='inline-block border-r-2 border-gray-600 mr-2 px-3 py-2 align-top'><i className='mr-2 fas fa-spinner animate-spin' />404</h2>
<div className='inline-block text-left h-32 leading-10 items-center'>
<h2 className='m-0 p-0'>页面无法加载即将返回首页</h2>
<h2 className='m-0 p-0'>{locale.NAV.PAGE_NOT_FOUND_REDIRECT}</h2>
</div>
</div>
</div>

View File

@@ -9,6 +9,7 @@ import SocialButton from './SocialButton'
*/
const Footer = () => {
const BEI_AN = siteConfig('BEI_AN')
const BEI_AN_LINK = siteConfig('BEI_AN_LINK')
const BIO = siteConfig('BIO')
return (
<footer className='relative flex-shrink-0 bg-white dark:bg-[#1a191d] justify-center text-center m-auto w-full leading-6 text-gray-600 dark:text-gray-100 text-sm'>
@@ -46,7 +47,7 @@ const Footer = () => {
{BEI_AN && (
<>
<i className='fas fa-shield-alt' />{' '}
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={BEI_AN_LINK} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
</>

View File

@@ -25,8 +25,12 @@ export const MenuItemDrop = ({ link }) => {
{/* 含子菜单的按钮 */}
{hasSubMenu && (
<>
<div className='cursor-pointer hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest'>
<div className='cursor-pointer hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest relative'>
{link?.icon && <i className={link?.icon} />} {link?.name}
{/* 主菜单下方的安全区域 */}
{show && (
<div className='absolute w-full h-4 -bottom-4 left-0 bg-transparent z-30'></div>
)}
</div>
</>
)}
@@ -34,7 +38,7 @@ export const MenuItemDrop = ({ link }) => {
{hasSubMenu && (
<ul
style={{ backdropFilter: 'blur(3px)' }}
className={`${show ? 'visible opacity-100 top-14' : 'invisible opacity-0 top-20'} drop-shadow-md overflow-hidden rounded-xl bg-white dark:bg-[#1e1e1e] transition-all duration-300 z-20 absolute`}>
className={`${show ? 'visible opacity-100 top-14 pointer-events-auto' : 'invisible opacity-0 top-20 pointer-events-none'} drop-shadow-md overflow-hidden rounded-xl bg-white dark:bg-[#1e1e1e] transition-all duration-300 z-20 absolute`}>
{link.subMenus.map((sLink, index) => {
return (
<li

View File

@@ -29,10 +29,14 @@ export const MenuItemDrop = ({ link }) => {
{hasSubMenu && (
<>
<div className='cursor-pointer menu-link pl-2 pr-4 no-underline tracking-widest pb-1'>
<div className='cursor-pointer menu-link pl-2 pr-4 no-underline tracking-widest pb-1 relative'>
{link?.icon && <i className={link?.icon} />} {link?.name}
<i
className={`px-2 fa fa-angle-down duration-300 ${show ? 'rotate-180' : 'rotate-0'}`}></i>
{/* 主菜单下方的安全区域 */}
{show && (
<div className='absolute w-full h-3 -bottom-1 left-0 bg-transparent z-30'></div>
)}
</div>
</>
)}
@@ -41,7 +45,7 @@ export const MenuItemDrop = ({ link }) => {
{hasSubMenu && (
<ul
style={{ backdropFilter: 'blur(3px)' }}
className={`${show ? 'visible opacity-100 top-12' : 'invisible opacity-0 top-20'} drop-shadow-md overflow-hidden rounded-md text-black dark:text-white bg-white dark:bg-black transition-all duration-300 z-20 absolute block `}>
className={`${show ? 'visible opacity-100 top-12 pointer-events-auto' : 'invisible opacity-0 top-20 pointer-events-none'} drop-shadow-md overflow-hidden rounded-md text-black dark:text-white bg-white dark:bg-black transition-all duration-300 z-20 absolute block `}>
{link.subMenus.map((sLink, index) => {
return (
<li

View File

@@ -52,7 +52,7 @@ export const MenuItemDrop = ({ link }) => {
{/* 子菜单 */}
{hasSubMenu && (
<ul
className={`${show ? 'visible opacity-100 top-14' : 'invisible opacity-0 top-20'} p-1 absolute border bg-white dark:bg-black dark:border-gray-800 transition-all duration-150 z-20 block rounded-lg drop-shadow-lg`}>
className={`${show ? 'visible opacity-100 top-14 pointer-events-auto' : 'invisible opacity-0 top-20 pointer-events-none'} p-1 absolute border bg-white dark:bg-black dark:border-gray-800 transition-all duration-150 z-20 block rounded-lg drop-shadow-lg`}>
{link?.subMenus?.map(sLink => {
return (
<li

View File

@@ -31,7 +31,7 @@ const Footer = ({ title }) => {
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />{' '}
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={siteConfig('BEI_AN_LINK')} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<br />

View File

@@ -28,10 +28,14 @@ export const MenuItemDrop = ({ link }) => {
{hasSubMenu && (
<>
<div className='cursor-pointer menu-link pl-2 pr-4 no-underline tracking-widest pb-1'>
<div className='cursor-pointer menu-link pl-2 pr-4 no-underline tracking-widest pb-1 relative'>
{link?.icon && <i className={link?.icon} />} {link?.name}
<i
className={`px-2 fa fa-angle-down duration-300 ${show ? 'rotate-180' : 'rotate-0'}`}></i>
{/* 主菜单下方的安全区域 */}
{show && (
<div className='absolute w-full h-3 -bottom-1 left-0 bg-transparent z-30'></div>
)}
</div>
</>
)}
@@ -40,7 +44,7 @@ export const MenuItemDrop = ({ link }) => {
{hasSubMenu && (
<ul
style={{ backdropFilter: 'blur(3px)' }}
className={`${show ? 'visible opacity-100 top-12' : 'invisible opacity-0 top-20'} drop-shadow-md overflow-hidden rounded-md bg-white transition-all duration-300 z-20 absolute block `}>
className={`${show ? 'visible opacity-100 top-12 pointer-events-auto' : 'invisible opacity-0 top-20 pointer-events-none'} drop-shadow-md overflow-hidden rounded-md bg-white transition-all duration-300 z-20 absolute block `}>
{link.subMenus.map((sLink, index) => {
return (
<li

View File

@@ -24,7 +24,7 @@ const Footer = ({ title }) => {
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={siteConfig('BEI_AN_LINK')} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<br />

View File

@@ -27,7 +27,7 @@ export const Footer = props => {
{/* <a href="#" className="text-black no-underline hover:underline">Privacy Policy</a> */}
{siteConfig('BEI_AN') && (
<a
href='https://beian.miit.gov.cn/'
href={siteConfig('BEI_AN_LINK')}
className='text-black dark:text-gray-200 no-underline hover:underline ml-4'>
{siteConfig('BEI_AN')}
</a>

View File

@@ -37,7 +37,7 @@ export const MenuItemDrop = ({ link }) => {
{hasSubMenu && (
<ul
style={{ backdropFilter: 'blur(3px)' }}
className={`${show ? 'visible opacity-100 top-14' : 'invisible opacity-0 top-20'} drop-shadow-md overflow-hidden rounded-md text-black dark:text-white bg-white dark:bg-black transition-all duration-300 z-30 absolute block `}>
className={`${show ? 'visible opacity-100 top-14 pointer-events-auto' : 'invisible opacity-0 top-20 pointer-events-none'} drop-shadow-md overflow-hidden rounded-md text-black dark:text-white bg-white dark:bg-black transition-all duration-300 z-30 absolute block `}>
{link.subMenus.map((sLink, index) => {
return (
<li

View File

@@ -37,7 +37,7 @@ const Footer = ({ siteInfo }) => {
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />{' '}
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={siteConfig('BEI_AN_LINK')} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<br />

View File

@@ -24,7 +24,7 @@ const Footer = ({ title }) => {
{siteConfig('BEI_AN') && (
<>
<i className='fas fa-shield-alt' />{' '}
<a href='https://beian.miit.gov.cn/' className='mr-2'>
<a href={siteConfig('BEI_AN_LINK')} className='mr-2'>
{siteConfig('BEI_AN')}
</a>
<br />

View File

@@ -27,7 +27,7 @@ export const Footer = props => {
{/* <a href="#" className="text-black no-underline hover:underline">Privacy Policy</a> */}
{siteConfig('BEI_AN') && (
<a
href='https://beian.miit.gov.cn/'
href={siteConfig('BEI_AN_LINK')}
className='text-black dark:text-gray-200 no-underline hover:underline ml-4'>
{siteConfig('BEI_AN')}
</a>

View File

@@ -25,7 +25,7 @@ export default function NavBar(props) {
const onKeyUp = e => {
if (e.keyCode === 13) {
const search = document.getElementById('simple-search').innerText
const search = document.getElementById('simple-search').value
if (search) {
router.push({ pathname: '/search/' + search })
}

View File

@@ -99,6 +99,15 @@ const SocialButton = () => {
<i className='fab fa-youtube transform hover:scale-125 duration-150' />
</a>
)}
{siteConfig('CONTACT_THREADS') && (
<a
target='_blank'
rel='noreferrer'
title={'threads'}
href={siteConfig('CONTACT_THREADS')}>
<i className='fab fa-threads transform hover:scale-125 duration-150' />
</a>
)}
</div>
</div>
)