From 86c29a66c17f27c25307b829a0a2e6031b1ae904 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 11 Apr 2022 12:53:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/fukasawa/components/TopNav.js | 12 ++++++---- themes/fukasawa/config_fuka.js | 2 +- themes/hexo/components/HeaderArticle.js | 4 ++-- themes/next/LayoutIndex.js | 2 +- themes/next/components/Header.js | 11 +++++---- themes/next/components/Logo.js | 10 ++++---- themes/next/components/SideAreaLeft.js | 32 ++++++++++++------------- 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/themes/fukasawa/components/TopNav.js b/themes/fukasawa/components/TopNav.js index 4a9f9e21..8f9bf89e 100644 --- a/themes/fukasawa/components/TopNav.js +++ b/themes/fukasawa/components/TopNav.js @@ -2,6 +2,7 @@ import { useState } from 'react' import Collapse from './Collapse' import GroupMenu from './GroupMenu' import Logo from './Logo' +import SearchInput from './SearchInput' /** * 顶部导航 @@ -21,13 +22,14 @@ const TopNav = props => {
{/* 左侧LOGO 标题 */}
- +
@@ -35,8 +37,8 @@ const TopNav = props => { {/* 右侧功能 */}
- 菜单 { isOpen ? : } -
+ 菜单 {isOpen ? : } +
diff --git a/themes/fukasawa/config_fuka.js b/themes/fukasawa/config_fuka.js index 0d7250ca..777ecf18 100644 --- a/themes/fukasawa/config_fuka.js +++ b/themes/fukasawa/config_fuka.js @@ -8,7 +8,7 @@ const FUKA_CONFIG = { MENU_CATEGORY: true, // 显示分类 MENU_TAG: true, // 显示标签 MENU_ARCHIVE: true, // 显示归档 - MENU_SEARCH: true // 显示搜索 + MENU_SEARCH: false // 显示搜索 } export default FUKA_CONFIG diff --git a/themes/hexo/components/HeaderArticle.js b/themes/hexo/components/HeaderArticle.js index ce9b3484..3e91179d 100644 --- a/themes/hexo/components/HeaderArticle.js +++ b/themes/hexo/components/HeaderArticle.js @@ -63,7 +63,7 @@ export default function HeaderArticle({ post, siteInfo }) {
{post.category && <> -
+
{post.category}
@@ -77,7 +77,7 @@ export default function HeaderArticle({ post, siteInfo }) { href={`/archive#${post?.date?.start_date?.substr(0, 7)}`} passHref > - + {locale.COMMON.POST_TIME}: {date} diff --git a/themes/next/LayoutIndex.js b/themes/next/LayoutIndex.js index 970cb18a..b9ff52b6 100644 --- a/themes/next/LayoutIndex.js +++ b/themes/next/LayoutIndex.js @@ -10,7 +10,7 @@ export const LayoutIndex = (props) => { const { latestPosts } = props const rightAreaSlot = CONFIG_NEXT.RIGHT_LATEST_POSTS && return } + headerSlot={CONFIG_NEXT.HOME_BANNER &&
} sideBarSlot={} rightAreaSlot={rightAreaSlot} {...props} diff --git a/themes/next/components/Header.js b/themes/next/components/Header.js index 363dc6c1..2b63ee72 100644 --- a/themes/next/components/Header.js +++ b/themes/next/components/Header.js @@ -11,7 +11,8 @@ let autoScroll = false * * @returns 头图 */ -export default function Header () { +export default function Header(props) { + const { siteInfo } = props const [typed, changeType] = useState() useEffect(() => { if (!typed && window && document.getElementById('typed')) { @@ -71,7 +72,7 @@ export default function Header () { } } - function updateHeaderHeight () { + function updateHeaderHeight() { setTimeout(() => { if (window) { const wrapperElement = document.getElementById('wrapper') @@ -97,11 +98,11 @@ export default function Header () { className="duration-500 md:bg-fixed w-full bg-cover bg-center h-screen bg-black" style={{ backgroundImage: - `linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${CONFIG_NEXT.HOME_BANNER_IMAGE}")` + `linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${siteInfo.pageCover}")` }} >
-
+
{ @@ -109,7 +110,7 @@ export default function Header () { }} className="cursor-pointer w-full text-center py-4 text-5xl absolute bottom-10 text-white" > - +
) diff --git a/themes/next/components/Logo.js b/themes/next/components/Logo.js index 692bd11e..8169b624 100644 --- a/themes/next/components/Logo.js +++ b/themes/next/components/Logo.js @@ -2,12 +2,12 @@ import Link from 'next/link' import React from 'react' const Logo = props => { - const { siteInfo } = props + const { siteInfo, className } = props return -
-
{siteInfo?.title}
-
{siteInfo?.description}
-
+
+
{siteInfo?.title}
+
{siteInfo?.description}
+
} export default Logo diff --git a/themes/next/components/SideAreaLeft.js b/themes/next/components/SideAreaLeft.js index 42cea5bd..2d3a4db5 100644 --- a/themes/next/components/SideAreaLeft.js +++ b/themes/next/components/SideAreaLeft.js @@ -27,22 +27,22 @@ const SideAreaLeft = props => {
{/* 菜单 */}
- +
- +
{CONFIG_NEXT.MENU_SEARCH &&
- +
}
- - + + {showToc && (
- +
)} @@ -52,21 +52,21 @@ const SideAreaLeft = props => {
{postCount}{locale.COMMON.POSTS} - - | {locale.COMMON.VISITORS} - {/* + + | {locale.COMMON.VISITORS} + {/* | {locale.COMMON.VIEWS} */}
- - + + - {slot &&
- {slot} -
} -
+ {slot &&
+ {slot} +
} +
- + } export default SideAreaLeft From cbb1d8a0f495d8fef46211943935018b8fa75615 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 11 Apr 2022 12:59:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B5=E7=A0=81?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/PaginationNumber.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/themes/hexo/components/PaginationNumber.js b/themes/hexo/components/PaginationNumber.js index 48192d47..ede10bd8 100644 --- a/themes/hexo/components/PaginationNumber.js +++ b/themes/hexo/components/PaginationNumber.js @@ -12,7 +12,7 @@ import { useRouter } from 'next/router' const PaginationNumber = ({ page, totalPage }) => { const router = useRouter() const currentPage = +page - const showNext = page !== totalPage + const showNext = page < totalPage const pages = generatePages(page, currentPage, totalPage) return ( @@ -30,9 +30,8 @@ const PaginationNumber = ({ page, totalPage }) => { > @@ -50,9 +49,8 @@ const PaginationNumber = ({ page, totalPage }) => { > From e3ebc004d1a7ee7434bfb7fe059039bc5e2b47cc Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 11 Apr 2022 13:00:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/cache/cache_manager.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/cache/cache_manager.js b/lib/cache/cache_manager.js index 90b697f5..28801255 100644 --- a/lib/cache/cache_manager.js +++ b/lib/cache/cache_manager.js @@ -1,33 +1,33 @@ -import { getCacheFromMemory, setCacheToMemory, delCacheFromMemory } from '@/lib/cache/memory_cache' -// import { getCacheFromFile, setCacheToFile, delCacheFromFile } from './local_file_cache' -const enableCache = true // 生产环境禁用 +import { getCacheFromMemory as getCache, setCacheToMemory as setCache, delCacheFromMemory as delCache } from '@/lib/cache/memory_cache' +// import { getCacheFromFile as getCache, setCacheToFile as setCache, delCacheFromFile as delCache } from './local_file_cache' +const enableCache = true /** * 为减少频繁接口请求,notion数据将被缓存 * @param {*} key * @returns */ -export async function getDataFromCache (key) { +export async function getDataFromCache(key) { if (!enableCache) { return null } - const dataFromCache = await getCacheFromMemory(key) + const dataFromCache = await getCache(key) if (JSON.stringify(dataFromCache) === '[]') { return null } return dataFromCache } -export async function setDataToCache (key, data) { +export async function setDataToCache(key, data) { if (!enableCache || !data) { return } - await setCacheToMemory(key, data) + await setCache(key, data) } -export async function delCacheData (key) { +export async function delCacheData(key) { if (!enableCache) { return } - await delCacheFromMemory(key) + await delCache(key) }