feat: 更新全局布局以整合系列功能及配置项

This commit is contained in:
seahi committed 2026-08-06 12:14:14 +08:00
1 parent a1efd25332
commit 1eb18ef31e
8 files changed
+27 -4

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@ export const load: LayoutServerLoad = async ({ platform }) => {
post: '文章',
page: '页面',
category: '分类',
tag: '标签'
tag: '标签',
series: '系列'
};
let site = {
+1
View File
@@ -41,6 +41,7 @@
<nav>
<a href="/" class={$page.url.pathname === '/' ? 'active' : ''}>首页</a>
<a href="/archive" class={$page.url.pathname.startsWith('/posts') || $page.url.pathname.startsWith('/archive') ? 'active' : ''}>{$page.data.aliases?.post || '文章'}</a>
<a href="/series" class={$page.url.pathname.startsWith('/series') ? 'active' : ''}>{$page.data.aliases?.series || '系列'}</a>
<a href="/about" class={$page.url.pathname.startsWith('/about') ? 'active' : ''}>关于</a>
</nav>
</div>
+2 -1
View File
@@ -7,7 +7,8 @@ export const load: LayoutServerLoad = async ({ locals, platform }) => {
post: '文章',
page: '页面',
category: '分类',
tag: '标签'
tag: '标签',
series: '系列'
};
let site = {
+2 -1
View File
@@ -38,7 +38,7 @@
</div>
<div class="nav-dropdown">
<span class="nav-dropdown-trigger {($page.url.pathname.startsWith('/admin/posts') && $page.url.pathname !== '/admin/posts/new') || $page.url.pathname.startsWith('/admin/pages') && $page.url.pathname !== '/admin/pages/new' || $page.url.pathname.startsWith('/admin/categories') || $page.url.pathname.startsWith('/admin/tags') || $page.url.pathname.startsWith('/admin/files') ? 'active' : ''}">
<span class="nav-dropdown-trigger {($page.url.pathname.startsWith('/admin/posts') && $page.url.pathname !== '/admin/posts/new') || $page.url.pathname.startsWith('/admin/pages') && $page.url.pathname !== '/admin/pages/new' || $page.url.pathname.startsWith('/admin/categories') || $page.url.pathname.startsWith('/admin/tags') || $page.url.pathname.startsWith('/admin/series') || $page.url.pathname.startsWith('/admin/files') ? 'active' : ''}">
管理
</span>
<div class="dropdown-menu">
@@ -46,6 +46,7 @@
<a href="/admin/pages">{$page.data.aliases?.page || '页面'}</a>
<a href="/admin/categories">{$page.data.aliases?.category || '分类'}</a>
<a href="/admin/tags">{$page.data.aliases?.tag || '标签'}</a>
<a href="/admin/series">{$page.data.aliases?.series || '系列'}</a>
<a href="/admin/files">文件</a>
</div>
</div>
+4
View File
@@ -7,6 +7,7 @@ export const load: PageServerLoad = async ({ platform }) => {
let totalWords = 0;
let tagCount = 0;
let categoryCount = 0;
let seriesCount = 0;
let pageCount = 0;
if (db) {
@@ -14,12 +15,14 @@ export const load: PageServerLoad = async ({ platform }) => {
const postResult = await db.prepare('SELECT COUNT(*) as count, SUM(LENGTH(content)) as totalWords FROM posts').first();
const tagResult = await db.prepare('SELECT COUNT(*) as count FROM tags').first();
const categoryResult = await db.prepare('SELECT COUNT(*) as count FROM categories').first();
const seriesResult = await db.prepare('SELECT COUNT(*) as count FROM series').first();
const pageResult = await db.prepare('SELECT COUNT(*) as count FROM pages').first();
postCount = (postResult?.count as number) || 0;
totalWords = (postResult?.totalWords as number) || 0;
tagCount = (tagResult?.count as number) || 0;
categoryCount = (categoryResult?.count as number) || 0;
seriesCount = (seriesResult?.count as number) || 0;
pageCount = (pageResult?.count as number) || 0;
} catch (err) {
console.error('Error fetching admin dashboard stats:', err);
@@ -31,6 +34,7 @@ export const load: PageServerLoad = async ({ platform }) => {
totalWords,
tagCount,
categoryCount,
seriesCount,
pageCount
};
};
+10
View File
@@ -58,6 +58,16 @@
管理{$page.data.aliases?.tag || '标签'} <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" width="1.3em" height="1.3em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="7" y1="17" x2="17" y2="7"></line><polyline points="7 7 17 7 17 17"></polyline></svg>
</a>
</div>
<div class="stat-card">
<div class="stat-body">
<h3>{$page.data.aliases?.series || '系列'}总数</h3>
<div class="number">{data.seriesCount}</div>
</div>
<a href="/admin/series" class="action-link">
管理{$page.data.aliases?.series || '系列'} <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" width="1.3em" height="1.3em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="7" y1="17" x2="17" y2="7"></line><polyline points="7 7 17 7 17 17"></polyline></svg>
</a>
</div>
</div>
</div>
+2 -1
View File
@@ -58,7 +58,8 @@ export const actions: Actions = {
{ key: 'alias.post', value: data.get('alias_post')?.toString() || '文章' },
{ key: 'alias.page', value: data.get('alias_page')?.toString() || '页面' },
{ key: 'alias.category', value: data.get('alias_category')?.toString() || '分类' },
{ key: 'alias.tag', value: data.get('alias_tag')?.toString() || '标签' }
{ key: 'alias.tag', value: data.get('alias_tag')?.toString() || '标签' },
{ key: 'alias.series', value: data.get('alias_series')?.toString() || '系列' }
];
try {
+4
View File
@@ -153,6 +153,10 @@
<label for="alias_tag">标签</label>
<input type="text" id="alias_tag" name="alias_tag" value={data.settings['alias.tag'] || '标签'} required>
</div>
<div class="form-group">
<label for="alias_series">系列</label>
<input type="text" id="alias_series" name="alias_series" value={data.settings['alias.series'] || '系列'} required>
</div>
</div>
<div class="form-actions">