代码格式化: prettier --write 统一代码风格

39 个文件按 .prettierrc.json (printWidth 100 / no semi / singleQuote) 统一格式, 纯空白与换行调整, 无逻辑变更。为接入代码门禁做准备, 让 npm run check (format:check + lint:strict + typecheck) 干净通过。
This commit is contained in:
yml
2026-06-14 16:24:01 +08:00
parent ae4297fec7
commit f410be3797
39 changed files with 87 additions and 80 deletions
@@ -79,7 +79,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -95,7 +95,6 @@ function isGroupPartial(perms: Permission[]) {
return perms.some(p => selectedPermIds.value.includes(p.id)) && !isGroupAllSelected(perms) return perms.some(p => selectedPermIds.value.includes(p.id)) && !isGroupAllSelected(perms)
} }
const resourceLabels: Record<string, string> = { const resourceLabels: Record<string, string> = {
dashboard: '仪表盘', dashboard: '仪表盘',
user: '用户管理', user: '用户管理',
@@ -52,7 +52,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -64,7 +64,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -69,7 +69,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -110,7 +110,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -127,7 +127,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -128,7 +128,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -110,7 +110,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -183,7 +183,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -77,7 +77,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -88,7 +88,6 @@ async function handleSave() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -41,7 +41,9 @@ const filteredDisputes = computed(() => {
const pendingCount = computed( const pendingCount = computed(
() => disputes.value.filter(item => ['open', 'processing'].includes(item.status)).length () => disputes.value.filter(item => ['open', 'processing'].includes(item.status)).length
) )
const resolvedCount = computed(() => disputes.value.filter(item => item.status === 'resolved').length) const resolvedCount = computed(
() => disputes.value.filter(item => item.status === 'resolved').length
)
const cancelledCount = computed( const cancelledCount = computed(
() => disputes.value.filter(item => item.status === 'cancelled').length () => disputes.value.filter(item => item.status === 'cancelled').length
) )
@@ -192,7 +194,8 @@ function evidenceName(value: string, index: number) {
function evidenceDetail(value: string) { function evidenceDetail(value: string) {
const key = evidenceObjectKey(value) const key = evidenceObjectKey(value)
if (key) return decodeURIComponent(key) if (key) return decodeURIComponent(key)
if (value.startsWith('/api/files/object') || value.startsWith('/api/admin/files/object')) return value if (value.startsWith('/api/files/object') || value.startsWith('/api/admin/files/object'))
return value
try { try {
const parsed = new URL(value, window.location.origin) const parsed = new URL(value, window.location.origin)
return parsed.href return parsed.href
@@ -277,7 +280,6 @@ async function handleArbitrate() {
submitting.value = false submitting.value = false
} }
} }
</script> </script>
<template> <template>
@@ -339,7 +341,10 @@ async function handleArbitrate() {
<template #default="{ row }"> <template #default="{ row }">
<div class="main-cell"> <div class="main-cell">
<strong>{{ row.title }}</strong> <strong>{{ row.title }}</strong>
<span>{{ orderStatusLabel(row.order_status) }} · {{ handoffStatusLabel(row.handoff_status) }}</span> <span
>{{ orderStatusLabel(row.order_status) }} ·
{{ handoffStatusLabel(row.handoff_status) }}</span
>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -356,8 +361,14 @@ async function handleArbitrate() {
<el-table-column label="双方信息" min-width="240"> <el-table-column label="双方信息" min-width="240">
<template #default="{ row }"> <template #default="{ row }">
<div class="party-cell"> <div class="party-cell">
<span>申诉方{{ roleLabel(row, row.initiator_id) }} {{ userPhone(row, row.initiator_id) }}</span> <span
<span>申诉方{{ roleLabel(row, row.target_user_id) }} {{ userPhone(row, row.target_user_id) }}</span> >申诉方{{ roleLabel(row, row.initiator_id) }}
{{ userPhone(row, row.initiator_id) }}</span
>
<span
>被申诉方{{ roleLabel(row, row.target_user_id) }}
{{ userPhone(row, row.target_user_id) }}</span
>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -377,7 +388,9 @@ async function handleArbitrate() {
<template #default="{ row }">{{ arbitrationResultLabel(row.arbitration_result) }}</template> <template #default="{ row }">{{ arbitrationResultLabel(row.arbitration_result) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="处理时间" min-width="180"> <el-table-column label="处理时间" min-width="180">
<template #default="{ row }">{{ row.handled_at ? formatDateTime(row.handled_at) : '-' }}</template> <template #default="{ row }">{{
row.handled_at ? formatDateTime(row.handled_at) : '-'
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="170" fixed="right"> <el-table-column label="操作" width="170" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
@@ -387,10 +400,7 @@ async function handleArbitrate() {
@click="evidenceDispute = row" @click="evidenceDispute = row"
>证据</el-button >证据</el-button
> >
<el-button <el-button size="small" :disabled="!canArbitrate(row)" @click="openArbitration(row)"
size="small"
:disabled="!canArbitrate(row)"
@click="openArbitration(row)"
>仲裁</el-button >仲裁</el-button
> >
</template> </template>
@@ -508,10 +518,7 @@ async function handleArbitrate() {
<p>{{ evidenceDispute.description || '-' }}</p> <p>{{ evidenceDispute.description || '-' }}</p>
</div> </div>
<el-empty <el-empty v-if="evidenceItems(evidenceDispute).length === 0" description="暂无证据文件" />
v-if="evidenceItems(evidenceDispute).length === 0"
description="暂无证据文件"
/>
<div v-else class="evidence-list"> <div v-else class="evidence-list">
<div <div
v-for="(item, index) in evidenceItems(evidenceDispute)" v-for="(item, index) in evidenceItems(evidenceDispute)"
@@ -105,7 +105,6 @@ async function openScreenshot(url: string) {
window.open(url, '_blank') window.open(url, '_blank')
} }
} }
</script> </script>
<template> <template>
@@ -549,7 +549,6 @@ async function openScreenshot(url: string) {
window.open(url, '_blank') window.open(url, '_blank')
} }
} }
</script> </script>
<template> <template>
@@ -54,7 +54,6 @@ async function handleLogin() {
loading.value = false loading.value = false
} }
} }
</script> </script>
<template> <template>
@@ -94,7 +94,6 @@ async function handleChangePassword() {
} }
} }
const statusLabel: Record<string, string> = { const statusLabel: Record<string, string> = {
active: '启用', active: '启用',
disabled: '禁用', disabled: '禁用',
@@ -89,7 +89,6 @@ async function submitAction() {
} }
} }
function orderRentedAt() { function orderRentedAt() {
return order.value?.rented_at return order.value?.rented_at
} }
@@ -86,7 +86,6 @@ async function handleUnfreeze(row: AdminUserItem) {
} }
} }
function moneyCent(value: number | string | undefined) { function moneyCent(value: number | string | undefined) {
return formatCent(Number(value || 0)) return formatCent(Number(value || 0))
} }
@@ -96,7 +96,6 @@ async function handleLogin() {
loading.value = false loading.value = false
} }
} }
</script> </script>
<template> <template>
@@ -206,7 +206,6 @@ async function saveProfile() {
} }
} }
function confirmLogout() { function confirmLogout() {
showSettings.value = false showSettings.value = false
showDialog({ showDialog({
@@ -145,7 +145,6 @@ async function saveProfile() {
saving.value = false saving.value = false
} }
} }
</script> </script>
<template> <template>
@@ -108,7 +108,6 @@ async function handleSubmit() {
loading.value = false loading.value = false
} }
} }
</script> </script>
<template> <template>
@@ -88,9 +88,7 @@ function readItems(key: string): ListingCollectionItem[] {
if (!raw) return [] if (!raw) return []
const parsed = JSON.parse(raw) as unknown const parsed = JSON.parse(raw) as unknown
if (!Array.isArray(parsed)) return [] if (!Array.isArray(parsed)) return []
return parsed return parsed.map(normalizeItem).filter((item): item is ListingCollectionItem => Boolean(item))
.map(normalizeItem)
.filter((item): item is ListingCollectionItem => Boolean(item))
} catch { } catch {
localStorage.removeItem(key) localStorage.removeItem(key)
return [] return []
@@ -30,8 +30,12 @@ const {
} = useListingCollections() } = useListingCollections()
const activeTab = ref(route.query.tab === 'favorites' ? 'favorites' : 'history') const activeTab = ref(route.query.tab === 'favorites' ? 'favorites' : 'history')
const isMobilePage = computed(() => route.path.startsWith('/m/')) const isMobilePage = computed(() => route.path.startsWith('/m/'))
const activeItems = computed(() => (activeTab.value === 'favorites' ? favorites.value : history.value)) const activeItems = computed(() =>
const emptyText = computed(() => (activeTab.value === 'favorites' ? '暂无收藏账号' : '暂无浏览记录')) activeTab.value === 'favorites' ? favorites.value : history.value
)
const emptyText = computed(() =>
activeTab.value === 'favorites' ? '暂无收藏账号' : '暂无浏览记录'
)
async function handleClearHistory() { async function handleClearHistory() {
try { try {
@@ -81,13 +85,21 @@ function timeText(item: ListingCollectionItem) {
<h1>我的足迹</h1> <h1>我的足迹</h1>
<p>找回看过和收藏过的账号</p> <p>找回看过和收藏过的账号</p>
</div> </div>
<button v-if="activeTab === 'history' && history.length" type="button" @click="handleClearHistory"> <button
v-if="activeTab === 'history' && history.length"
type="button"
@click="handleClearHistory"
>
清空记录 清空记录
</button> </button>
</header> </header>
<nav class="collection-tabs"> <nav class="collection-tabs">
<button :class="{ active: activeTab === 'history' }" type="button" @click="activeTab = 'history'"> <button
:class="{ active: activeTab === 'history' }"
type="button"
@click="activeTab = 'history'"
>
浏览记录 <span>{{ history.length }}</span> 浏览记录 <span>{{ history.length }}</span>
</button> </button>
<button <button
@@ -291,7 +291,6 @@ function updateAgreementReadState(type: 'virtual' | 'renter') {
} }
} }
// 手动锁定/解锁背景滚动 // 手动锁定/解锁背景滚动
watch(agreementVisible, visible => { watch(agreementVisible, visible => {
// 只锁定 .pc-main 容器,不影响 body 和 sticky 导航栏 // 只锁定 .pc-main 容器,不影响 body 和 sticky 导航栏
@@ -513,7 +512,11 @@ function handleToggleFavorite() {
> >
{{ listing.in_transaction ? '交易中' : '立即下单' }} {{ listing.in_transaction ? '交易中' : '立即下单' }}
</el-button> </el-button>
<el-button class="full-control favorite-order-btn" size="large" @click="handleToggleFavorite"> <el-button
class="full-control favorite-order-btn"
size="large"
@click="handleToggleFavorite"
>
{{ listingFavorited ? '取消收藏' : '收藏账号' }} {{ listingFavorited ? '取消收藏' : '收藏账号' }}
</el-button> </el-button>
</el-form> </el-form>
+3 -1
View File
@@ -237,7 +237,9 @@ export function startPayment(orderId: number, payWay: string, jsPayFlag?: string
} }
export async function queryOrderPayment(orderId: number) { export async function queryOrderPayment(orderId: number) {
const { data } = await apiClient.get<ApiResponse<PaymentOrder>>(`/orders/${orderId}/query-payment`) const { data } = await apiClient.get<ApiResponse<PaymentOrder>>(
`/orders/${orderId}/query-payment`
)
return data.data return data.data
} }
@@ -479,7 +479,9 @@ export function useOrderActions(options: UseOrderActionsOptions) {
uploadingEvidence.value = true uploadingEvidence.value = true
try { try {
const uploaded = await uploadFile(file, 'dispute') const uploaded = await uploadFile(file, 'dispute')
disputeEvidenceText.value = [disputeEvidenceText.value, uploaded.url].filter(Boolean).join('\n') disputeEvidenceText.value = [disputeEvidenceText.value, uploaded.url]
.filter(Boolean)
.join('\n')
options.notifySuccess('证据文件已上传') options.notifySuccess('证据文件已上传')
} catch (error) { } catch (error) {
options.notifyError(readError(error, '上传失败')) options.notifyError(readError(error, '上传失败'))
@@ -132,7 +132,6 @@ function getStatusTagType(status: string) {
return 'danger' return 'danger'
} }
async function copyListingCode() { async function copyListingCode() {
if (!order.value) return if (!order.value) return
try { try {
@@ -144,7 +143,6 @@ async function copyListingCode() {
} }
</script> </script>
<template> <template>
<main class="mobile-order-detail-view"> <main class="mobile-order-detail-view">
<header class="page-header"> <header class="page-header">
@@ -158,7 +158,6 @@ async function copyListingCode() {
} }
</script> </script>
<template> <template>
<section class="page order-detail-page" v-loading="loading"> <section class="page order-detail-page" v-loading="loading">
<div v-if="order" class="page-header"> <div v-if="order" class="page-header">
@@ -103,7 +103,6 @@ async function handlePay(order: Order) {
} }
} }
function orderRole(order: Order) { function orderRole(order: Order) {
if (order.renter_id === session.userId) return '租客' if (order.renter_id === session.userId) return '租客'
if (order.owner_id === session.userId) return '号主' if (order.owner_id === session.userId) return '号主'
@@ -690,7 +690,10 @@ export function usePublishForm(options: UsePublishFormOptions) {
await router.push(options.submitSuccessPath) await router.push(options.submitSuccessPath)
} catch (error) { } catch (error) {
options.notifyError( options.notifyError(
readError(error, isEditMode.value ? '修改失败,请稍后重试' : '发布失败,请确认已登录并完成实名认证') readError(
error,
isEditMode.value ? '修改失败,请稍后重试' : '发布失败,请确认已登录并完成实名认证'
)
) )
} finally { } finally {
loading.value = false loading.value = false
@@ -966,7 +969,6 @@ export function usePublishForm(options: UsePublishFormOptions) {
} }
} }
function parseOnlineTime(value: string) { function parseOnlineTime(value: string) {
const match = /^(\d{2}):(\d{2})$/.exec(value) const match = /^(\d{2}):(\d{2})$/.exec(value)
if (!match) return null if (!match) return null
@@ -695,9 +695,9 @@ function selectDailyLoss(value: string | number) {
@click="handleSaveDraft" @click="handleSaveDraft"
>保存草稿</el-button >保存草稿</el-button
> >
<el-button :icon="RefreshRight" :disabled="loading" @click="handleResetDraft" <el-button :icon="RefreshRight" :disabled="loading" @click="handleResetDraft">{{
>{{ isEditMode ? '恢复原信息' : '重置草稿' }}</el-button isEditMode ? '恢复原信息' : '重置草稿'
> }}</el-button>
</div> </div>
</div> </div>
</aside> </aside>
@@ -160,7 +160,10 @@ async function handleAddAccount() {
return return
} }
if (!accountForm.account_no.trim()) { if (!accountForm.account_no.trim()) {
showToast({ message: accountForm.account_type === 'bank' ? '请输入银行卡号' : '请输入账号', icon: 'warning-o' }) showToast({
message: accountForm.account_type === 'bank' ? '请输入银行卡号' : '请输入账号',
icon: 'warning-o',
})
return return
} }
if (accountForm.account_type === 'bank' && !accountForm.bank_name.trim()) { if (accountForm.account_type === 'bank' && !accountForm.bank_name.trim()) {
@@ -416,7 +419,11 @@ function statusType(status: string): 'primary' | 'success' | 'danger' | 'warning
> >
<div class="popup-body"> <div class="popup-body">
<h2>添加收款账号</h2> <h2>添加收款账号</h2>
<van-radio-group v-model="accountForm.account_type" direction="horizontal" class="type-tabs"> <van-radio-group
v-model="accountForm.account_type"
direction="horizontal"
class="type-tabs"
>
<van-radio name="alipay">支付宝</van-radio> <van-radio name="alipay">支付宝</van-radio>
<van-radio name="wechat">微信</van-radio> <van-radio name="wechat">微信</van-radio>
<van-radio name="bank">银行卡</van-radio> <van-radio name="bank">银行卡</van-radio>
@@ -447,11 +454,7 @@ function statusType(status: string): 'primary' | 'success' | 'danger' | 'warning
placeholder="如:中国工商银行" placeholder="如:中国工商银行"
required required
/> />
<van-field <van-field v-model.trim="accountForm.bank_branch" label="开户支行" placeholder="可选" />
v-model.trim="accountForm.bank_branch"
label="开户支行"
placeholder="可选"
/>
</template> </template>
<div class="account-tip"> <div class="account-tip">
@@ -232,7 +232,6 @@ function amountPrefix(direction: string) {
@size-change="handleSizeChange" @size-change="handleSizeChange"
/> />
</div> </div>
</section> </section>
</template> </template>
+18 -3
View File
@@ -117,9 +117,19 @@ const allNavGroups: NavGroup[] = [
icon: Document, icon: Document,
permission: 'wallet:view', permission: 'wallet:view',
}, },
{ label: '资金流水', to: adminPath('wallet-ledger'), icon: Wallet, permission: 'wallet:view' }, {
label: '资金流水',
to: adminPath('wallet-ledger'),
icon: Wallet,
permission: 'wallet:view',
},
{ label: '支付流水', to: adminPath('payments'), icon: CreditCard, permission: 'wallet:view' }, { label: '支付流水', to: adminPath('payments'), icon: CreditCard, permission: 'wallet:view' },
{ label: '提现审核', to: adminPath('withdrawals'), icon: Money, permission: 'withdrawal:list' }, {
label: '提现审核',
to: adminPath('withdrawals'),
icon: Money,
permission: 'withdrawal:list',
},
{ {
label: '支付配置', label: '支付配置',
to: adminPath('payment-configs'), to: adminPath('payment-configs'),
@@ -152,7 +162,12 @@ const allNavGroups: NavGroup[] = [
index: 'system-auth', index: 'system-auth',
icon: Lock, icon: Lock,
children: [ children: [
{ label: '审计日志', to: adminPath('audit-logs'), icon: Document, permission: 'audit_log:view' }, {
label: '审计日志',
to: adminPath('audit-logs'),
icon: Document,
permission: 'audit_log:view',
},
{ {
label: '管理员管理', label: '管理员管理',
to: adminPath('admin-users'), to: adminPath('admin-users'),
+1 -7
View File
@@ -2,13 +2,7 @@
* API 性能监控 * API 性能监控
* 记录和分析 API 请求性能 * 记录和分析 API 请求性能
*/ */
import { import { debugGroup, debugGroupEnd, debugLog, debugTable, debugWarn } from '@/shared/utils/debug'
debugGroup,
debugGroupEnd,
debugLog,
debugTable,
debugWarn,
} from '@/shared/utils/debug'
interface RequestMetrics { interface RequestMetrics {
url: string url: string
@@ -59,7 +59,6 @@ export function useSmsCountdown() {
} }
} }
return { return {
countDown, countDown,
sending, sending,
+1 -4
View File
@@ -1,7 +1,4 @@
type DebugConsole = Pick< type DebugConsole = Pick<Console, 'log' | 'warn' | 'error' | 'group' | 'groupEnd' | 'table'>
Console,
'log' | 'warn' | 'error' | 'group' | 'groupEnd' | 'table'
>
function runInDev(method: keyof DebugConsole, args: unknown[]) { function runInDev(method: keyof DebugConsole, args: unknown[]) {
if (!import.meta.env.DEV) return if (!import.meta.env.DEV) return