优化半自动履约客户页与后台操作布局

用户侧统一显示等待客服处理并精简平台标题;移除 Cookie 等专业表述;后台操作改为两行行内按钮,取消操作下拉。
This commit is contained in:
yml
2026-11-14 01:23:15 +08:00
parent d178556f03
commit 9d738becd3
6 changed files with 100 additions and 145 deletions
@@ -366,7 +366,7 @@ export async function createSemiAutoMock(
pageDescription, pageDescription,
loginInstructions: loginInstructions:
platform === 'weibo' platform === 'weibo'
? '真实登录:使用微博绑定手机号接收验证码登录,或使用微博 App 扫码登录。登录仅用于本次订单履约,不会在页面展示账号 Cookie。' ? '真实登录:使用微博绑定手机号接收验证码登录,或使用微博 App 扫码登录。登录信息仅用于本次订单履约。'
: connectorMode === 'mock' : connectorMode === 'mock'
? 'Mock 登录:点击获取二维码后,页面轮询两次会自动模拟登录成功。' ? 'Mock 登录:点击获取二维码后,页面轮询两次会自动模拟登录成功。'
: '真实登录:点击获取二维码后,请使用虎牙 App 扫码并在手机上确认登录。', : '真实登录:点击获取二维码后,请使用虎牙 App 扫码并在手机上确认登录。',
@@ -172,7 +172,7 @@ function displayStatus(task: TaskRow) {
return { key: 'failed', label: '需客服处理' } return { key: 'failed', label: '需客服处理' }
} }
if (task.login_status === 'authenticated') { if (task.login_status === 'authenticated') {
return { key: 'waiting_operator', label: 'CK 已获取,等待客服处理' } return { key: 'waiting_operator', label: '等待客服处理' }
} }
if (task.login_status === 'scanned') return { key: 'login_scanned', label: '已扫码,确认中' } if (task.login_status === 'scanned') return { key: 'login_scanned', label: '已扫码,确认中' }
if (task.login_status === 'qr_pending') return { key: 'waiting_login', label: '等待客户登录' } if (task.login_status === 'qr_pending') return { key: 'waiting_login', label: '等待客户登录' }
@@ -141,7 +141,7 @@ test(
) )
const authenticatedList = await listAdminSemiAutoTasks({ keyword: orderNo }) const authenticatedList = await listAdminSemiAutoTasks({ keyword: orderNo })
assert.equal(authenticatedList.items[0]?.loginStatus, 'authenticated') assert.equal(authenticatedList.items[0]?.loginStatus, 'authenticated')
assert.equal(authenticatedList.items[0]?.displayStatus.label, 'CK 已获取,等待客服处理') assert.equal(authenticatedList.items[0]?.displayStatus.label, '等待客服处理')
const exported = await exportAdminSemiAutoCredential(taskId) const exported = await exportAdminSemiAutoCredential(taskId)
assert.equal(exported.credentialId, credentialId) assert.equal(exported.credentialId, credentialId)
assert.equal(exported.platform, 'huya') assert.equal(exported.platform, 'huya')
@@ -2,10 +2,7 @@ import {
CheckCircleOutlined, CheckCircleOutlined,
ChromeOutlined, ChromeOutlined,
CopyOutlined, CopyOutlined,
DownOutlined,
KeyOutlined, KeyOutlined,
LinkOutlined,
MoreOutlined,
ReloadOutlined, ReloadOutlined,
SendOutlined, SendOutlined,
UserSwitchOutlined, UserSwitchOutlined,
@@ -17,7 +14,6 @@ import {
Card, Card,
Descriptions, Descriptions,
Drawer, Drawer,
Dropdown,
Form, Form,
Input, Input,
InputNumber, InputNumber,
@@ -288,76 +284,6 @@ export default function AdminSemiAutoTasksPage() {
}) })
} }
function credentialMenu(task: SemiAutoTask) {
return {
items: [
{
key: 'copy',
icon: <KeyOutlined />,
label: '复制最终 CK',
disabled: !task.credentialReady || credentialExportMutation.isPending,
},
{
key: 'inject',
icon: <ChromeOutlined />,
label: '注入浏览器',
disabled: !taskCanUseCredential(task) || injectionMutation.isPending,
},
],
onClick: ({ key }: { key: string }) => {
if (key === 'copy') {
confirmCopyCredential(task)
return
}
if (key === 'inject') injectionMutation.mutate(task)
},
}
}
function taskMenu(task: SemiAutoTask) {
const active = task.executionStatus !== 'completed' && task.executionStatus !== 'cancelled'
return {
items: [
{
key: 'copy',
icon: <LinkOutlined />,
label: '复制客户链接',
},
{
key: 'sync',
icon: <ReloadOutlined />,
label: '刷新客户状态',
disabled: syncMutation.isPending,
},
...(!task.assignedAdminUserId
? [
{
key: 'claim',
icon: <UserSwitchOutlined />,
label: '领取任务',
disabled: claimMutation.isPending,
},
]
: []),
...(active
? [
{
key: 'cancel',
danger: true,
label: '取消任务',
},
]
: []),
],
onClick: ({ key }: { key: string }) => {
if (key === 'copy') void copyCustomerLink(task)
if (key === 'sync') syncMutation.mutate(task.id)
if (key === 'claim') claimMutation.mutate(task.id)
if (key === 'cancel') confirmCancel(task)
},
}
}
function openComplete(task: SemiAutoTask) { function openComplete(task: SemiAutoTask) {
setCompleteTask(task) setCompleteTask(task)
setCompleteFiles([]) setCompleteFiles([])
@@ -461,46 +387,88 @@ export default function AdminSemiAutoTasksPage() {
{ {
title: '操作', title: '操作',
key: 'actions', key: 'actions',
width: 340, width: 520,
render: (_, task) => ( render: (_, task) => (
<Space wrap> <Space direction="vertical" size={6} style={{ width: '100%' }}>
<Button size="small" onClick={() => setDetailTaskId(task.id)}> <Space wrap>
详情 <Button size="small" onClick={() => setDetailTaskId(task.id)}>
</Button> 详情
{taskNeedsCustomerReauth(task) ? ( </Button>
{taskNeedsCustomerReauth(task) ? (
<Button
size="small"
type="primary"
icon={<SendOutlined />}
loading={reauthMutation.isPending}
onClick={() => confirmReauth(task)}
>
重发授权
</Button>
) : null}
<Button <Button
size="small" size="small"
type="primary" icon={<KeyOutlined />}
icon={<SendOutlined />} disabled={!task.credentialReady}
loading={reauthMutation.isPending} loading={credentialExportMutation.isPending}
onClick={() => confirmReauth(task)} onClick={() => confirmCopyCredential(task)}
> >
重发授权 复制 CK
</Button> </Button>
) : null}
<Dropdown menu={credentialMenu(task)} trigger={['click']}>
<Button size="small" icon={<KeyOutlined />}>
CK 操作 <DownOutlined />
</Button>
</Dropdown>
{task.executionStatus !== 'completed' &&
task.executionStatus !== 'cancelled' &&
!taskNeedsCustomerReauth(task) ? (
<Button <Button
size="small" size="small"
type="primary" icon={<ChromeOutlined />}
icon={<CheckCircleOutlined />}
disabled={!taskCanUseCredential(task)} disabled={!taskCanUseCredential(task)}
onClick={() => openComplete(task)} loading={injectionMutation.isPending}
onClick={() => injectionMutation.mutate(task)}
> >
完成 注入浏览器
</Button> </Button>
) : null} </Space>
<Dropdown menu={taskMenu(task)} trigger={['click']}> <Space wrap>
<Button size="small" icon={<MoreOutlined />}> <Button
更多 size="small"
icon={<CopyOutlined />}
onClick={() => void copyCustomerLink(task)}
>
客户链接
</Button> </Button>
</Dropdown> <Button
size="small"
icon={<ReloadOutlined />}
loading={syncMutation.isPending}
onClick={() => syncMutation.mutate(task.id)}
>
刷新
</Button>
{!task.assignedAdminUserId ? (
<Button
size="small"
icon={<UserSwitchOutlined />}
loading={claimMutation.isPending}
onClick={() => claimMutation.mutate(task.id)}
>
领取
</Button>
) : null}
{task.executionStatus !== 'completed' &&
task.executionStatus !== 'cancelled' &&
!taskNeedsCustomerReauth(task) ? (
<Button
size="small"
type="primary"
icon={<CheckCircleOutlined />}
disabled={!taskCanUseCredential(task)}
onClick={() => openComplete(task)}
>
完成
</Button>
) : null}
{task.executionStatus !== 'completed' && task.executionStatus !== 'cancelled' ? (
<Button size="small" danger onClick={() => confirmCancel(task)}>
取消
</Button>
) : null}
</Space>
</Space> </Space>
), ),
}, },
@@ -690,11 +658,22 @@ export default function AdminSemiAutoTasksPage() {
> >
刷新客户状态 刷新客户状态
</Button> </Button>
<Dropdown menu={credentialMenu(detail.task)} trigger={['click']}> <Button
<Button icon={<KeyOutlined />}> icon={<KeyOutlined />}
CK 操作 <DownOutlined /> disabled={!detail.task.credentialReady}
</Button> loading={credentialExportMutation.isPending}
</Dropdown> onClick={() => confirmCopyCredential(detail.task)}
>
复制 CK
</Button>
<Button
icon={<ChromeOutlined />}
disabled={!taskCanUseCredential(detail.task)}
loading={injectionMutation.isPending}
onClick={() => injectionMutation.mutate(detail.task)}
>
注入浏览器
</Button>
</Space> </Space>
</Card> </Card>
<Card size="small" title="时间线"> <Card size="small" title="时间线">
@@ -251,14 +251,13 @@ export default function CustomerFulfillmentPage() {
} }
const config = selectedTask?.semiAutoConfig || {} const config = selectedTask?.semiAutoConfig || {}
const title = config.pageTitle || (isWeibo ? '微博账号授权' : '账号授权与角色绑定') const displayTitle = isWeibo ? '微博账号登录授权' : '虎牙账号登录授权'
const displayTitle = isWeibo ? '微博账号登录授权' : title
const loginQrVisible = const loginQrVisible =
selectedTask && ['qr_pending', 'scanned'].includes(selectedTask.loginStatus) selectedTask && ['qr_pending', 'scanned'].includes(selectedTask.loginStatus)
if (loading) { if (loading) {
return ( return (
<CustomerAuthFrame eyebrow="账号授权" title="正在读取订单信息"> <CustomerAuthFrame title="正在读取订单信息">
<div className="customer-auth-loading"> <div className="customer-auth-loading">
<Spin indicator={<LoadingOutlined spin />} /> <Spin indicator={<LoadingOutlined spin />} />
<span>正在读取订单履约信息...</span> <span>正在读取订单履约信息...</span>
@@ -269,7 +268,7 @@ export default function CustomerFulfillmentPage() {
if (loadError || tasks.length === 0) { if (loadError || tasks.length === 0) {
return ( return (
<CustomerAuthFrame eyebrow="账号授权" title="暂时无法打开订单"> <CustomerAuthFrame title="暂时无法打开订单">
<div className="customer-auth-state is-error"> <div className="customer-auth-state is-error">
<h2>订单信息读取失败</h2> <h2>订单信息读取失败</h2>
<p>{loadError || '该订单没有需要客户授权或绑定的任务。'}</p> <p>{loadError || '该订单没有需要客户授权或绑定的任务。'}</p>
@@ -280,11 +279,7 @@ export default function CustomerFulfillmentPage() {
if (selectedTask?.executionStatus === 'completed') { if (selectedTask?.executionStatus === 'completed') {
return ( return (
<CustomerAuthFrame <CustomerAuthFrame platform={selectedTask.platform} title={displayTitle}>
platform={selectedTask.platform}
eyebrow={isWeibo ? '微博账号授权' : '虎牙账号授权'}
title={displayTitle}
>
<CustomerTaskFacts task={selectedTask} /> <CustomerTaskFacts task={selectedTask} />
<div className="customer-auth-state is-success"> <div className="customer-auth-state is-success">
<div className="customer-auth-state-icon"> <div className="customer-auth-state-icon">
@@ -309,11 +304,7 @@ export default function CustomerFulfillmentPage() {
} }
return ( return (
<CustomerAuthFrame <CustomerAuthFrame platform={selectedTask?.platform} title={displayTitle}>
platform={selectedTask?.platform}
eyebrow={isWeibo ? '微博账号授权' : '虎牙账号授权'}
title={displayTitle}
>
<div className="customer-auth-content-stack"> <div className="customer-auth-content-stack">
{tasks.length > 1 ? ( {tasks.length > 1 ? (
<div className="customer-auth-task-switcher"> <div className="customer-auth-task-switcher">
@@ -503,7 +494,6 @@ export default function CustomerFulfillmentPage() {
function CustomerAuthFrame(input: { function CustomerAuthFrame(input: {
platform?: CustomerSemiAutoTask['platform'] platform?: CustomerSemiAutoTask['platform']
eyebrow: string
title: string title: string
children: ReactNode children: ReactNode
}) { }) {
@@ -515,9 +505,6 @@ function CustomerAuthFrame(input: {
<header className="customer-auth-hero"> <header className="customer-auth-hero">
<div className="customer-auth-brand"> <div className="customer-auth-brand">
<div> <div>
{input.platform !== 'weibo' ? (
<span className="customer-auth-eyebrow">{input.eyebrow}</span>
) : null}
<h1>{input.title}</h1> <h1>{input.title}</h1>
</div> </div>
</div> </div>
+5 -16
View File
@@ -1502,21 +1502,14 @@
box-shadow: inset 0 0 24px rgba(255, 138, 0, 0.06); box-shadow: inset 0 0 24px rgba(255, 138, 0, 0.06);
} }
.customer-auth-eyebrow {
display: block;
margin-bottom: 4px;
color: rgba(255, 255, 255, 0.78);
font-size: 15px;
font-weight: 500;
}
.customer-auth-brand h1 { .customer-auth-brand h1 {
margin: 0; margin: 0;
color: #fff; color: #fff;
font-size: clamp(26px, 4.2vw, 38px); font-size: clamp(18px, 2.3vw, 22px);
line-height: 1.25; line-height: 1.3;
font-weight: 700; font-weight: 600;
letter-spacing: 0; letter-spacing: 0;
white-space: nowrap;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
@@ -2087,12 +2080,8 @@
background-position: 58% center; background-position: 58% center;
} }
.customer-auth-eyebrow {
font-size: 13px;
}
.customer-auth-brand h1 { .customer-auth-brand h1 {
font-size: 26px; font-size: 18px;
} }
.customer-auth-warning { .customer-auth-warning {