修复已知bug

This commit is contained in:
tangly1024.com
2024-05-07 17:11:19 +08:00
parent 7b20d37af2
commit a8bf116c83
4 changed files with 51 additions and 30 deletions

View File

@@ -31,7 +31,6 @@ export const siteConfig = (key, defaultVal = null, extendConfig = null) => {
if (global) {
val = global.NOTION_CONFIG?.[key]
siteInfo = global.siteInfo
// console.log('当前变量', key, val)
}
if (!val) {
@@ -56,6 +55,9 @@ export const siteConfig = (key, defaultVal = null, extendConfig = null) => {
if (!val && extendConfig) {
val = extendConfig[key]
}
if (extendConfig) {
console.log('extendConfig', extendConfig[key])
}
// 其次 NOTION没有找到配置则会读取blog.config.js文件
if (!val) {

View File

@@ -1,4 +1,5 @@
import { siteConfig } from '@/lib/config'
import CONFIG from '../config'
import ProductCard from './ProductCard'
import ProductCategories from './ProductCategories'
@@ -9,25 +10,42 @@ import ProductCategories from './ProductCategories'
*/
export default function ProductCenter(props) {
const { allNavPages } = props
const posts = allNavPages.slice(0, parseInt(siteConfig('COMMERCE_HOME_POSTS_COUNT', 9)))
return <div className='w-full my-4 mx-4'>
<div className='w-full text-center text-4xl font-bold'>{siteConfig('COMMERCE_TEXT_CENTER_TITLE', 'Product Center')}</div>
{siteConfig('COMMERCE_TEXT_CENTER_DESCRIPTION') && <div className='w-full text-center text-lg my-3 text-gray-500'>{siteConfig('COMMERCE_TEXT_CENTER_DESCRIPTION')}</div>}
<div className='flex'>
<ProductCategories {...props} />
<div className='w-full p-4 mx-2'>
{/* 文章列表 */}
<div className="grid md:grid-cols-3 grid-cols-2 gap-5">
{posts?.map(post => (
<ProductCard index={posts.indexOf(post)} key={post.id} post={post} />
))}
</div>
</div>
const posts = allNavPages.slice(
0,
parseInt(siteConfig('COMMERCE_HOME_POSTS_COUNT', 9))
)
const COMMERCE_TEXT_CENTER_TITLE = siteConfig(
'COMMERCE_TEXT_CENTER_TITLE',
'Product Center',
CONFIG
)
return (
<div className='w-full my-4 mx-4'>
<div className='w-full text-center text-4xl font-bold'>
{COMMERCE_TEXT_CENTER_TITLE}
</div>
{siteConfig('COMMERCE_TEXT_CENTER_DESCRIPTION') && (
<div className='w-full text-center text-lg my-3 text-gray-500'>
{siteConfig('COMMERCE_TEXT_CENTER_DESCRIPTION')}
</div>
)}
<div className='flex'>
<ProductCategories {...props} />
<div className='w-full p-4 mx-2'>
{/* 文章列表 */}
<div className='grid md:grid-cols-3 grid-cols-2 gap-5'>
{posts?.map(post => (
<ProductCard
index={posts.indexOf(post)}
key={post.id}
post={post}
/>
))}
</div>
</div>
</div>
</div>
)
}

View File

@@ -2,15 +2,15 @@ const CONFIG = {
// 封面大图
COMMERCE_HOME_BANNER_ENABLE: true,
COMMERCE_TEXT_CENTER_TITLE: 'Product Center', //中间产品区块标题
COMMERCE_TEXT_CENTER_TITLE: 'Product Center', // 中间产品区块标题
COMMERCE_TEXT_CENTER_DESCRIPTION:
'The vision of NotionNext is to help you effortlessly and seamlessly build your own website, amplifying the value of your brand.', // 中间产品区块文字描述
COMMERCE_TEXT_CENTER_CATEGORY_TITLE: 'Product Categories', //左侧产品分类标题
COMMERCE_TEXT_CENTER_CATEGORY_TITLE: 'Product Categories', // 左侧产品分类标题
COMMERCE_TEXT_FOOTER_TITLE: 'Contact US', // COMMERCE主题页脚文案标题按Shift+Enter键可以换行
COMMERCE_TEXT_FOOTER_MENU_1: 'Product Center', //COMMERCE主题页脚左侧菜单标题1
COMMERCE_TEXT_FOOTER_MENU_2: 'About US', //COMMERCE主题页脚左侧菜单标题2
COMMERCE_HOME_POSTS_COUNT: 9, //首页展示商品数
COMMERCE_CONTACT_WHATSAPP_SHOW: true, //是否展示whatsapp联系按钮 请配置 CONTACT_WHATSAPP
COMMERCE_CONTACT_TELEGRAM_SHOW: true //联系栏展示telegram按钮 请配置 CONTACT_TELEGRAM
COMMERCE_TEXT_FOOTER_MENU_1: 'Product Center', // COMMERCE主题页脚左侧菜单标题1
COMMERCE_TEXT_FOOTER_MENU_2: 'About US', // COMMERCE主题页脚左侧菜单标题2
COMMERCE_HOME_POSTS_COUNT: 9, // 首页展示商品数
COMMERCE_CONTACT_WHATSAPP_SHOW: true, // 是否展示whatsapp联系按钮 请配置 CONTACT_WHATSAPP
COMMERCE_CONTACT_TELEGRAM_SHOW: true // 联系栏展示telegram按钮 请配置 CONTACT_TELEGRAM
}
export default CONFIG

View File

@@ -256,16 +256,17 @@ const LayoutSlug = props => {
<div className='flex md:flex-row flex-col w-full justify-between py-4'>
<div
id='left-img'
className='w-1/2 flex justify-center items-center border'>
className='md:w-1/2 flex justify-center items-center border'>
<LazyImage
src={headerImage}
className='m-auto w-full h-auto aspect-square object-cover object-center'
/>
</div>
<div id='info-right' className='w-1/2 p-4'>
<div id='info-right' className='md:w-1/2 p-4'>
<div>{post?.title}</div>
<div>{post?.summary}</div>
<div
dangerouslySetInnerHTML={{ __html: post?.summary }}></div>
</div>
</div>
)}