diff --git a/client/src/components/admin/AdminLayout.vue b/client/src/components/admin/AdminLayout.vue index e05aa0a..6189e28 100644 --- a/client/src/components/admin/AdminLayout.vue +++ b/client/src/components/admin/AdminLayout.vue @@ -38,9 +38,15 @@
  • - - 💻 - 代码片段 + + 🏷️ + 标签管理 + +
  • +
  • + + + 关于页面
  • diff --git a/client/src/pages/admin/About.vue b/client/src/pages/admin/About.vue new file mode 100644 index 0000000..8cad8f0 --- /dev/null +++ b/client/src/pages/admin/About.vue @@ -0,0 +1,245 @@ + + + + + \ No newline at end of file diff --git a/client/src/pages/admin/AboutForm.vue b/client/src/pages/admin/AboutForm.vue new file mode 100644 index 0000000..d31bf26 --- /dev/null +++ b/client/src/pages/admin/AboutForm.vue @@ -0,0 +1,430 @@ + + + + + \ No newline at end of file diff --git a/client/src/router.ts b/client/src/router.ts index a1b61be..e1827b1 100644 --- a/client/src/router.ts +++ b/client/src/router.ts @@ -53,6 +53,11 @@ const routes = [ { path: 'tags/create', name: 'admin-tags-create', component: () => import('./pages/admin/TagForm.vue') }, { path: 'tags/:id/edit', name: 'admin-tags-edit', component: () => import('./pages/admin/TagForm.vue') }, + // 关于页面管理 + { path: 'about', name: 'admin-about', component: () => import('./pages/admin/About.vue') }, + { path: 'about/create', name: 'admin-about-create', component: () => import('./pages/admin/AboutForm.vue') }, + { path: 'about/edit/:id', name: 'admin-about-edit', component: () => import('./pages/admin/AboutForm.vue') }, + // 系统配置 { path: 'settings', name: 'admin-settings', component: () => import('./pages/admin/Settings.vue') }, diff --git a/client/src/services/api.ts b/client/src/services/api.ts index cfcb0b4..f6a566b 100644 --- a/client/src/services/api.ts +++ b/client/src/services/api.ts @@ -891,3 +891,69 @@ export const fetchAboutProfile = async (): Promise => { throw error } } + +export const getAdminAboutProfiles = async (): Promise => { + try { + const response = await fetch(`${API_BASE}/admin/about`, { + headers: getAuthHeaders() + }) + if (!response.ok) { + const errorData = await response.json() + throw new Error(errorData.error || '获取个人资料列表失败') + } + return await response.json() + } catch (error) { + console.error('Get admin about profiles error:', error) + throw error + } +} + +export const createAboutProfile = async (profileData: Omit): Promise => { + try { + const response = await fetch(`${API_BASE}/admin/about`, { + method: 'POST', + headers: getAuthHeaders(), + body: JSON.stringify(profileData) + }) + if (!response.ok) { + const errorData = await response.json() + throw new Error(errorData.error || '创建个人资料失败') + } + } catch (error) { + console.error('Create about profile error:', error) + throw error + } +} + +export const updateAboutProfile = async (id: number, profileData: Omit): Promise => { + try { + const response = await fetch(`${API_BASE}/admin/about/${id}`, { + method: 'PUT', + headers: getAuthHeaders(), + body: JSON.stringify(profileData) + }) + if (!response.ok) { + const errorData = await response.json() + throw new Error(errorData.error || '更新个人资料失败') + } + } catch (error) { + console.error('Update about profile error:', error) + throw error + } +} + +export const deleteAboutProfile = async (id: number): Promise => { + try { + const response = await fetch(`${API_BASE}/admin/about/${id}`, { + method: 'DELETE', + headers: getAuthHeaders() + }) + if (!response.ok) { + const errorData = await response.json() + throw new Error(errorData.error || '删除个人资料失败') + } + } catch (error) { + console.error('Delete about profile error:', error) + throw error + } +}