style(frontend): 格式化前端代码并修复 eslint 异步操作未标记告警
- 统一 prettier 代码风格; - 为 AdminTaskDetailPage 与 AdminTasksPage 中未捕获的 Promise 添加 void 标记; - 验证方式:npm --prefix apps/frontend run check 全流程通过。
This commit is contained in:
@@ -31,10 +31,7 @@ import StatusTag from '@/components/admin/StatusTag'
|
||||
import dayjs from '@/lib/dayjs'
|
||||
import { fetchAdminOrders } from '@/services/admin'
|
||||
import type { AdminOrderListItem } from '@/types/admin'
|
||||
import {
|
||||
resolveOrderFulfillmentMode,
|
||||
resolveOrderPlatformBadge,
|
||||
} from '@/utils/admin-display'
|
||||
import { resolveOrderFulfillmentMode, resolveOrderPlatformBadge } from '@/utils/admin-display'
|
||||
import {
|
||||
adminOrderExecutorOptions,
|
||||
adminOrderPlatformSegmentedOptions,
|
||||
@@ -356,7 +353,8 @@ export default function AdminOrdersPage() {
|
||||
render: (_, row) => (
|
||||
<div className="cell-stack" style={{ gap: 3 }}>
|
||||
<strong style={{ fontSize: 14, color: '#0f172a' }}>
|
||||
¥ {row.totalAmount || '0.00'} <span style={{ fontSize: 11, color: '#64748b' }}>{row.currency}</span>
|
||||
¥ {row.totalAmount || '0.00'}{' '}
|
||||
<span style={{ fontSize: 11, color: '#64748b' }}>{row.currency}</span>
|
||||
</strong>
|
||||
<span className="muted" style={{ fontSize: 12 }}>
|
||||
{formatAdminDateTime(row.paidAt || row.createdAt)}
|
||||
@@ -451,7 +449,15 @@ export default function AdminOrdersPage() {
|
||||
|
||||
<Card style={{ marginBottom: 16 }}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: 12 }}>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
flexWrap: 'wrap',
|
||||
gap: 12,
|
||||
}}
|
||||
>
|
||||
<Segmented
|
||||
size="middle"
|
||||
options={adminOrderPlatformSegmentedOptions}
|
||||
|
||||
@@ -459,7 +459,7 @@ export default function AdminTaskDetailPage() {
|
||||
icon={<CopyOutlined />}
|
||||
style={{ padding: 0, height: 'auto', color: '#64748b' }}
|
||||
onClick={() => {
|
||||
navigator.clipboard
|
||||
void navigator.clipboard
|
||||
.writeText(platformOrderId)
|
||||
.then(() => message.success('已复制平台订单号'))
|
||||
}}
|
||||
@@ -920,8 +920,7 @@ export default function AdminTaskDetailPage() {
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(resolvedDetail.manualDispatch ||
|
||||
resolvedDetail.task.executorKey === 'manual_dispatch'
|
||||
...(resolvedDetail.manualDispatch || resolvedDetail.task.executorKey === 'manual_dispatch'
|
||||
? [
|
||||
{
|
||||
key: 'manual-dispatch',
|
||||
@@ -947,9 +946,7 @@ export default function AdminTaskDetailPage() {
|
||||
{
|
||||
key: 'resolution',
|
||||
label: '兑换重试',
|
||||
children: (
|
||||
<RedeemResolutionPanel resolution={resolvedDetail.redeemResolution} />
|
||||
),
|
||||
children: <RedeemResolutionPanel resolution={resolvedDetail.redeemResolution} />,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
@@ -1153,9 +1150,7 @@ function AffiliateDashPanel({
|
||||
<Descriptions.Item label="发货次数">
|
||||
{rawObj?.result?.ship_attempts || 1} 次
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="绑定手机号">
|
||||
{delivery.phone_number || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="绑定手机号">{delivery.phone_number || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="上游商品标题">
|
||||
{delivery.good_details?.order_title || delivery.good_details?.image ? (
|
||||
<span>{delivery.good_details?.order_title}</span>
|
||||
@@ -1330,9 +1325,7 @@ function FulfillmentOverviewPanel({
|
||||
style={{ marginBottom: 12 }}
|
||||
>
|
||||
<Descriptions.Item label="填写 UID">
|
||||
{claimIdentity?.expectedUid || (
|
||||
<Typography.Text type="warning">未提交</Typography.Text>
|
||||
)}
|
||||
{claimIdentity?.expectedUid || <Typography.Text type="warning">未提交</Typography.Text>}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="绑定角色 ID">
|
||||
{claimIdentity?.boundUid || detail.task.roleId || '-'}
|
||||
|
||||
@@ -610,7 +610,7 @@ export default function AdminTasksPage() {
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (voucherModal.task?.taskId) {
|
||||
navigate(`/admin/tasks/${voucherModal.task.taskId}`)
|
||||
void navigate(`/admin/tasks/${voucherModal.task.taskId}`)
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -174,7 +174,7 @@ export function DouyinMashidaPanel() {
|
||||
showSuccess(`推送订阅成功!平台将向 ${targetUrl} 推送订单事件`)
|
||||
}
|
||||
} catch (error) {
|
||||
showError(error instanceof Error ? error.message : (disable ? '停用推送失败' : '推送订阅失败'))
|
||||
showError(error instanceof Error ? error.message : disable ? '停用推送失败' : '推送订阅失败')
|
||||
} finally {
|
||||
setSubscribing(false)
|
||||
}
|
||||
@@ -286,11 +286,7 @@ export function DouyinMashidaPanel() {
|
||||
|
||||
<Col xs={24} md={14} style={{ textAlign: 'right' }}>
|
||||
<Space wrap size={8}>
|
||||
<Button
|
||||
size="small"
|
||||
icon={<GlobalOutlined />}
|
||||
onClick={handleFillCurrentOrigin}
|
||||
>
|
||||
<Button size="small" icon={<GlobalOutlined />} onClick={handleFillCurrentOrigin}>
|
||||
一键填入当前域名
|
||||
</Button>
|
||||
<Button
|
||||
@@ -337,7 +333,11 @@ export function DouyinMashidaPanel() {
|
||||
</Col>
|
||||
<Col xs={24} lg={18}>
|
||||
<Space wrap align="center">
|
||||
<Text code copyable={{ text: messageUrl }} style={{ fontSize: 13, fontWeight: 500 }}>
|
||||
<Text
|
||||
code
|
||||
copyable={{ text: messageUrl }}
|
||||
style={{ fontSize: 13, fontWeight: 500 }}
|
||||
>
|
||||
{messageUrl}
|
||||
</Text>
|
||||
{isMessageUrlLocal ? (
|
||||
|
||||
@@ -306,7 +306,16 @@ export function AffiliateDashResultStep({ snapshot }: { snapshot: ClaimSnapshot
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [success, productName, productSKU, snapshot.product?.imageUrl, roleName, boundAccount, gameChannel, redeemedAt])
|
||||
}, [
|
||||
success,
|
||||
productName,
|
||||
productSKU,
|
||||
snapshot.product?.imageUrl,
|
||||
roleName,
|
||||
boundAccount,
|
||||
gameChannel,
|
||||
redeemedAt,
|
||||
])
|
||||
|
||||
const handleCopyVoucher = async () => {
|
||||
if (!voucherUrl) return
|
||||
|
||||
@@ -24,4 +24,3 @@ export function updateAdminOrderClaimStatus(
|
||||
claimStatusUpdatedAt: string
|
||||
}>(`/api/v1/admin/orders/${orderId}/claim-status`, payload)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,4 +35,3 @@ export function testAdminDouyinMashidaGateway() {
|
||||
message: string
|
||||
}>('/api/v1/admin/platform-config/douyin-mashida/test-gateway', {})
|
||||
}
|
||||
|
||||
|
||||
@@ -33,4 +33,3 @@ export function submitH5AffiliateDashClaim(
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -183,10 +183,10 @@ export function formatTaskEventPayload(payload: Record<string, unknown>) {
|
||||
return JSON.stringify(payload || {})
|
||||
}
|
||||
|
||||
export function resolveOrderPlatformBadge(row: {
|
||||
platform?: string
|
||||
provider?: string
|
||||
}): { label: string; color: string } {
|
||||
export function resolveOrderPlatformBadge(row: { platform?: string; provider?: string }): {
|
||||
label: string
|
||||
color: string
|
||||
} {
|
||||
const provider = String(row.provider || '').toLowerCase()
|
||||
const platform = String(row.platform || '').toLowerCase()
|
||||
|
||||
@@ -251,4 +251,3 @@ export function resolveOrderFulfillmentMode(row: {
|
||||
|
||||
return { label: '手动交付', color: 'default' }
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,8 @@ export async function generateVoucherDataURL(data: DeliveryVoucherData): Promise
|
||||
listItems.forEach((item) => {
|
||||
// Label (左侧淡银灰)
|
||||
ctx.fillStyle = 'rgba(226, 232, 240, 0.72)'
|
||||
ctx.font = '18px -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif'
|
||||
ctx.font =
|
||||
'18px -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif'
|
||||
ctx.textAlign = 'left'
|
||||
ctx.textBaseline = 'middle'
|
||||
ctx.fillText(item.label, labelX, rowY)
|
||||
|
||||
@@ -59,4 +59,3 @@ test('resolveH5ClaimOrderNo:正确解析并解码订单号', () => {
|
||||
assert.equal(resolveH5ClaimOrderNo('/h5/ORDER-001/'), 'ORDER-001')
|
||||
assert.equal(resolveH5ClaimOrderNo('/claim/123'), '')
|
||||
})
|
||||
|
||||
|
||||
@@ -142,4 +142,3 @@ test('resolveDouyinMashidaPublicOrigin:从已配置的 claimLinkBase 或 certL
|
||||
'http://localhost:5173',
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user