diff --git a/blog.config.js b/blog.config.js
index 2af5e64e..1d6e8e64 100644
--- a/blog.config.js
+++ b/blog.config.js
@@ -432,7 +432,8 @@ const BLOG = {
category: process.env.NEXT_PUBLIC_NOTION_PROPERTY_CATEGORY || 'category',
date: process.env.NEXT_PUBLIC_NOTION_PROPERTY_DATE || 'date',
tags: process.env.NEXT_PUBLIC_NOTION_PROPERTY_TAGS || 'tags',
- icon: process.env.NEXT_PUBLIC_NOTION_PROPERTY_ICON || 'icon'
+ icon: process.env.NEXT_PUBLIC_NOTION_PROPERTY_ICON || 'icon',
+ ext: process.env.NEXT_PUBLIC_NOTION_PROPERTY_EXT || 'ext' // 扩展字段,存放json-string,用于复杂业务
},
// RSS订阅
diff --git a/components/Draggable.js b/components/Draggable.js
index 44d565b8..cf7be63a 100644
--- a/components/Draggable.js
+++ b/components/Draggable.js
@@ -1,10 +1,10 @@
-import { useRef, useEffect, useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
+
/**
* 可拖拽组件
*/
-
-export const Draggable = (props) => {
- const { children } = props
+export const Draggable = props => {
+ const { children, stick } = props
const draggableRef = useRef(null)
const rafRef = useRef(null)
const [moving, setMoving] = useState(false)
@@ -14,8 +14,10 @@ export const Draggable = (props) => {
const draggableElements = document.getElementsByClassName('draggable')
// 标准化鼠标事件对象
- function e(event) { // 定义事件对象标准化函数
- if (!event) { // 兼容IE浏览器
+ function e(event) {
+ // 定义事件对象标准化函数
+ if (!event) {
+ // 兼容IE浏览器
event = window.event
event.target = event.srcElement
event.layerX = event.offsetX
@@ -40,9 +42,10 @@ export const Draggable = (props) => {
document.onmousedown = start
document.ontouchstart = start
- function start (event) { // 按下鼠标时,初始化处理
+ function start(event) {
+ // 按下鼠标时,初始化处理
if (!draggableElements) return
- event = e(event)// 获取标准事件对象
+ event = e(event) // 获取标准事件对象
for (const drag of draggableElements) {
// 判断鼠标点击的区域是否是拖拽框内
@@ -60,19 +63,20 @@ export const Draggable = (props) => {
offsetX = event.mx - currentObj.offsetLeft
offsetY = event.my - currentObj.offsetTop
- document.onmousemove = move// 注册鼠标移动事件处理函数
+ document.onmousemove = move // 注册鼠标移动事件处理函数
document.ontouchmove = move
- document.onmouseup = stop// 注册松开鼠标事件处理函数
+ document.onmouseup = stop // 注册松开鼠标事件处理函数
document.ontouchend = stop
}
}
- function move(event) { // 鼠标移动处理函数
+ function move(event) {
+ // 鼠标移动处理函数
event = e(event)
rafRef.current = requestAnimationFrame(() => updatePosition(event))
}
- const stop = (event) => {
+ const stop = event => {
event = e(event)
document.documentElement.style.overflow = 'auto' // 恢复默认的滚动行为
cancelAnimationFrame(rafRef.current)
@@ -80,7 +84,7 @@ export const Draggable = (props) => {
currentObj = document.ontouchmove = document.ontouchend = document.onmousemove = document.onmouseup = null
}
- const updatePosition = (event) => {
+ const updatePosition = event => {
if (currentObj) {
const left = event.mx - offsetX
const top = event.my - offsetY
@@ -120,15 +124,18 @@ export const Draggable = (props) => {
if (offsetTop < 0) {
drag.firstElementChild.style.top = 0
}
- if (offsetTop > (clientHeight - offsetHeight)) {
+ if (offsetTop > clientHeight - offsetHeight) {
drag.firstElementChild.style.top = clientHeight - offsetHeight + 'px'
}
if (offsetLeft < 0) {
drag.firstElementChild.style.left = 0
}
- if (offsetLeft > (clientWidth - offsetWidth)) {
+ if (offsetLeft > clientWidth - offsetWidth) {
drag.firstElementChild.style.left = clientWidth - offsetWidth + 'px'
}
+ if (stick === 'left') {
+ drag.firstElementChild.style.left = 0 + 'px'
+ }
}
}
@@ -142,9 +149,11 @@ export const Draggable = (props) => {
}
}, [])
- return
- {children}
-
+ return (
+
+ {children}
+
+ )
}
Draggable.defaultProps = { left: 0, top: 0 }
diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js
index 0a96ce1d..fe93146a 100644
--- a/lib/notion/getPageProperties.js
+++ b/lib/notion/getPageProperties.js
@@ -1,6 +1,6 @@
-import { getTextContent, getDateValue } from 'notion-utils'
-import { NotionAPI } from 'notion-client'
import BLOG from '@/blog.config'
+import { NotionAPI } from 'notion-client'
+import { getDateValue, getTextContent } from 'notion-utils'
import formatDate from '../utils/formatDate'
// import { createHash } from 'crypto'
import md5 from 'js-md5'
@@ -49,8 +49,7 @@ export default async function getPageProperties(id, value, schema, authToken, ta
if (rawUsers[i][0][1]) {
const userId = rawUsers[i][0]
const res = await api.getUsers(userId)
- const resValue =
- res?.recordMapWithRoles?.notion_user?.[userId[1]]?.value
+ const resValue = res?.recordMapWithRoles?.notion_user?.[userId[1]]?.value
const user = {
id: resValue?.id,
first_name: resValue?.given_name,
@@ -93,16 +92,17 @@ export default async function getPageProperties(id, value, schema, authToken, ta
properties.pageIcon = mapImgUrl(value?.format?.page_icon, value) ?? ''
properties.pageCover = mapImgUrl(value?.format?.page_cover, value) ?? ''
properties.pageCoverThumbnail = mapImgUrl(value?.format?.page_cover, value, 'block', 'pageCoverThumbnail') ?? ''
-
+ properties.ext = converToJSON(properties?.ext)
properties.content = value.content ?? []
- properties.tagItems = properties?.tags?.map(tag => {
- return { name: tag, color: tagOptions?.find(t => t.value === tag)?.color || 'gray' }
- }) || []
+ properties.tagItems =
+ properties?.tags?.map(tag => {
+ return { name: tag, color: tagOptions?.find(t => t.value === tag)?.color || 'gray' }
+ }) || []
delete properties.content
// 处理URL
if (properties.type === 'Post') {
- properties.slug = (BLOG.POST_URL_PREFIX) ? generateCustomizeUrl(properties) : (properties.slug ?? properties.id)
+ properties.slug = BLOG.POST_URL_PREFIX ? generateCustomizeUrl(properties) : properties.slug ?? properties.id
} else if (properties.type === 'Page') {
properties.slug = properties.slug ?? properties.id
} else if (properties.type === 'Menu' || properties.type === 'SubMenu') {
@@ -122,6 +122,24 @@ export default async function getPageProperties(id, value, schema, authToken, ta
return properties
}
+/**
+ * 字符串转json
+ * @param {*} str
+ * @returns
+ */
+function converToJSON(str) {
+ if (!str) {
+ return {}
+ }
+ // 使用正则表达式去除空格和换行符
+ try {
+ return JSON.parse(str.replace(/\s/g, ''))
+ } catch (error) {
+ console.warn('无效JSON', str)
+ return {}
+ }
+}
+
/**
* 映射用户自定义表头
*/
@@ -164,7 +182,7 @@ function generateCustomizeUrl(postProperties) {
const formatPostCreatedDate = new Date(postProperties?.publishDay)
fullPrefix += String(formatPostCreatedDate.getUTCDate()).padStart(2, 0)
} else if (pattern === '%slug%') {
- fullPrefix += (postProperties.slug ?? postProperties.id)
+ fullPrefix += postProperties.slug ?? postProperties.id
} else if (!pattern.includes('%')) {
fullPrefix += pattern
} else {
@@ -180,5 +198,5 @@ function generateCustomizeUrl(postProperties) {
if (fullPrefix.endsWith('/')) {
fullPrefix = fullPrefix.substring(0, fullPrefix.length - 1) // 去掉尾部部的"/"
}
- return `${fullPrefix}/${(postProperties.slug ?? postProperties.id)}`
+ return `${fullPrefix}/${postProperties.slug ?? postProperties.id}`
}
diff --git a/public/games-external/common/index.htm b/public/games-external/common/index.htm
new file mode 100644
index 00000000..0862930f
--- /dev/null
+++ b/public/games-external/common/index.htm
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+ Full Screen iFrame
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/games-external/crazy/index.htm b/public/games-external/crazy/index.htm
new file mode 100644
index 00000000..02f501d7
--- /dev/null
+++ b/public/games-external/crazy/index.htm
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ Full Screen iFrame
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/js/fullscreen.js b/public/js/fullscreen.js
new file mode 100644
index 00000000..bc4767f7
--- /dev/null
+++ b/public/js/fullscreen.js
@@ -0,0 +1,32 @@
+window.toggleFullScreen = toggleFullScreen
+function toggleFullScreen() {
+ var iframe = document.getElementById('myIframe')
+
+ if (!document.fullscreenElement) {
+ if (iframe.requestFullscreen) {
+ iframe.requestFullscreen()
+ } else if (iframe.mozRequestFullScreen) {
+ /* Firefox */
+ iframe.mozRequestFullScreen()
+ } else if (iframe.webkitRequestFullscreen) {
+ /* Chrome, Safari and Opera */
+ iframe.webkitRequestFullscreen()
+ } else if (iframe.msRequestFullscreen) {
+ /* IE/Edge */
+ iframe.msRequestFullscreen()
+ }
+ } else {
+ if (document.exitFullscreen) {
+ document.exitFullscreen()
+ } else if (document.mozCancelFullScreen) {
+ /* Firefox */
+ document.mozCancelFullScreen()
+ } else if (document.webkitExitFullscreen) {
+ /* Chrome, Safari and Opera */
+ document.webkitExitFullscreen()
+ } else if (document.msExitFullscreen) {
+ /* IE/Edge */
+ document.msExitFullscreen()
+ }
+ }
+}
diff --git a/themes/game/components/Announcement.js b/themes/game/components/Announcement.js
index 088c412e..0e849fc5 100644
--- a/themes/game/components/Announcement.js
+++ b/themes/game/components/Announcement.js
@@ -2,15 +2,24 @@ import dynamic from 'next/dynamic'
const NotionPage = dynamic(() => import('@/components/NotionPage'))
+/**
+ * 公告
+ * @param {*} param0
+ * @returns
+ */
const Announcement = ({ notice, className }) => {
if (notice?.blockMap) {
- return
+ return (
+
+
+ {notice && (
+
+
+
+ )}
+
+
+ )
} else {
return null
}
diff --git a/themes/game/components/BlogListPage.js b/themes/game/components/BlogListPage.js
index 46db49fa..2f59bada 100644
--- a/themes/game/components/BlogListPage.js
+++ b/themes/game/components/BlogListPage.js
@@ -1,9 +1,8 @@
-
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
-import { useRouter } from 'next/router'
import Link from 'next/link'
-import BlogPost from './BlogPost'
+import { useRouter } from 'next/router'
+import { GameListIndexCombine } from './GameListIndexCombine'
export const BlogListPage = props => {
const { page = 1, posts, postCount } = props
@@ -14,37 +13,39 @@ export const BlogListPage = props => {
const showPrev = currentPage > 1
const showNext = currentPage < totalPage && posts?.length > 0
- const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
+ const pagePrefix = router.asPath
+ .split('?')[0]
+ .replace(/\/page\/[1-9]\d*/, '')
+ .replace(/\/$/, '')
return (
-
+
+
+
+
-
- {posts?.map(post => (
-
- ))}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
)
}
diff --git a/themes/game/components/Draggable.js b/themes/game/components/Draggable.js
deleted file mode 100644
index bd80e562..00000000
--- a/themes/game/components/Draggable.js
+++ /dev/null
@@ -1,153 +0,0 @@
-import { useRef, useEffect, useState } from 'react'
-
-/**
- * 可拖拽组件
- */
-export const Draggable = (props) => {
- const { children,stick } = props
- const draggableRef = useRef(null)
- const rafRef = useRef(null)
- const [moving, setMoving] = useState(false)
- let currentObj, offsetX, offsetY
-
- useEffect(() => {
- const draggableElements = document.getElementsByClassName('draggable')
-
- // 标准化鼠标事件对象
- function e(event) { // 定义事件对象标准化函数
- if (!event) { // 兼容IE浏览器
- event = window.event
- event.target = event.srcElement
- event.layerX = event.offsetX
- event.layerY = event.offsetY
- }
- // 移动端
- if (event.type === 'touchstart' || event.type === 'touchmove') {
- event.clientX = event.touches[0].clientX
- event.clientY = event.touches[0].clientY
- }
-
- event.mx = event.pageX || event.clientX + document.body.scrollLeft
- // 计算鼠标指针的x轴距离
- event.my = event.pageY || event.clientY + document.body.scrollTop
- // 计算鼠标指针的y轴距离
-
- return event // 返回标准化的事件对象
- }
-
- // 定义鼠标事件处理函数
- // document.pointerdown = start
- document.onmousedown = start
- document.ontouchstart = start
-
- function start (event) { // 按下鼠标时,初始化处理
- if (!draggableElements) return
- event = e(event)// 获取标准事件对象
-
- for (const drag of draggableElements) {
- // 判断鼠标点击的区域是否是拖拽框内
- if (inDragBox(event, drag)) {
- currentObj = drag.firstElementChild
- }
- }
- if (currentObj) {
- if (event.type === 'touchstart') {
- event.preventDefault() // 阻止默认的滚动行为
- document.documentElement.style.overflow = 'hidden' // 防止页面一起滚动
- }
-
- setMoving(true)
- offsetX = event.mx - currentObj.offsetLeft
- offsetY = event.my - currentObj.offsetTop
-
- document.onmousemove = move// 注册鼠标移动事件处理函数
- document.ontouchmove = move
- document.onmouseup = stop// 注册松开鼠标事件处理函数
- document.ontouchend = stop
- }
- }
-
- function move(event) { // 鼠标移动处理函数
- event = e(event)
- rafRef.current = requestAnimationFrame(() => updatePosition(event))
- }
-
- const stop = (event) => {
- event = e(event)
- document.documentElement.style.overflow = 'auto' // 恢复默认的滚动行为
- cancelAnimationFrame(rafRef.current)
- setMoving(false)
- currentObj = document.ontouchmove = document.ontouchend = document.onmousemove = document.onmouseup = null
- }
-
- const updatePosition = (event) => {
- if (currentObj) {
- const left = event.mx - offsetX
- const top = event.my - offsetY
- currentObj.style.left = left + 'px'
- currentObj.style.top = top + 'px'
- checkInWindow()
- }
- }
-
- /**
- * 鼠标是否在可拖拽区域内
- * @param {*} event
- * @returns
- */
- function inDragBox(event, drag) {
- const { clientX, clientY } = event // 鼠标位置
- const { offsetHeight, offsetWidth, offsetTop, offsetLeft } = drag.firstElementChild // 窗口位置
- const horizontal = clientX > offsetLeft && clientX < offsetLeft + offsetWidth
- const vertical = clientY > offsetTop && clientY < offsetTop + offsetHeight
-
- if (horizontal && vertical) {
- return true
- }
-
- return false
- }
-
- /**
- * 若超出窗口则吸附。
- */
- function checkInWindow() {
- // 检查是否悬浮在窗口内
- for (const drag of draggableElements) {
- // 判断鼠标点击的区域是否是拖拽框内
- const { offsetHeight, offsetWidth, offsetTop, offsetLeft } = drag.firstElementChild
- const { clientHeight, clientWidth } = document.documentElement
- if (offsetTop < 0) {
- drag.firstElementChild.style.top = 0
- }
- if (offsetTop > (clientHeight - offsetHeight)) {
- drag.firstElementChild.style.top = clientHeight - offsetHeight + 'px'
- }
- if (offsetLeft < 0) {
- drag.firstElementChild.style.left = 0
- }
- if (offsetLeft > (clientWidth - offsetWidth)) {
- drag.firstElementChild.style.left = clientWidth - offsetWidth + 'px'
- }
- if(stick==='left'){
- drag.firstElementChild.style.left = 0 + 'px'
- }
- }
- }
-
- window.addEventListener('resize', checkInWindow)
-
- return () => {
- return () => {
- window.removeEventListener('resize', checkInWindow)
- cancelAnimationFrame(rafRef.current)
- }
- }
- }, [])
-
- return
- {children}
-
-}
-
-Draggable.defaultProps = { left: 0, top: 0 }
diff --git a/themes/game/components/Footer.js b/themes/game/components/Footer.js
index a5d44e27..36e68d23 100644
--- a/themes/game/components/Footer.js
+++ b/themes/game/components/Footer.js
@@ -1,8 +1,7 @@
import DarkModeButton from '@/components/DarkModeButton'
-import Vercel from '@/components/Vercel'
import { siteConfig } from '@/lib/config'
-export const Footer = (props) => {
+export const Footer = props => {
const d = new Date()
const currentYear = d.getFullYear()
const { post } = props
@@ -10,20 +9,27 @@ export const Footer = (props) => {
const since = siteConfig('SINCE')
const copyrightDate = parseInt(since) < currentYear ? since + '-' + currentYear : currentYear
- return
+ return (
+
+ )
}
diff --git a/themes/game/components/FullScreen.js b/themes/game/components/FullScreen.js
index 1fcda710..223f740d 100644
--- a/themes/game/components/FullScreen.js
+++ b/themes/game/components/FullScreen.js
@@ -1,7 +1,5 @@
/* eslint-disable @next/next/no-img-element */
-import Image from 'next/image'
-
/**
* 全屏按钮
* @returns
@@ -14,26 +12,20 @@ export default function FullScreen() {
block: 'end',
inline: 'nearest'
})
- // console.log(document?.getElementById('game-wrapper')?.contentWindow)
- document?.getElementById('game-wrapper')?.contentWindow?.toggleFullScreen()
+ document?.getElementById('game-wrapper')?.contentWindow?.toggleFullScreen &&
+ document?.getElementById('game-wrapper')?.contentWindow?.toggleFullScreen()
}
return (
-
+
-
- FullScreen
-
+ FullScreen
)
}
diff --git a/themes/game/components/GameListIndexCombine.js b/themes/game/components/GameListIndexCombine.js
index 2d8f4f91..dd1d4f23 100644
--- a/themes/game/components/GameListIndexCombine.js
+++ b/themes/game/components/GameListIndexCombine.js
@@ -1,27 +1,23 @@
/* eslint-disable @next/next/no-img-element */
import { AdSlot } from '@/components/GoogleAdsense'
-import { deepClone } from '@/lib/utils'
+import { siteConfig } from '@/lib/config'
+import { checkContainHttp, deepClone, sliceUrlFromHttp } from '@/lib/utils'
+import Link from 'next/link'
import { useState } from 'react'
+import CONFIG from '../config'
/**
* 游戏列表
* @returns
*/
-export const GameListIndexCombine = ({ games }) => {
- const gamesClone = deepClone(games)
-
- gamesClone?.sort((a, b) => {
- const orderA = a.order || 999
- const orderB = b.order || 999
-
- return orderA - orderB
- })
+export const GameListIndexCombine = ({ posts }) => {
+ const gamesClone = deepClone(posts)
// 构造一个List
const components = []
// 根据序号随机大小;或根据game.recommend 决定
- const recommend = true
+ const recommend = siteConfig('GAME_INDEX_EXPAND_RECOMMEND', true, CONFIG)
let index = 0
// 无限循环
@@ -40,7 +36,7 @@ export const GameListIndexCombine = ({ games }) => {
// 试图将4合一卡组塞满
while (gamesClone?.length > 0 && groupItems.length < 4) {
const item = gamesClone.shift()
- if (item.recommend) {
+ if (item.tags?.some(t => t === siteConfig('GAME_RECOMMEND_TAG', 'Recommend', CONFIG))) {
components.push()
break
} else {
@@ -122,11 +118,14 @@ const GameItemGroup = ({ items }) => {
* @returns
*/
const GameItem = ({ item, isLargeCard }) => {
- const { id, title, img, video } = item
+ const { title } = item
+ const img = item.pageCoverThumbnail
const [showType, setShowType] = useState('img') // img or video
+ const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}`
+ const video = item?.ext?.video
return (
- {
setShowType('video')
}}
@@ -159,6 +158,6 @@ const GameItem = ({ item, isLargeCard }) => {
src={img}
alt={title}
/>
-
+
)
}
diff --git a/themes/game/components/GameListNormal.js b/themes/game/components/GameListNormal.js
index 9e048c7b..902debde 100644
--- a/themes/game/components/GameListNormal.js
+++ b/themes/game/components/GameListNormal.js
@@ -1,5 +1,7 @@
/* eslint-disable @next/next/no-img-element */
-import { deepClone } from '@/lib/utils'
+import { siteConfig } from '@/lib/config'
+import { checkContainHttp, deepClone, sliceUrlFromHttp } from '@/lib/utils'
+import Link from 'next/link'
import { useState } from 'react'
/**
@@ -38,12 +40,14 @@ export const GameListNormal = ({ games, maxCount = 18 }) => {
* @returns
*/
const GameItem = ({ item }) => {
- const { id, title, img, video } = item
+ const { title, img } = item
const [showType, setShowType] = useState('img') // img or video
+ const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}`
+ const video = item?.ext?.video
return (
- {
setShowType('video')
}}
@@ -64,6 +68,6 @@ const GameItem = ({ item }) => {
)}
-
+
)
}
diff --git a/themes/game/components/GameListRealate.js b/themes/game/components/GameListRealate.js
index f2ed7376..685cb1b0 100644
--- a/themes/game/components/GameListRealate.js
+++ b/themes/game/components/GameListRealate.js
@@ -1,13 +1,15 @@
/* eslint-disable @next/next/no-img-element */
-import { deepClone } from '@/lib/utils'
+import { siteConfig } from '@/lib/config'
+import { checkContainHttp, deepClone, sliceUrlFromHttp } from '@/lib/utils'
+import Link from 'next/link'
import { useState } from 'react'
/**
* 游戏列表- 关联游戏,在详情页展示
* @returns
*/
-export const GameListRelate = ({ games }) => {
- const gamesClone = deepClone(games)
+export const GameListRelate = ({ posts }) => {
+ const gamesClone = deepClone(posts)
// 构造一个List
const components = []
@@ -24,7 +26,7 @@ export const GameListRelate = ({ games }) => {
return (
-
+
{components?.map((ItemComponent, index) => {
return ItemComponent
})}
@@ -38,13 +40,17 @@ export const GameListRelate = ({ games }) => {
* @param {*} param0
* @returns
*/
-const GameItem = ({ item, isLargeCard }) => {
- const { id, title, img, video } = item
+const GameItem = ({ item }) => {
+ const { title } = item
const [showType, setShowType] = useState('img') // img or video
+ const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}`
+
+ const img = item?.pageCoverThumbnail
+ const video = item?.ext?.video
return (
-
{
setShowType('video')
}}
@@ -71,6 +77,6 @@ const GameItem = ({ item, isLargeCard }) => {
src={img}
alt={title}
/>
-
+
)
}
diff --git a/themes/game/components/GameListRecent.js b/themes/game/components/GameListRecent.js
index 582ed439..63fc8f92 100644
--- a/themes/game/components/GameListRecent.js
+++ b/themes/game/components/GameListRecent.js
@@ -1,6 +1,7 @@
/* eslint-disable @next/next/no-img-element */
+import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
-import { deepClone } from '@/lib/utils'
+import { checkContainHttp, deepClone, sliceUrlFromHttp } from '@/lib/utils'
import { useState } from 'react'
/**
@@ -48,12 +49,15 @@ export const GameListRecent = ({ maxCount = 14 }) => {
* @returns
*/
const GameItem = ({ item }) => {
- const { id, title, img, video } = item || {}
+ const { title } = item || {}
const [showType, setShowType] = useState('img') // img or video
+ const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}`
+ const img = item?.pageCoverThumbnail
+ const video = item?.ext?.video
return (
{
setShowType('video')
}}
diff --git a/themes/game/components/Header.js b/themes/game/components/Header.js
index 0e5297a5..8cb6c907 100644
--- a/themes/game/components/Header.js
+++ b/themes/game/components/Header.js
@@ -1,6 +1,6 @@
+import { useGlobal } from '@/lib/global'
import Image from 'next/image'
import Logo from './Logo'
-import { useGlobal } from '@/lib/global'
/**
* 顶栏
@@ -9,22 +9,16 @@ import { useGlobal } from '@/lib/global'
export default function Header() {
const { setSideBarVisible } = useGlobal()
return (
-
-
+
diff --git a/themes/game/components/Logo.js b/themes/game/components/Logo.js
index da416169..251a833f 100644
--- a/themes/game/components/Logo.js
+++ b/themes/game/components/Logo.js
@@ -6,7 +6,7 @@ export default function Logo() {
return (
-
{siteConfig('TITLE')}
+ {siteConfig('TITLE')}
{siteConfig('BIO')}
diff --git a/themes/game/components/MenuList.js b/themes/game/components/MenuList.js
index 83420700..3835ee4d 100644
--- a/themes/game/components/MenuList.js
+++ b/themes/game/components/MenuList.js
@@ -4,9 +4,9 @@ import { useGameGlobal } from '..'
export const MenuList = () => {
const { setSideBarVisible } = useGameGlobal()
return (
-
+
- -
+
-
@@ -14,7 +14,7 @@ export const MenuList = () => {
- -
+
-