feat: 管理端专家管理完整CRUD(新增创建和删除)
后端:
- 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:
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user