feat: 管理端专家管理完整CRUD(新增创建和删除)
CI / 后端测试 (push) Has been cancelled
CI / 前端构建 (push) Has been cancelled

后端:
- ExpertStore.create_expert: 创建专家(含bcrypt密码哈希)
- ExpertStore.delete_expert: 级联删除(咨询+服务关系+专家)
- POST /admin/experts: 创建专家API
- DELETE /admin/experts/{id}: 删除专家API

前端:
- AdminExperts页面加"新增专家"按钮和创建弹窗
- 创建弹窗含姓名/手机号/密码/分类/职称/简介/专长
- 每个专家卡片加删除按钮,二次确认后删除
- api.ts加adminCreateExpert和adminDeleteExpert方法

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-31 15:53:45 +08:00
co-authored by Devin
parent 17533278da
commit 978d9eeb2b
4 changed files with 292 additions and 2 deletions
+9
View File
@@ -291,6 +291,15 @@ export const api = {
// ===== 管理后台 =====
adminListExperts: (status?: string) =>
request<{ results: Expert[] }>(`/admin/experts${status ? `?status=${status}` : ''}`),
adminCreateExpert: (data: {
name: string; phone: string; password: string; category: string;
title?: string; bio?: string; expertise?: string; avatar_url?: string | null;
status?: string;
}) => request<{ created: boolean; expert: Expert }>('/admin/experts', {
method: 'POST', body: JSON.stringify(data),
}),
adminDeleteExpert: (expertId: number) =>
request<{ deleted: boolean; expert_id: number }>(`/admin/experts/${expertId}`, { method: 'DELETE' }),
adminUpdateExpertStatus: (expertId: number, status: 'active' | 'inactive') =>
request<{ updated: boolean; expert_id: number; status: string }>(`/admin/experts/${expertId}/status`, {
method: 'PATCH', body: JSON.stringify({ status }),