实现对话记录页并对齐工作台三栏布局
完善会话列表筛选与摘要字段、归档接口;对话记录按效果图重构;工作台顶栏等高对齐;默认管理员账号改为 kefu_admin / kefu_admin123。
This commit is contained in:
+28
-2
@@ -8,10 +8,17 @@ export interface Session {
|
||||
status: string; priority: string; unread_count: number; satisfaction_score: number | null
|
||||
last_message?: string; last_message_at?: string | null
|
||||
satisfaction_text?: string
|
||||
end_reason?: string
|
||||
visitor_ip?: string
|
||||
visitor_region?: string
|
||||
user_agent?: string
|
||||
created_at: string; ended_at: string | null
|
||||
/** 列表接口补全字段 */
|
||||
message_count?: number
|
||||
customer_name?: string
|
||||
agent_name?: string
|
||||
channel_name?: string
|
||||
channel_type?: string
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
@@ -88,10 +95,25 @@ export interface StatisticsKpis {
|
||||
export const login = (params: LoginParams) => post<LoginResult>('/login', params)
|
||||
|
||||
// Sessions
|
||||
export const getSessions = (params?: { status?: string; priority?: string; page?: number; pageSize?: number }) => {
|
||||
export const getSessions = (params?: {
|
||||
status?: string
|
||||
priority?: string
|
||||
agent_id?: number | string
|
||||
channel_id?: number | string
|
||||
search?: string
|
||||
from?: string
|
||||
to?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}) => {
|
||||
const search = new URLSearchParams()
|
||||
if (params?.status) search.set('status', params.status)
|
||||
if (params?.priority) search.set('priority', params.priority)
|
||||
if (params?.agent_id != null && params.agent_id !== '') search.set('agent_id', String(params.agent_id))
|
||||
if (params?.channel_id != null && params.channel_id !== '') search.set('channel_id', String(params.channel_id))
|
||||
if (params?.search) search.set('search', params.search)
|
||||
if (params?.from) search.set('from', params.from)
|
||||
if (params?.to) search.set('to', params.to)
|
||||
if (params?.page) search.set('page', String(params.page))
|
||||
if (params?.pageSize) search.set('pageSize', String(params.pageSize))
|
||||
return getList<Session>(`/sessions?${search}`)
|
||||
@@ -101,11 +123,15 @@ export const assignSession = (id: number, agentId: number) => post(`/sessions/${
|
||||
export const claimSession = (id: number) => post(`/sessions/${id}/assign`, {})
|
||||
export const transferSession = (id: number, agentId: number) => post(`/sessions/${id}/transfer`, { agent_id: agentId })
|
||||
export const endSession = (id: number, reason: string) => post(`/sessions/${id}/end?reason=${reason}`, {})
|
||||
export const archiveSession = (id: number) => post<{ message: string; session: Session }>(`/sessions/${id}/archive`, {})
|
||||
export const batchArchiveSessions = (ids: number[]) => post<{ message: string; count: number }>('/sessions/batch-archive', { ids })
|
||||
export const updateSessionPriority = (id: number, priority: 'normal' | 'urgent') => put(`/sessions/${id}/priority?priority=${priority}`, {})
|
||||
export const markSessionRead = (id: number) => post(`/sessions/${id}/read`, {})
|
||||
export const addSessionNote = (id: number, content: string) => post<SessionEvent>(`/sessions/${id}/notes`, { content })
|
||||
export const sendSessionMessage = (id: number, content: string, type: 'text' | 'image' = 'text') => post<Message>(`/sessions/${id}/messages`, { content, type })
|
||||
export const getAvailableAgents = () => get<AvailableAgent[]>('/agents/available')
|
||||
/** onlineOnly 默认 true;传 false 返回全部坐席(对话记录筛选) */
|
||||
export const getAvailableAgents = (onlineOnly = true) =>
|
||||
get<AvailableAgent[]>(`/agents/available${onlineOnly ? '' : '?all=1'}`)
|
||||
|
||||
export interface UploadImageResult {
|
||||
url: string
|
||||
|
||||
Reference in New Issue
Block a user