feat(settings): 系统设置界面重构与设计规范对齐(分组侧边栏、响应式宽屏卡片与表单美化)

This commit is contained in:
yml2213
2026-08-31 17:29:14 +08:00
parent ce4b11566a
commit ba3b1534f8
+332 -175
View File
@@ -130,17 +130,46 @@ const statusLabel: Record<string, { text: string; className: string }> = {
disabled: { text: '已禁用', className: 'bg-red-50 text-red-600' }, disabled: { text: '已禁用', className: 'bg-red-50 text-red-600' },
} }
const tabItems: { key: string; label: string; desc: string; icon: ReactNode }[] = [ export interface TabItem {
key: string
label: string
desc: string
icon: ReactNode
}
export interface TabGroup {
groupName: string
items: TabItem[]
}
const tabGroups: TabGroup[] = [
{
groupName: '企业与渠道',
items: [
{ key: 'basic', label: '基本设置', desc: '租户展示名称、默认昵称与时区', icon: <SettingOutlined /> }, { key: 'basic', label: '基本设置', desc: '租户展示名称、默认昵称与时区', icon: <SettingOutlined /> },
{ key: 'channels', label: '渠道管理', desc: '配置客户服务接入渠道与嵌入代码', icon: <ApiOutlined /> }, { key: 'channels', label: '渠道管理', desc: '配置客户服务接入渠道与嵌入代码', icon: <ApiOutlined /> },
{ key: 'staff', label: '坐席账号', desc: '管理客服/主管账号与坐席配额', icon: <UserSwitchOutlined /> }, { key: 'staff', label: '坐席账号', desc: '管理客服/主管账号与坐席配额', icon: <UserSwitchOutlined /> },
],
},
{
groupName: '规则与路由',
items: [
{ key: 'assignment', label: '客服分配规则', desc: '自动分配策略与并发上限', icon: <TeamOutlined /> }, { key: 'assignment', label: '客服分配规则', desc: '自动分配策略与并发上限', icon: <TeamOutlined /> },
{ key: 'tags', label: '客户标签', desc: '维护标签库,坐席为客户打标时选择', icon: <TagsOutlined /> }, { key: 'tags', label: '客户标签', desc: '维护标签库,坐席为客户打标时选择', icon: <TagsOutlined /> },
{ key: 'autoreply', label: '自动回复', desc: '多段欢迎语(含图片)与离线留言提示', icon: <MessageOutlined /> },
{ key: 'worktime', label: '工作时间', desc: '在线服务时段与非工作时间提示', icon: <ClockCircleOutlined /> }, { key: 'worktime', label: '工作时间', desc: '在线服务时段与非工作时间提示', icon: <ClockCircleOutlined /> },
],
},
{
groupName: '自动化与通知',
items: [
{ key: 'autoreply', label: '自动回复', desc: '多段欢迎语(含图片)与离线留言提示', icon: <MessageOutlined /> },
{ key: 'notify', label: '通知设置', desc: '新会话、留言与日报偏好', icon: <BellOutlined /> }, { key: 'notify', label: '通知设置', desc: '新会话、留言与日报偏好', icon: <BellOutlined /> },
],
},
] ]
const tabItems: TabItem[] = tabGroups.flatMap(g => g.items)
const Settings = () => { const Settings = () => {
const { user } = useAuth() const { user } = useAuth()
const isAdmin = usePermission('settings.basic') const isAdmin = usePermission('settings.basic')
@@ -415,19 +444,26 @@ const Settings = () => {
</Button> </Button>
) : null ) : null
const currentGroup = tabGroups.find(g => g.items.some(i => i.key === activeTab))
return ( return (
<div className="h-full flex min-h-0 overflow-hidden bg-slate-50/60"> <div className="h-full flex min-h-0 overflow-hidden bg-slate-50/60">
{/* 左侧设置导航 — 顶栏 56px */} {/* 左侧设置导航 — 顶栏 56px */}
<aside className="w-[210px] shrink-0 flex flex-col bg-white border-r border-slate-200/80"> <aside className="w-[230px] shrink-0 flex flex-col bg-white border-r border-slate-200/80">
<div <div
className="shrink-0 px-4 flex flex-col justify-center border-b border-slate-100" className="shrink-0 px-4 flex flex-col justify-center border-b border-slate-100"
style={{ height: 'var(--header-height)' }} style={{ height: 'var(--header-height)' }}
> >
<div className="text-xs font-bold text-slate-900 leading-tight">系统设置</div> <div className="text-xs font-bold text-slate-900 leading-tight">系统设置</div>
<div className="text-[10px] text-slate-400 truncate leading-tight mt-0.5 font-medium">配置与渠道接入</div> <div className="text-[10px] text-slate-400 truncate leading-tight mt-0.5 font-medium">企业配置与业务规则</div>
</div> </div>
<nav className="flex-1 overflow-y-auto p-2 space-y-0.5"> <nav className="flex-1 overflow-y-auto p-3 space-y-4">
{tabItems.map(item => { {tabGroups.map(group => (
<div key={group.groupName} className="space-y-1">
<div className="text-[10px] font-bold text-slate-400 uppercase tracking-wider px-2.5 mb-1 select-none">
{group.groupName}
</div>
{group.items.map(item => {
const active = activeTab === item.key const active = activeTab === item.key
return ( return (
<button <button
@@ -436,17 +472,19 @@ const Settings = () => {
onClick={() => setActiveTab(item.key)} onClick={() => setActiveTab(item.key)}
className={`w-full flex items-center gap-2.5 px-3 py-2 rounded-xl text-xs text-left border-0 cursor-pointer transition-all ${ className={`w-full flex items-center gap-2.5 px-3 py-2 rounded-xl text-xs text-left border-0 cursor-pointer transition-all ${
active active
? 'bg-blue-50/80 text-blue-600 font-semibold shadow-2xs' ? 'bg-blue-50/90 text-blue-600 font-semibold shadow-2xs'
: 'bg-transparent text-slate-600 hover:bg-slate-50 hover:text-slate-900' : 'bg-transparent text-slate-600 hover:bg-slate-50 hover:text-slate-900'
}`} }`}
> >
<span className={`text-sm leading-none ${active ? 'text-blue-600' : 'text-slate-400'}`}> <span className={`text-sm leading-none shrink-0 ${active ? 'text-blue-600' : 'text-slate-400'}`}>
{item.icon} {item.icon}
</span> </span>
<span className="truncate">{item.label}</span> <span className="truncate flex-1">{item.label}</span>
</button> </button>
) )
})} })}
</div>
))}
</nav> </nav>
</aside> </aside>
@@ -457,8 +495,14 @@ const Settings = () => {
style={{ height: 'var(--header-height)' }} style={{ height: 'var(--header-height)' }}
> >
<div className="min-w-0"> <div className="min-w-0">
<h1 className="text-sm font-bold text-slate-900 m-0 truncate">{currentTab.label}</h1> <div className="flex items-center gap-1.5 text-[11px] text-slate-400 font-medium leading-none mb-1">
<p className="text-[11px] text-slate-400 m-0 leading-tight">{currentTab.desc}</p> <span>系统设置</span>
<span>/</span>
<span className="text-slate-600">{currentGroup?.groupName || '配置'}</span>
<span>/</span>
<span className="text-blue-600 font-semibold">{currentTab.label}</span>
</div>
<p className="text-xs text-slate-500 m-0 leading-tight truncate">{currentTab.desc}</p>
</div> </div>
{panelHeaderAction} {panelHeaderAction}
{activeTab === 'staff' && isAdmin && ( {activeTab === 'staff' && isAdmin && (
@@ -475,14 +519,12 @@ const Settings = () => {
)} )}
</div> </div>
<div className="flex-1 overflow-auto px-6 py-5"> <div className="flex-1 overflow-auto p-6 md:p-8">
<div className={activeTab === 'staff' ? 'max-w-4xl' : 'max-w-3xl'}> <div className="max-w-5xl mx-auto w-full">
<p className="text-xs text-neutral-400 mt-0 mb-5">{currentTab.desc}</p>
{activeTab === 'basic' && ( {activeTab === 'basic' && (
<div className="bg-white rounded-xl border border-neutral-200 shadow-sm p-6"> <div className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-6 md:p-8">
{loadingSettings && !settings ? ( {loadingSettings && !settings ? (
<div className="py-10 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : ( ) : (
<Form <Form
form={basicForm} form={basicForm}
@@ -493,26 +535,71 @@ const Settings = () => {
timezone: values.timezone, timezone: values.timezone,
})} })}
> >
<Form.Item name="display_name" label="租户名称" rules={[{ required: true }, { min: 1, max: 100 }]}> <div className="mb-6 pb-5 border-b border-slate-100">
<Input placeholder="公司名称 / 访客端展示名" /> <h3 className="text-sm font-bold text-slate-900 m-0 mb-1">企业展示档案</h3>
<p className="text-xs text-slate-400 m-0">配置访客端看到的租户品牌名称与在线客服默认身份</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-5 mb-2">
<Form.Item
name="display_name"
label={<span className="text-xs font-semibold text-slate-700">租户名称</span>}
rules={[{ required: true, message: '请输入租户名称' }, { min: 1, max: 100 }]}
extra={<span className="text-[11px] text-slate-400">公司或品牌名称,展示于访客端聊天窗口顶部</span>}
>
<Input placeholder="公司名称 / 访客端展示名" className="!rounded-lg" />
</Form.Item> </Form.Item>
<Form.Item name="agent_nickname" label="客服默认昵称">
<Input placeholder="客服在访客端显示的昵称" maxLength={50} /> <Form.Item
name="agent_nickname"
label={<span className="text-xs font-semibold text-slate-700">客服默认昵称</span>}
extra={<span className="text-[11px] text-slate-400">未设置个人独立昵称的坐席将默认以此名称展示</span>}
>
<Input placeholder="客服在访客端显示的昵称" maxLength={50} className="!rounded-lg" />
</Form.Item> </Form.Item>
<Form.Item name="timezone" label="时区"> </div>
<Select options={[
{ value: 'Asia/Shanghai', label: '东八区 (UTC+8)' }, <div className="mt-8 mb-6 pb-5 border-b border-slate-100">
<h3 className="text-sm font-bold text-slate-900 m-0 mb-1">区域与本地化</h3>
<p className="text-xs text-slate-400 m-0">定义系统的标准服务时区与工作台界面语言</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-5 mb-8">
<Form.Item
name="timezone"
label={<span className="text-xs font-semibold text-slate-700">服务时区</span>}
extra={<span className="text-[11px] text-slate-400">影响营业时间判断、会话统计与历史报表生成</span>}
>
<Select
className="!rounded-lg"
options={[
{ value: 'Asia/Shanghai', label: '东八区 (北京/上海 UTC+8)' },
{ value: 'Asia/Tokyo', label: '东京 (UTC+9)' }, { value: 'Asia/Tokyo', label: '东京 (UTC+9)' },
{ value: 'UTC', label: 'UTC' }, { value: 'UTC', label: 'UTC 标准时间' },
]} ]}
/> />
</Form.Item> </Form.Item>
<Form.Item name="language" label="语言">
<Select options={[{ value: 'zh-CN', label: '简体中文' }]} disabled /> <Form.Item
</Form.Item> name="language"
<Form.Item className="!mb-0"> label={<span className="text-xs font-semibold text-slate-700">系统语言</span>}
<Button type="primary" htmlType="submit" loading={saving}>保存设置</Button> extra={<span className="text-[11px] text-slate-400">当前默认简体中文(多语言包支持中)</span>}
>
<Select options={[{ value: 'zh-CN', label: '简体中文 (Simplified Chinese)' }]} disabled />
</Form.Item> </Form.Item>
</div>
<div className="pt-5 border-t border-slate-100 flex items-center justify-between">
<span className="text-xs text-slate-400">配置保存后将实时对访客端与坐席工作台生效</span>
<Button
type="primary"
htmlType="submit"
loading={saving}
className="!h-9 !px-6 !rounded-xl !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
>
保存基本设置
</Button>
</div>
</Form> </Form>
)} )}
</div> </div>
@@ -523,34 +610,40 @@ const Settings = () => {
{loadingChannels ? ( {loadingChannels ? (
<div className="py-16 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : channels.length === 0 ? ( ) : channels.length === 0 ? (
<div className="bg-white rounded-xl border border-neutral-200 p-10"> <div className="bg-white rounded-2xl border border-slate-200/80 p-12 text-center shadow-xs">
<Empty description="暂无渠道,请先开通网页渠道"> <Empty description="暂无渠道,请先开通网页渠道">
<Button type="primary" onClick={ensureWebChannel}>开通网页渠道</Button> <Button
type="primary"
onClick={ensureWebChannel}
className="!h-9 !px-5 !rounded-xl !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
>
开通网页渠道
</Button>
</Empty> </Empty>
</div> </div>
) : ( ) : (
<div className="flex flex-col gap-3"> <div className="flex flex-col gap-4">
{channels.map(ch => { {channels.map(ch => {
const meta = typeMeta[ch.type] || { icon: <LinkOutlined />, label: ch.name || ch.type, desc: '' } const meta = typeMeta[ch.type] || { icon: <LinkOutlined />, label: ch.name || ch.type, desc: '' }
const enabled = ch.status === 'enabled' const enabled = ch.status === 'enabled'
return ( return (
<div <div
key={ch.id} key={ch.id}
className="bg-white rounded-xl border border-neutral-200 shadow-sm p-4" className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-5 transition-all hover:border-slate-300"
> >
<div className="flex items-start gap-4"> <div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-[#eff6ff] text-[#2563eb] flex items-center justify-center text-lg shrink-0"> <div className="w-11 h-11 rounded-xl bg-blue-50 text-blue-600 flex items-center justify-center text-xl shrink-0 border border-blue-100">
{meta.icon} {meta.icon}
</div> </div>
<div className="flex-1 min-w-0"> <div className="flex-1 min-w-0">
<div className="flex items-center justify-between gap-3 mb-1"> <div className="flex items-center justify-between gap-3 mb-1">
<div className="flex items-center gap-2 min-w-0"> <div className="flex items-center gap-2.5 min-w-0">
<h3 className="text-sm font-medium text-neutral-900 m-0 truncate"> <h3 className="text-sm font-bold text-slate-900 m-0 truncate">
{ch.name || meta.label} {ch.name || meta.label}
</h3> </h3>
<span <span
className={`inline-flex items-center rounded px-2 py-0.5 text-[11px] font-medium whitespace-nowrap ${ className={`inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-medium whitespace-nowrap ${
enabled ? 'bg-[#f0fdf4] text-[#16a34a]' : 'bg-neutral-100 text-neutral-500' enabled ? 'bg-emerald-50 text-emerald-700 border border-emerald-100' : 'bg-slate-100 text-slate-500'
}`} }`}
> >
{enabled ? '已启用' : '未启用'} {enabled ? '已启用' : '未启用'}
@@ -564,21 +657,21 @@ const Settings = () => {
/> />
</div> </div>
{meta.desc && ( {meta.desc && (
<p className="text-xs text-neutral-400 m-0 mb-3">{meta.desc}</p> <p className="text-xs text-slate-400 m-0 mb-3">{meta.desc}</p>
)} )}
{ch.channel_key && ( {ch.channel_key && (
<div className="flex items-center gap-2 text-xs mb-2"> <div className="flex items-center gap-2 text-xs mb-2">
<span className="text-neutral-400">渠道 ID</span> <span className="text-slate-400 font-medium">渠道 ID</span>
<code className="bg-neutral-100 text-neutral-600 px-2 py-0.5 rounded"> <code className="bg-slate-100 text-slate-700 px-2 py-0.5 rounded-md font-mono text-[11px]">
{ch.channel_key} {ch.channel_key}
</code> </code>
</div> </div>
)} )}
{ch.type === 'web' && ch.script_code && ( {ch.type === 'web' && ch.script_code && (
<div className="mt-2"> <div className="mt-3">
<div className="text-xs text-neutral-400 mb-1">接入代码</div> <div className="text-xs font-semibold text-slate-600 mb-1.5">网站嵌入代码</div>
<div className="bg-neutral-50 border border-neutral-200 rounded-lg p-2.5 flex items-start justify-between gap-2"> <div className="bg-slate-50 border border-slate-200/80 rounded-xl p-3 flex items-start justify-between gap-3">
<code className="text-[11px] text-neutral-600 break-all leading-relaxed"> <code className="text-[11px] text-slate-600 break-all leading-relaxed font-mono">
{ch.script_code.replace( {ch.script_code.replace(
'src="/widget.js"', 'src="/widget.js"',
`src="${window.location.origin}/widget.js"`, `src="${window.location.origin}/widget.js"`,
@@ -586,8 +679,8 @@ const Settings = () => {
</code> </code>
<button <button
type="button" type="button"
className="shrink-0 w-7 h-7 rounded-md flex items-center justify-center text-neutral-400 hover:text-[#2563eb] hover:bg-blue-50 border-0 bg-transparent cursor-pointer" className="shrink-0 w-8 h-8 rounded-lg flex items-center justify-center text-slate-400 hover:text-blue-600 hover:bg-blue-50 border border-slate-200 bg-white cursor-pointer transition-colors shadow-2xs"
title="复制" title="复制代码"
onClick={() => copyScript(ch.script_code)} onClick={() => copyScript(ch.script_code)}
> >
<CopyOutlined /> <CopyOutlined />
@@ -596,7 +689,7 @@ const Settings = () => {
</div> </div>
)} )}
{ch.type !== 'web' && ( {ch.type !== 'web' && (
<div className="text-xs text-neutral-400 mt-1"> <div className="text-xs text-slate-400 mt-1">
本期仅网页渠道可完整接入,其他类型预留开关。 本期仅网页渠道可完整接入,其他类型预留开关。
</div> </div>
)} )}
@@ -609,11 +702,11 @@ const Settings = () => {
)} )}
{missingTypes.length > 0 && channels.length > 0 && ( {missingTypes.length > 0 && channels.length > 0 && (
<div className="mt-5"> <div className="mt-6 bg-white rounded-2xl border border-slate-200/80 p-5 shadow-xs">
<div className="text-xs text-neutral-400 mb-2">可添加渠道类型</div> <div className="text-xs font-bold text-slate-700 mb-3">可添加其他渠道</div>
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2.5">
{missingTypes.map(t => ( {missingTypes.map(t => (
<Button key={t} size="small" icon={<PlusOutlined />} onClick={() => addChannelType(t)}> <Button key={t} size="small" icon={<PlusOutlined />} className="!rounded-lg !text-xs !h-8" onClick={() => addChannelType(t)}>
{typeMeta[t].label} {typeMeta[t].label}
</Button> </Button>
))} ))}
@@ -624,27 +717,27 @@ const Settings = () => {
)} )}
{activeTab === 'assignment' && ( {activeTab === 'assignment' && (
<div className="space-y-4"> <div className="space-y-5">
{loadingSettings ? ( {loadingSettings ? (
<div className="py-16 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : ( ) : (
<> <>
<div className="bg-white rounded-xl border border-[#dbeafe] shadow-sm p-5"> <div className="bg-blue-50/50 rounded-2xl border border-blue-100 p-5">
<div className="flex items-start gap-3"> <div className="flex items-start gap-3.5">
<div className="w-9 h-9 rounded-lg bg-[#eff6ff] text-[#2563eb] flex items-center justify-center shrink-0"> <div className="w-10 h-10 rounded-xl bg-blue-100 text-blue-600 flex items-center justify-center shrink-0 text-lg">
<TeamOutlined /> <TeamOutlined />
</div> </div>
<div className="min-w-0"> <div className="min-w-0">
<div className="text-sm font-medium text-neutral-800">自动分配规则</div> <div className="text-sm font-bold text-slate-900">自动分配规则</div>
<div className="text-xs text-neutral-500 mt-1.5 leading-relaxed"> <div className="text-xs text-slate-600 mt-1 leading-relaxed">
工作时间内,访客进线会按下列策略分配给<strong className="font-medium text-neutral-700">在线一线客服</strong>; 工作时间内,访客进线会按下列策略自动分配给<strong className="font-semibold text-blue-700">在线一线客服</strong>;
非工作时间或无可接坐席时进入排队/留言。人工领取与转接不受此策略限制。 非工作时间或无可接坐席时进入排队或离线留言。人工领取与内部转接不受此策略限制。
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className="bg-white rounded-xl border border-neutral-200 shadow-sm p-5"> <div className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-6 md:p-8">
<Form <Form
form={assignForm} form={assignForm}
layout="vertical" layout="vertical"
@@ -661,20 +754,21 @@ const Settings = () => {
> >
<Form.Item <Form.Item
name="assign_strategy" name="assign_strategy"
label="分配策略" label={<span className="text-xs font-semibold text-slate-700">分配策略</span>}
rules={[{ required: true, message: '请选择策略' }]} rules={[{ required: true, message: '请选择策略' }]}
extra="负载最低:优先进行中会话更少的坐席;轮询:在可接坐席中依次分配,更均匀。" extra={<span className="text-[11px] text-slate-400">负载最低:优先分配给进行中会话最少的坐席;轮询:在可接坐席中均匀依次分发。</span>}
> >
<Select <Select
className="!rounded-lg"
options={[ options={[
{ value: 'least_load', label: '负载最低(推荐)' }, { value: 'least_load', label: '负载最低策略(推荐)' },
{ value: 'round_robin', label: '轮询分配' }, { value: 'round_robin', label: '轮询轮转分配策略' },
]} ]}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="max_active_per_agent" name="max_active_per_agent"
label="每位坐席最大进行中会话数" label={<span className="text-xs font-semibold text-slate-700">每位坐席最大并发会话数</span>}
rules={[ rules={[
{ required: true, message: '请填写上限' }, { required: true, message: '请填写上限' },
{ {
@@ -686,24 +780,32 @@ const Settings = () => {
}, },
}, },
]} ]}
extra="达到上限的坐席不再自动分入新会话;全部坐席已满时会话保持排队。0 = 不限制。" extra={<span className="text-[11px] text-slate-400">达到上限后不再自动接入新访客,全部坐席满载时访客将进入等待队列。0 表示不限上限。</span>}
> >
<Input type="number" min={0} max={200} placeholder="0 表示不限制" /> <Input type="number" min={0} max={200} placeholder="0 表示不限制" className="!rounded-lg" />
</Form.Item> </Form.Item>
<div className="pt-4 border-t border-slate-100 flex items-center justify-between">
{isAdmin ? ( {isAdmin ? (
<Button type="primary" htmlType="submit" loading={saving}> <Button
type="primary"
htmlType="submit"
loading={saving}
className="!h-9 !px-6 !rounded-xl !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
>
保存分配规则 保存分配规则
</Button> </Button>
) : ( ) : (
<p className="text-xs text-neutral-400 m-0">仅租户管理员可修改分配规则</p> <p className="text-xs text-slate-400 m-0">仅租户管理员可修改分配规则</p>
)} )}
</div>
</Form> </Form>
</div> </div>
<div className="bg-neutral-50 rounded-xl border border-neutral-200 p-4 text-xs text-neutral-500 leading-relaxed space-y-1"> <div className="bg-slate-50/80 rounded-2xl border border-slate-200/80 p-4 text-xs text-slate-500 leading-relaxed space-y-1">
<div className="font-medium text-neutral-700 mb-1">说明</div> <div className="font-bold text-slate-700 mb-1">使用说明</div>
<p className="m-0">· 候选范围:角色为客服、状态为「在线」的账号(忙碌/离线不参与自动分配)。</p> <p className="m-0">· 自动分发候选范围:角色为客服、当前状态为「在线」的账号(忙碌/离线状态不参与自动分发)。</p>
<p className="m-0">· 技能组 / 渠道专属坐席将在后续版本支持。</p> <p className="m-0">· 专属坐席组与渠道绑定策略将在后续版本逐步上线。</p>
</div> </div>
</> </>
)} )}
@@ -713,40 +815,40 @@ const Settings = () => {
{activeTab === 'staff' && ( {activeTab === 'staff' && (
<div> <div>
{!canViewStaff ? ( {!canViewStaff ? (
<div className="bg-white rounded-xl border border-neutral-200 p-8 text-center text-sm text-neutral-500"> <div className="bg-white rounded-2xl border border-slate-200/80 p-8 text-center text-sm text-slate-500 shadow-xs">
仅管理员或主管可查看坐席列表 仅管理员或主管可查看坐席列表
</div> </div>
) : loadingStaff ? ( ) : loadingStaff ? (
<div className="py-16 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : ( ) : (
<> <>
<div className="flex items-center gap-4 mb-4 flex-wrap"> <div className="flex items-center gap-4 mb-5 flex-wrap">
<div className="rounded-xl bg-white border border-neutral-200 px-4 py-3 min-w-[140px]"> <div className="rounded-2xl bg-white border border-slate-200/80 px-5 py-3.5 min-w-[160px] shadow-xs">
<div className="text-[11px] text-neutral-400 mb-0.5">坐席占用</div> <div className="text-[11px] font-medium text-slate-400 mb-0.5">坐席配额占用</div>
<div className="text-lg font-semibold text-neutral-900 tabular-nums"> <div className="text-xl font-bold text-slate-900 tabular-nums">
{seatUsed} {seatUsed}
<span className="text-sm font-normal text-neutral-400"> / {seatLimit}</span> <span className="text-sm font-normal text-slate-400"> / {seatLimit}</span>
</div> </div>
</div> </div>
<div className="text-xs text-neutral-400 flex-1 min-w-[200px]"> <div className="text-xs text-slate-500 flex-1 min-w-[200px] leading-relaxed">
启用中的管理员、主管、客服各占 1 个坐席。禁用账号释放配额。角色:客服接待会话;主管可看统计与客户;管理员可改系统设置。 启用中的管理员、主管、客服各占 1 个坐席。禁用账号可即刻释放坐席配额。
</div> </div>
</div> </div>
{staffList.length === 0 ? ( {staffList.length === 0 ? (
<Empty description="暂无坐席账号" className="bg-white rounded-xl border border-neutral-200 py-12" /> <Empty description="暂无坐席账号" className="bg-white rounded-2xl border border-slate-200/80 py-12 shadow-xs" />
) : ( ) : (
<div className="rounded-xl border border-neutral-200 bg-white overflow-hidden"> <div className="rounded-2xl border border-slate-200/80 bg-white overflow-hidden shadow-xs">
<table className="w-full border-collapse min-w-[640px]"> <table className="w-full border-collapse min-w-[640px]">
<thead> <thead>
<tr className="bg-neutral-50 text-[11px] font-semibold text-neutral-500"> <tr className="bg-slate-50/80 text-[11px] font-bold text-slate-500">
<th className="text-left px-4 py-2.5 border-b border-neutral-200">账号</th> <th className="text-left px-5 py-3 border-b border-slate-100">账号</th>
<th className="text-left px-4 py-2.5 border-b border-neutral-200">昵称</th> <th className="text-left px-5 py-3 border-b border-slate-100">昵称</th>
<th className="text-left px-4 py-2.5 border-b border-neutral-200">角色</th> <th className="text-left px-5 py-3 border-b border-slate-100">角色</th>
<th className="text-left px-4 py-2.5 border-b border-neutral-200">状态</th> <th className="text-left px-5 py-3 border-b border-slate-100">状态</th>
<th className="text-left px-4 py-2.5 border-b border-neutral-200">创建时间</th> <th className="text-left px-5 py-3 border-b border-slate-100">创建时间</th>
{isAdmin && ( {isAdmin && (
<th className="text-right px-4 py-2.5 border-b border-neutral-200">操作</th> <th className="text-right px-5 py-3 border-b border-slate-100">操作</th>
)} )}
</tr> </tr>
</thead> </thead>
@@ -754,29 +856,29 @@ const Settings = () => {
{staffList.map(s => { {staffList.map(s => {
const st = statusLabel[s.status] || statusLabel.offline const st = statusLabel[s.status] || statusLabel.offline
return ( return (
<tr key={s.id} className="hover:bg-neutral-50 border-t border-neutral-100"> <tr key={s.id} className="hover:bg-slate-50/60 border-t border-slate-100 transition-colors">
<td className="px-4 py-3 text-sm font-medium text-neutral-800">{s.username}</td> <td className="px-5 py-3.5 text-sm font-semibold text-slate-800">{s.username}</td>
<td className="px-4 py-3 text-sm text-neutral-700">{s.nickname || '—'}</td> <td className="px-5 py-3.5 text-sm text-slate-600">{s.nickname || '—'}</td>
<td className="px-4 py-3"> <td className="px-5 py-3.5">
<span className="text-xs px-2 py-0.5 rounded-full bg-neutral-100 text-neutral-600"> <span className="text-xs px-2.5 py-0.5 rounded-full bg-slate-100 text-slate-700 font-medium">
{roleLabel[s.role] || s.role} {roleLabel[s.role] || s.role}
</span> </span>
</td> </td>
<td className="px-4 py-3"> <td className="px-5 py-3.5">
<span className={`text-xs px-2 py-0.5 rounded-full font-medium ${st.className}`}> <span className={`text-xs px-2.5 py-0.5 rounded-full font-medium ${st.className}`}>
{st.text} {st.text}
</span> </span>
</td> </td>
<td className="px-4 py-3 text-xs text-neutral-400 whitespace-nowrap"> <td className="px-5 py-3.5 text-xs text-slate-400 whitespace-nowrap">
{s.created_at ? s.created_at.slice(0, 16) : '—'} {s.created_at ? s.created_at.slice(0, 16) : '—'}
</td> </td>
{isAdmin && ( {isAdmin && (
<td className="px-4 py-3 text-right" onClick={e => e.stopPropagation()}> <td className="px-5 py-3.5 text-right" onClick={e => e.stopPropagation()}>
<div className="inline-flex items-center gap-1"> <div className="inline-flex items-center gap-1.5">
<button <button
type="button" type="button"
title="编辑" title="编辑"
className="w-7 h-7 rounded-md flex items-center justify-center text-neutral-400 hover:text-[#2563eb] hover:bg-blue-50 border-0 bg-transparent cursor-pointer" className="w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-blue-600 hover:bg-blue-50 border border-slate-200/80 bg-white cursor-pointer transition-colors shadow-2xs"
onClick={() => openEditStaff(s)} onClick={() => openEditStaff(s)}
> >
<EditOutlined className="text-xs" /> <EditOutlined className="text-xs" />
@@ -785,7 +887,7 @@ const Settings = () => {
<button <button
type="button" type="button"
title="启用" title="启用"
className="w-7 h-7 rounded-md flex items-center justify-center text-neutral-400 hover:text-emerald-600 hover:bg-emerald-50 border-0 bg-transparent cursor-pointer" className="w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-emerald-600 hover:bg-emerald-50 border border-slate-200/80 bg-white cursor-pointer transition-colors shadow-2xs"
onClick={() => handleEnableStaff(s)} onClick={() => handleEnableStaff(s)}
> >
<CheckCircleOutlined className="text-xs" /> <CheckCircleOutlined className="text-xs" />
@@ -801,7 +903,7 @@ const Settings = () => {
type="button" type="button"
title="禁用" title="禁用"
disabled={s.id === user?.user_id} disabled={s.id === user?.user_id}
className="w-7 h-7 rounded-md flex items-center justify-center text-neutral-400 hover:text-red-500 hover:bg-red-50 border-0 bg-transparent cursor-pointer disabled:opacity-30" className="w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-red-500 hover:bg-red-50 border border-slate-200/80 bg-white cursor-pointer disabled:opacity-30 transition-colors shadow-2xs"
> >
<StopOutlined className="text-xs" /> <StopOutlined className="text-xs" />
</button> </button>
@@ -823,9 +925,9 @@ const Settings = () => {
)} )}
{activeTab === 'autoreply' && ( {activeTab === 'autoreply' && (
<div className="bg-white rounded-xl border border-neutral-200 shadow-sm p-6"> <div className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-6 md:p-8">
{loadingSettings && !settings ? ( {loadingSettings && !settings ? (
<div className="py-10 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : ( ) : (
<Form <Form
form={autoReplyForm} form={autoReplyForm}
@@ -858,13 +960,12 @@ const Settings = () => {
}, '自动回复已保存') }, '自动回复已保存')
}} }}
> >
<div className="mb-5"> <div className="mb-6">
<div className="flex items-center justify-between mb-2"> <div className="flex items-center justify-between mb-3 pb-3 border-b border-slate-100">
<div> <div>
<div className="text-sm font-medium text-neutral-800">欢迎语(多段)</div> <h3 className="text-sm font-bold text-slate-900 m-0 mb-1">欢迎语(多段混合展示)</h3>
<p className="text-xs text-neutral-500 m-0 mt-0.5"> <p className="text-xs text-slate-400 m-0">
访客打开窗口且尚无消息时按顺序展示;可混排富文本与图片,最多 {MAX_WELCOME_SEGMENTS} 段。 访客首次进入聊天窗口时按序自动推送;支持图文混排,最多可添加 {MAX_WELCOME_SEGMENTS} 段。
选中文字可设置<strong className="font-medium text-neutral-600">颜色、字号、加粗</strong>等(仅欢迎语;正常聊天仍为 Markdown)。
</p> </p>
</div> </div>
</div> </div>
@@ -872,11 +973,11 @@ const Settings = () => {
{welcomeSegments.map((seg, idx) => ( {welcomeSegments.map((seg, idx) => (
<div <div
key={idx} key={idx}
className="rounded-lg border border-neutral-200 bg-neutral-50/60 p-3" className="rounded-xl border border-slate-200/80 bg-slate-50/60 p-4 transition-all hover:bg-slate-50"
> >
<div className="flex items-center justify-between gap-2 mb-2"> <div className="flex items-center justify-between gap-2 mb-2.5">
<span className="text-xs font-medium text-neutral-500"> <span className="text-xs font-semibold text-slate-700">
第 {idx + 1} 段 · {seg.type === 'image' ? '图片' : '文本'} 第 {idx + 1} 段 · {seg.type === 'image' ? '图片消息' : '富文本消息'}
</span> </span>
<div className="flex items-center gap-1"> <div className="flex items-center gap-1">
<Button <Button
@@ -884,6 +985,7 @@ const Settings = () => {
size="small" size="small"
icon={<ArrowUpOutlined />} icon={<ArrowUpOutlined />}
disabled={idx === 0} disabled={idx === 0}
className="!rounded-lg"
onClick={() => { onClick={() => {
setWelcomeSegments(prev => { setWelcomeSegments(prev => {
if (idx <= 0) return prev if (idx <= 0) return prev
@@ -898,6 +1000,7 @@ const Settings = () => {
size="small" size="small"
icon={<ArrowDownOutlined />} icon={<ArrowDownOutlined />}
disabled={idx >= welcomeSegments.length - 1} disabled={idx >= welcomeSegments.length - 1}
className="!rounded-lg"
onClick={() => { onClick={() => {
setWelcomeSegments(prev => { setWelcomeSegments(prev => {
if (idx >= prev.length - 1) return prev if (idx >= prev.length - 1) return prev
@@ -913,6 +1016,7 @@ const Settings = () => {
danger danger
icon={<DeleteOutlined />} icon={<DeleteOutlined />}
disabled={welcomeSegments.length <= 1} disabled={welcomeSegments.length <= 1}
className="!rounded-lg"
onClick={() => { onClick={() => {
setWelcomeSegments(prev => prev.filter((_, i) => i !== idx)) setWelcomeSegments(prev => prev.filter((_, i) => i !== idx))
}} }}
@@ -935,10 +1039,10 @@ const Settings = () => {
<img <img
src={seg.content} src={seg.content}
alt={`欢迎图 ${idx + 1}`} alt={`欢迎图 ${idx + 1}`}
className="max-h-28 max-w-[200px] rounded-lg border border-neutral-200 object-contain bg-white" className="max-h-28 max-w-[200px] rounded-xl border border-slate-200 object-contain bg-white shadow-2xs"
/> />
) : ( ) : (
<div className="w-28 h-20 rounded-lg border border-dashed border-neutral-300 flex items-center justify-center text-neutral-400 text-xs bg-white"> <div className="w-28 h-20 rounded-xl border border-dashed border-slate-300 flex items-center justify-center text-slate-400 text-xs bg-white">
未上传 未上传
</div> </div>
)} )}
@@ -969,6 +1073,7 @@ const Settings = () => {
icon={<PictureOutlined />} icon={<PictureOutlined />}
loading={uploadingWelcomeIdx === idx} loading={uploadingWelcomeIdx === idx}
size="small" size="small"
className="!rounded-lg !text-xs !h-8"
> >
{seg.content ? '重新上传' : '上传图片'} {seg.content ? '重新上传' : '上传图片'}
</Button> </Button>
@@ -978,10 +1083,11 @@ const Settings = () => {
</div> </div>
))} ))}
</div> </div>
<div className="flex flex-wrap gap-2 mt-3"> <div className="flex flex-wrap gap-2.5 mt-3.5">
<Button <Button
size="small" size="small"
icon={<PlusOutlined />} icon={<PlusOutlined />}
className="!rounded-lg !text-xs !h-8"
disabled={welcomeSegments.length >= MAX_WELCOME_SEGMENTS} disabled={welcomeSegments.length >= MAX_WELCOME_SEGMENTS}
onClick={() => onClick={() =>
setWelcomeSegments(prev => setWelcomeSegments(prev =>
@@ -991,11 +1097,12 @@ const Settings = () => {
) )
} }
> >
添加文本 添加文本段
</Button> </Button>
<Button <Button
size="small" size="small"
icon={<PictureOutlined />} icon={<PictureOutlined />}
className="!rounded-lg !text-xs !h-8"
disabled={welcomeSegments.length >= MAX_WELCOME_SEGMENTS} disabled={welcomeSegments.length >= MAX_WELCOME_SEGMENTS}
onClick={() => onClick={() =>
setWelcomeSegments(prev => setWelcomeSegments(prev =>
@@ -1005,35 +1112,47 @@ const Settings = () => {
) )
} }
> >
添加图片 添加图片段
</Button> </Button>
</div> </div>
</div> </div>
<div className="mt-8 pt-6 border-t border-slate-100 mb-6">
<Form.Item <Form.Item
name="offline_prompt" name="offline_prompt"
label="离线留言提示" label={<span className="text-xs font-semibold text-slate-700">离线留言提示语</span>}
rules={[{ max: 500 }]} rules={[{ max: 500 }]}
extra="点工具栏设置加粗、列表、链接、表情;可点「预览」查看效果" extra={<span className="text-[11px] text-slate-400">当座席全部离线或在非工作时段进线时向访客展示</span>}
> >
<MarkdownEditor <MarkdownEditor
rows={3} rows={3}
maxLength={500} maxLength={500}
showCount showCount
placeholder="无客服在线时展示…" placeholder="当前无坐席在线,请留下您的联系方式与问题…"
/> />
</Form.Item> </Form.Item>
<Form.Item className="!mb-0"> </div>
<Button type="primary" htmlType="submit" loading={saving}>保存</Button>
</Form.Item> <div className="pt-4 border-t border-slate-100 flex items-center justify-between">
<span className="text-xs text-slate-400">更新自动回复后实时对新访客生效</span>
<Button
type="primary"
htmlType="submit"
loading={saving}
className="!h-9 !px-6 !rounded-xl !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
>
保存自动回复
</Button>
</div>
</Form> </Form>
)} )}
</div> </div>
)} )}
{activeTab === 'worktime' && ( {activeTab === 'worktime' && (
<div className="bg-white rounded-xl border border-neutral-200 shadow-sm p-6"> <div className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-6 md:p-8">
{loadingSettings && !settings ? ( {loadingSettings && !settings ? (
<div className="py-10 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : ( ) : (
<Form <Form
form={workForm} form={workForm}
@@ -1055,13 +1174,17 @@ const Settings = () => {
}, '工作时间已保存') }, '工作时间已保存')
}} }}
> >
<p className="text-sm text-neutral-500 mb-3"> <div className="mb-4">
每天可设为休息、全天或自定义时段(支持跨午夜,如 22:00-06:00)。 <h3 className="text-sm font-bold text-slate-900 m-0 mb-1">营业与服务时间段</h3>
非工作时间访客将看到下方提示并可留言。 <p className="text-xs text-slate-400 m-0">
设定每周工作日在线服务时间;非服务时间系统将向访客展示非工作时间提示。
</p> </p>
<div className="flex flex-wrap gap-2 mb-4"> </div>
<div className="flex flex-wrap gap-2 mb-5">
<Button <Button
size="small" size="small"
className="!rounded-lg !text-xs !h-7.5"
onClick={() => { onClick={() => {
const patch: Record<string, unknown> = {} const patch: Record<string, unknown> = {}
weekDays.forEach((d, i) => { weekDays.forEach((d, i) => {
@@ -1080,6 +1203,7 @@ const Settings = () => {
</Button> </Button>
<Button <Button
size="small" size="small"
className="!rounded-lg !text-xs !h-7.5"
onClick={() => { onClick={() => {
const patch: Record<string, unknown> = {} const patch: Record<string, unknown> = {}
weekDays.forEach(d => { weekDays.forEach(d => {
@@ -1089,10 +1213,11 @@ const Settings = () => {
workForm.setFieldsValue(patch) workForm.setFieldsValue(patch)
}} }}
> >
全部全天 全部全天 24h
</Button> </Button>
<Button <Button
size="small" size="small"
className="!rounded-lg !text-xs !h-7.5"
onClick={() => { onClick={() => {
const patch: Record<string, unknown> = {} const patch: Record<string, unknown> = {}
weekDays.forEach(d => { weekDays.forEach(d => {
@@ -1105,19 +1230,20 @@ const Settings = () => {
全部休息 全部休息
</Button> </Button>
</div> </div>
<div className="rounded-lg border border-neutral-100 overflow-hidden mb-4">
<div className="rounded-xl border border-slate-200/80 overflow-hidden mb-6 bg-white">
{weekDays.map((day, i) => ( {weekDays.map((day, i) => (
<div <div
key={day.key} key={day.key}
className={`flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2.5 ${ className={`flex flex-wrap items-center gap-x-4 gap-y-2 px-5 py-3 ${
i < weekDays.length - 1 ? 'border-b border-neutral-50' : '' i < weekDays.length - 1 ? 'border-b border-slate-100' : ''
}`} }`}
> >
<span className="text-sm text-neutral-700 w-12 shrink-0">{day.label}</span> <span className="text-xs font-bold text-slate-700 w-12 shrink-0">{day.label}</span>
<Form.Item name={`${day.key}_mode`} className="!mb-0" initialValue="rest"> <Form.Item name={`${day.key}_mode`} className="!mb-0" initialValue="rest">
<Select <Select
options={workModeOptions} options={workModeOptions}
className="!w-[120px]" className="!w-[130px]"
size="small" size="small"
onChange={(mode: WorkMode) => { onChange={(mode: WorkMode) => {
if (mode === 'custom' && !workForm.getFieldValue(`${day.key}_range`)) { if (mode === 'custom' && !workForm.getFieldValue(`${day.key}_range`)) {
@@ -1147,16 +1273,16 @@ const Settings = () => {
order={false} order={false}
needConfirm={false} needConfirm={false}
placeholder={['开始', '结束']} placeholder={['开始', '结束']}
className="!w-[200px]" className="!w-[180px] !rounded-lg"
/> />
</Form.Item> </Form.Item>
<div className="flex flex-wrap gap-0.5"> <div className="flex flex-wrap gap-1">
{workRangePresets.map(p => ( {workRangePresets.map(p => (
<Button <Button
key={p.label} key={p.label}
type="link" type="link"
size="small" size="small"
className="!px-1.5 !h-6 text-xs text-neutral-500" className="!px-1.5 !h-6 text-xs text-slate-400 hover:text-blue-600"
onClick={() => { onClick={() => {
workForm.setFieldsValue({ workForm.setFieldsValue({
[`${day.key}_mode`]: 'custom', [`${day.key}_mode`]: 'custom',
@@ -1178,21 +1304,35 @@ const Settings = () => {
</div> </div>
))} ))}
</div> </div>
<Form.Item name="worktime_prompt" label="非工作时间提示" rules={[{ max: 500 }]}>
<Input placeholder="当前为非工作时间,我们会在工作时段尽快回复您" maxLength={500} /> <Form.Item
</Form.Item> name="worktime_prompt"
<Form.Item className="!mb-0"> label={<span className="text-xs font-semibold text-slate-700">非工作时间提示语</span>}
<Button type="primary" htmlType="submit" loading={saving}>保存工作时间</Button> rules={[{ max: 500 }]}
>
<Input placeholder="当前为非工作时间,我们会在工作时段尽快回复您" maxLength={500} className="!rounded-lg" />
</Form.Item> </Form.Item>
<div className="pt-4 border-t border-slate-100 flex items-center justify-between">
<span className="text-xs text-slate-400">时段以系统时区为准</span>
<Button
type="primary"
htmlType="submit"
loading={saving}
className="!h-9 !px-6 !rounded-xl !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
>
保存工作时间
</Button>
</div>
</Form> </Form>
)} )}
</div> </div>
)} )}
{activeTab === 'notify' && ( {activeTab === 'notify' && (
<div className="bg-white rounded-xl border border-neutral-200 shadow-sm p-6"> <div className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-6 md:p-8">
{loadingSettings && !settings ? ( {loadingSettings && !settings ? (
<div className="py-10 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : ( ) : (
<Form <Form
form={notifyForm} form={notifyForm}
@@ -1203,19 +1343,24 @@ const Settings = () => {
notify_daily_report: values.notify_daily_report, notify_daily_report: values.notify_daily_report,
}, '通知设置已保存')} }, '通知设置已保存')}
> >
<div className="space-y-3 mb-5"> <div className="mb-4">
<h3 className="text-sm font-bold text-slate-900 m-0 mb-1">通知推送偏好</h3>
<p className="text-xs text-slate-400 m-0">配置各类关键业务事件的系统通知与推送规则</p>
</div>
<div className="space-y-3 mb-6">
{[ {[
{ name: 'notify_new_session', title: '新会话提醒', desc: '有新访客进线时提醒;浏览器通知与声音可在工作台铃铛中配置' }, { name: 'notify_new_session', title: '新会话提醒', desc: '有新访客进线时提醒;浏览器通知与声音可在工作台铃铛中配置' },
{ name: 'notify_offline_leave', title: '离线留言通知', desc: '访客提交离线留言时提醒' }, { name: 'notify_offline_leave', title: '离线留言通知', desc: '访客在离线时段提交留言时发送系统提醒' },
{ name: 'notify_daily_report', title: '日报推送', desc: '每日服务数据摘要' }, { name: 'notify_daily_report', title: '服务日报推送', desc: '每日定时汇总推送坐席接待与满意度数据摘要' },
].map(item => ( ].map(item => (
<div <div
key={item.name} key={item.name}
className="flex items-center justify-between p-3.5 border border-neutral-100 rounded-lg" className="flex items-center justify-between p-4 border border-slate-200/80 rounded-xl bg-slate-50/50 hover:bg-slate-50 transition-colors"
> >
<div className="min-w-0 pr-3"> <div className="min-w-0 pr-4">
<div className="text-sm font-medium text-neutral-800">{item.title}</div> <div className="text-sm font-bold text-slate-800">{item.title}</div>
<div className="text-xs text-neutral-400 mt-0.5">{item.desc}</div> <div className="text-xs text-slate-400 mt-0.5">{item.desc}</div>
</div> </div>
<Form.Item name={item.name} valuePropName="checked" className="!mb-0"> <Form.Item name={item.name} valuePropName="checked" className="!mb-0">
<Switch /> <Switch />
@@ -1223,26 +1368,36 @@ const Settings = () => {
</div> </div>
))} ))}
</div> </div>
<Form.Item className="!mb-0">
<Button type="primary" htmlType="submit" loading={saving}>保存通知设置</Button> <div className="pt-4 border-t border-slate-100 flex items-center justify-end">
</Form.Item> <Button
type="primary"
htmlType="submit"
loading={saving}
className="!h-9 !px-6 !rounded-xl !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
>
保存通知设置
</Button>
</div>
</Form> </Form>
)} )}
</div> </div>
)} )}
{activeTab === 'tags' && ( {activeTab === 'tags' && (
<div className="bg-white rounded-xl border border-neutral-200 shadow-sm p-6"> <div className="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-6 md:p-8">
<div className="flex items-start justify-between gap-3 mb-4"> <div className="flex items-start justify-between gap-3 mb-5 pb-4 border-b border-slate-100">
<div> <div>
<p className="text-sm text-neutral-500 m-0"> <h3 className="text-sm font-bold text-slate-900 m-0 mb-1">客户标签库</h3>
在此创建标签后,客户管理与工作台中员工只能从列表选择,不能随意输入新标签。 <p className="text-xs text-slate-400 m-0">
维护企业标准标签体系,坐席可在客户管理与工作台快捷打标。
</p> </p>
</div> </div>
<Button <Button
type="primary" type="primary"
size="small" size="small"
icon={<PlusOutlined />} icon={<PlusOutlined />}
className="!h-8 !rounded-lg !text-xs !font-semibold !bg-gradient-to-r !from-blue-600 !to-blue-500 shadow-sm shadow-blue-500/20"
onClick={() => { onClick={() => {
setEditingTag(null) setEditingTag(null)
tagForm.resetFields() tagForm.resetFields()
@@ -1254,35 +1409,37 @@ const Settings = () => {
</Button> </Button>
</div> </div>
{loadingTags ? ( {loadingTags ? (
<div className="py-10 text-center"><Spin /></div> <div className="py-16 text-center"><Spin /></div>
) : customerTags.length === 0 ? ( ) : customerTags.length === 0 ? (
<Empty description="暂无标签,请先创建" /> <Empty description="暂无标签,请先创建" className="py-12" />
) : ( ) : (
<div className="space-y-2"> <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{customerTags.map(tag => { {customerTags.map(tag => {
const style = tagColorStyle(tag.color) const style = tagColorStyle(tag.color)
return ( return (
<div <div
key={tag.id} key={tag.id}
className="flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg border border-neutral-100" className="flex items-center justify-between gap-3 px-4 py-3 rounded-xl border border-slate-200/80 bg-slate-50/50 hover:bg-slate-50 transition-colors"
> >
<span <span
className="inline-flex items-center px-2.5 py-0.5 rounded text-xs font-medium" className="inline-flex items-center px-3 py-1 rounded-lg text-xs font-semibold"
style={{ backgroundColor: style.bg, color: style.color }} style={{ backgroundColor: style.bg, color: style.color }}
> >
{tag.name} {tag.name}
</span> </span>
<div className="flex items-center gap-1"> <div className="flex items-center gap-1.5">
<Button <button
type="text" type="button"
size="small" title="编辑"
icon={<EditOutlined />} className="w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-blue-600 hover:bg-blue-50 border border-slate-200/80 bg-white cursor-pointer transition-colors shadow-2xs"
onClick={() => { onClick={() => {
setEditingTag(tag) setEditingTag(tag)
tagForm.setFieldsValue({ name: tag.name, color: tag.color || 'slate' }) tagForm.setFieldsValue({ name: tag.name, color: tag.color || 'slate' })
setTagModalOpen(true) setTagModalOpen(true)
}} }}
/> >
<EditOutlined className="text-xs" />
</button>
<Popconfirm <Popconfirm
title="删除该标签?" title="删除该标签?"
description="将从标签库移除,并同步去掉客户上的此标签" description="将从标签库移除,并同步去掉客户上的此标签"