统一前后端代码格式化配置

This commit is contained in:
yml2213
2026-08-16 17:27:12 +08:00
parent 8705f6a6a1
commit 5c7c3e14e3
278 changed files with 6386 additions and 5500 deletions
@@ -120,8 +120,7 @@ export default function AdminKuaishouIndustryPage() {
const [actionLoading, setActionLoading] = useState('')
const [consumingVoucherId, setConsumingVoucherId] = useState<number | null>(null)
const [vouchers, setVouchers] = useState<AdminKuaishouIndustryVoucher[]>([])
const [selectedVoucher, setSelectedVoucher] =
useState<AdminKuaishouIndustryVoucher | null>(null)
const [selectedVoucher, setSelectedVoucher] = useState<AdminKuaishouIndustryVoucher | null>(null)
const [voucherTotal, setVoucherTotal] = useState(0)
const [voucherFilters, setVoucherFilters] = useState<VoucherFilterState>({
oid: '',
@@ -247,7 +246,10 @@ export default function AdminKuaishouIndustryPage() {
return (
<div className="cell-stack">
<Typography.Text copyable={Boolean(row.oid)} ellipsis={{ tooltip: row.oid || undefined }}>
<Typography.Text
copyable={Boolean(row.oid)}
ellipsis={{ tooltip: row.oid || undefined }}
>
{row.oid || '-'}
</Typography.Text>
{productLabel ? (
@@ -277,7 +279,11 @@ export default function AdminKuaishouIndustryPage() {
发码:{row.sendCallbackStatus || '-'}
</Tag>
{row.eticketType ? (
<Typography.Text type="secondary" ellipsis={{ tooltip: row.eticketType }} className="muted">
<Typography.Text
type="secondary"
ellipsis={{ tooltip: row.eticketType }}
className="muted"
>
{row.eticketType}
</Typography.Text>
) : (
@@ -306,7 +312,9 @@ export default function AdminKuaishouIndustryPage() {
const consumedAt = formatAdminDateTime(row.consumedAt)
return (
<div className="cell-stack">
<span title={serial || undefined}>{consumedAt !== '-' ? consumedAt : serial || '-'}</span>
<span title={serial || undefined}>
{consumedAt !== '-' ? consumedAt : serial || '-'}
</span>
{serial && consumedAt !== '-' ? (
<Typography.Text type="secondary" ellipsis={{ tooltip: serial }} className="muted">
{serial}
@@ -493,9 +501,7 @@ export default function AdminKuaishouIndustryPage() {
setActionLoading('consume')
try {
const response = await consumeAdminKuaishouIndustryVoucher(buildVoucherToolPayload())
publishActionResult(
buildIndustryActionResultView('consume', '手动核销', response.data),
)
publishActionResult(buildIndustryActionResultView('consume', '手动核销', response.data))
showSuccess('手动核销已完成')
await loadVouchers()
} catch (error) {
@@ -533,9 +539,7 @@ export default function AdminKuaishouIndustryPage() {
etickets: [{ id: row.voucherCode, code: row.voucherCode, num: 1 }],
})
if (!isSupportOnly) {
publishActionResult(
buildIndustryActionResultView('consume', '手动核销', response.data),
)
publishActionResult(buildIndustryActionResultView('consume', '手动核销', response.data))
}
showSuccess(`券码 ${row.voucherCode} 已核销`)
await loadVouchers()
@@ -560,9 +564,7 @@ export default function AdminKuaishouIndustryPage() {
setActionLoading('resend')
try {
const response = await resendAdminKuaishouIndustryVoucherCode(buildVoucherToolPayload())
publishActionResult(
buildIndustryActionResultView('resend', '重发发码回调', response.data),
)
publishActionResult(buildIndustryActionResultView('resend', '重发发码回调', response.data))
if (response.data.success) {
showSuccess('发码回调已重发')
} else {
@@ -590,9 +592,7 @@ export default function AdminKuaishouIndustryPage() {
...buildVoucherToolPayload(),
reason: toolForm.reason || 'USER_APPLY_REFUND',
})
publishActionResult(
buildIndustryActionResultView('destroy', '手动销毁', response.data),
)
publishActionResult(buildIndustryActionResultView('destroy', '手动销毁', response.data))
showSuccess(
response.data.alreadyDestroyed
? `券码已是销毁状态,销毁回调已重试(${response.data.reason || 'USER_APPLY_REFUND'})`
@@ -677,9 +677,7 @@ export default function AdminKuaishouIndustryPage() {
title: string,
loadingKey: string,
action: () => Promise<{ data: AdminKuaishouIndustryOpenApiResult }>,
afterSuccess?: (
result: AdminKuaishouIndustryOpenApiResult,
) => { refundCount?: number } | void,
afterSuccess?: (result: AdminKuaishouIndustryOpenApiResult) => { refundCount?: number } | void,
) {
setActionLoading(loadingKey)
try {
@@ -1069,9 +1067,7 @@ export default function AdminKuaishouIndustryPage() {
items={[
{
key: 'manual-target',
label: selectedVoucher
? '手动指定卡券(清除当前选择后可用)'
: '手动指定卡券',
label: selectedVoucher ? '手动指定卡券(清除当前选择后可用)' : '手动指定卡券',
children: (
<div className="kuaishou-industry-tool-grid">
<label className="kuaishou-industry-tool-field">
@@ -1108,9 +1104,7 @@ export default function AdminKuaishouIndustryPage() {
<Input
disabled={Boolean(selectedVoucher)}
value={toolForm.voucherCode}
onChange={(event) =>
updateToolForm({ voucherCode: event.target.value })
}
onChange={(event) => updateToolForm({ voucherCode: event.target.value })}
/>
</label>
<label className="kuaishou-industry-tool-field kuaishou-industry-tool-field-wide">
@@ -1118,9 +1112,7 @@ export default function AdminKuaishouIndustryPage() {
<Input
disabled={Boolean(selectedVoucher)}
value={toolForm.eticketType}
onChange={(event) =>
updateToolForm({ eticketType: event.target.value })
}
onChange={(event) => updateToolForm({ eticketType: event.target.value })}
/>
</label>
</div>
@@ -1568,11 +1560,9 @@ function renderShopCell(
return <span>-</span>
}
const tipParts = [
name || null,
id ? `ID:${id}` : null,
token ? `Token:${token}` : null,
].filter(Boolean)
const tipParts = [name || null, id ? `ID:${id}` : null, token ? `Token:${token}` : null].filter(
Boolean,
)
const tip = tipParts.join('\n')
if (compact) {
@@ -1671,11 +1661,7 @@ function buildIndustryActionResultView(
'展示状态',
pickFirstString([etickets[0].displayStatus, etickets[0].status]) || '-',
)
pushHighlight(
highlights,
'平台类型',
pickFirstString([etickets[0].eticketType]) || '-',
)
pushHighlight(highlights, '平台类型', pickFirstString([etickets[0].eticketType]) || '-')
pushHighlight(highlights, '剩余数量', String(etickets[0].leftNum ?? etickets[0].num ?? 1))
}
}
@@ -1689,11 +1675,7 @@ function buildIndustryActionResultView(
) {
if (voucher) {
pushHighlight(highlights, '券码', String(voucher.voucherCode || '-'))
pushHighlight(
highlights,
'券状态',
getVoucherStatusLabel(String(voucher.status || '')),
)
pushHighlight(highlights, '券状态', getVoucherStatusLabel(String(voucher.status || '')))
if (voucher.eticketType) {
pushHighlight(highlights, '凭证类型', String(voucher.eticketType))
}
@@ -1724,9 +1706,7 @@ function buildIndustryActionResultView(
if (kind === 'refund-list') {
const count =
typeof meta?.refundCount === 'number'
? meta.refundCount
: extractRefundRows(response).length
typeof meta?.refundCount === 'number' ? meta.refundCount : extractRefundRows(response).length
pushHighlight(highlights, '售后单数量', String(count))
const pcursor = pickFirstString([
responseData?.pcursor,
@@ -1739,10 +1719,7 @@ function buildIndustryActionResultView(
}
if (kind === 'refund-approve' || kind === 'refund-disagree') {
const refundId = pickFirstString([
responseData?.refundId,
asRecord(openApi.request)?.refundId,
])
const refundId = pickFirstString([responseData?.refundId, asRecord(openApi.request)?.refundId])
if (refundId) {
pushHighlight(highlights, '退款单号', refundId)
}