强化前端格式检测

This commit is contained in:
yml2213
2026-06-08 06:46:47 +08:00
parent 500f511185
commit 04f42e5a96
23 changed files with 17 additions and 64 deletions
+3 -1
View File
@@ -9,9 +9,11 @@
"preview": "vite preview --host 0.0.0.0", "preview": "vite preview --host 0.0.0.0",
"typecheck": "vue-tsc -b --noEmit", "typecheck": "vue-tsc -b --noEmit",
"lint": "eslint .", "lint": "eslint .",
"lint:strict": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix", "lint:fix": "eslint . --fix",
"format": "prettier --write .", "format": "prettier --write .",
"format:check": "prettier --check ." "format:check": "prettier --check .",
"check": "npm run format:check && npm run lint:strict && npm run typecheck"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
@@ -93,12 +93,6 @@ async function handleSubmit() {
submitting.value = false submitting.value = false
} }
} }
function getStatusTag(count: number) {
if (count === 0) return { text: '空闲', type: 'success' }
if (count <= 3) return { text: '正常', type: '' }
return { text: '繁忙', type: 'warning' }
}
</script> </script>
<template> <template>
@@ -66,7 +66,7 @@ async function loadAnnouncements() {
}) })
announcements.value = result.items announcements.value = result.items
total.value = result.total total.value = result.total
} catch (err) { } catch {
ElMessage.error('加载公告列表失败') ElMessage.error('加载公告列表失败')
} finally { } finally {
loading.value = false loading.value = false
@@ -96,7 +96,7 @@ async function handleSave(data: CreateAnnouncementRequest | UpdateAnnouncementRe
} }
dialogVisible.value = false dialogVisible.value = false
loadAnnouncements() loadAnnouncements()
} catch (err) { } catch {
ElMessage.error('保存失败') ElMessage.error('保存失败')
} }
} }
@@ -161,11 +161,6 @@ async function handlePageChange() {
await loadAnnouncements() await loadAnnouncements()
} }
async function handleSizeChange() {
currentPage.value = 1
await loadAnnouncements()
}
function getCategoryLabel(category: string) { function getCategoryLabel(category: string) {
return categories.find(c => c.value === category)?.label || category return categories.find(c => c.value === category)?.label || category
} }
@@ -54,11 +54,6 @@ async function handlePageChange() {
await loadLogs() await loadLogs()
} }
async function handleSizeChange() {
currentPage.value = 1
await loadLogs()
}
function actorName(row: AdminAuditLog) { function actorName(row: AdminAuditLog) {
return row.actor_nickname || row.actor_username || `${row.actor_type} ${row.actor_id}` return row.actor_nickname || row.actor_username || `${row.actor_type} ${row.actor_id}`
} }
@@ -47,7 +47,7 @@ const activeMembers = computed(() => {
const participants = active.value?.participants || [] const participants = active.value?.participants || []
return participants return participants
.map(item => { .map(item => {
const remark = getParticipantRemark(item) const remark = getParticipantRemark()
const name = remark ? `${remark}(${item.display_name})` : item.display_name const name = remark ? `${remark}(${item.display_name})` : item.display_name
return `${roleLabel(item.role)}${name}` return `${roleLabel(item.role)}${name}`
}) })
@@ -58,7 +58,7 @@ const canSend = computed(() => content.value.trim() !== '' || attachments.value.
// 桌面通知 // 桌面通知
const desktopNotification = useDesktopNotification('admin') const desktopNotification = useDesktopNotification('admin')
function getParticipantRemark(participant: any) { function getParticipantRemark() {
if (!active.value) return '' if (!active.value) return ''
const myParticipant = active.value.participants?.find( const myParticipant = active.value.participants?.find(
p => p.participant_type === 'admin' && p.participant_id === currentAdminId p => p.participant_type === 'admin' && p.participant_id === currentAdminId
@@ -37,11 +37,6 @@ async function handlePageChange() {
await loadDisputes() await loadDisputes()
} }
async function handleSizeChange() {
currentPage.value = 1
await loadDisputes()
}
function openArbitration(row: Dispute) { function openArbitration(row: Dispute) {
activeDispute.value = row activeDispute.value = row
result.value = row.arbitration_result || 'release_deposit' result.value = row.arbitration_result || 'release_deposit'
@@ -31,7 +31,6 @@ const {
currentPage, currentPage,
currentPageSize, currentPageSize,
load: loadAdmins, load: loadAdmins,
handleSizeChange,
} = useAdminPaginatedTable<AdminMgrUser>({ } = useAdminPaginatedTable<AdminMgrUser>({
fetchFn: fetchAdminMgrUsers, fetchFn: fetchAdminMgrUsers,
}) })
@@ -24,7 +24,6 @@ const {
currentPage, currentPage,
currentPageSize, currentPageSize,
load: loadUsers, load: loadUsers,
handleSizeChange,
} = useAdminPaginatedTable<AdminUserItem>({ } = useAdminPaginatedTable<AdminUserItem>({
fetchFn: fetchAdminUsers, fetchFn: fetchAdminUsers,
}) })
@@ -63,11 +63,6 @@ async function handlePageChange() {
await loadLedger() await loadLedger()
} }
async function handleSizeChange() {
currentPage.value = 1
await loadLedger()
}
function money(value: number) { function money(value: number) {
return `¥${Math.round(Number(value || 0))}` return `¥${Math.round(Number(value || 0))}`
} }
@@ -16,7 +16,7 @@ const form = reactive({
code: '', code: '',
}) })
const { countDown, sending, handleSendCode, readError } = useSmsCountdown() const { countDown, sending, handleSendCode } = useSmsCountdown()
async function handleLogin() { async function handleLogin() {
if (!agreed.value) { if (!agreed.value) {
@@ -42,7 +42,7 @@ async function handleAvatarFileChange(event: Event) {
if (!file) return if (!file) return
uploadingAvatar.value = true uploadingAvatar.value = true
const toast = showToast({ const loadingToast = showToast({
type: 'loading', type: 'loading',
message: '上传中...', message: '上传中...',
forbidClick: true, forbidClick: true,
@@ -56,6 +56,7 @@ async function handleAvatarFileChange(event: Event) {
} catch (error) { } catch (error) {
showToast({ message: readError(error, '上传失败'), icon: 'cross' }) showToast({ message: readError(error, '上传失败'), icon: 'cross' })
} finally { } finally {
loadingToast.close()
uploadingAvatar.value = false uploadingAvatar.value = false
} }
} }
@@ -17,7 +17,7 @@ const form = reactive({
inviteCode: '', inviteCode: '',
}) })
const { countDown, sending, handleSendCode, readError } = useSmsCountdown() const { countDown, sending, handleSendCode } = useSmsCountdown()
async function handleRegister() { async function handleRegister() {
if (!agreed.value) { if (!agreed.value) {
@@ -2,7 +2,7 @@
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { ChatDotRound, Refresh, Tickets } from '@element-plus/icons-vue' import { Refresh, Tickets } from '@element-plus/icons-vue'
import { fetchChats, type ChatConversation } from '@/features/chats/api/chats' import { fetchChats, type ChatConversation } from '@/features/chats/api/chats'
import { useChatSSE, type ChatEvent } from '@/features/chats/composables/useChatSSE' import { useChatSSE, type ChatEvent } from '@/features/chats/composables/useChatSSE'
import { useDesktopNotification } from '@/features/chats/composables/useDesktopNotification' import { useDesktopNotification } from '@/features/chats/composables/useDesktopNotification'
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { Filter, Refresh, ArrowDown } from '@element-plus/icons-vue' import { Filter, Refresh } from '@element-plus/icons-vue'
import { ElButton, ElIcon } from 'element-plus' import { ElButton, ElIcon } from 'element-plus'
import RangeFilter from './RangeFilter.vue' import RangeFilter from './RangeFilter.vue'
import StringFilter from './StringFilter.vue' import StringFilter from './StringFilter.vue'
@@ -12,7 +12,7 @@ interface Props {
sortBy: string sortBy: string
} }
const props = defineProps<Props>() defineProps<Props>()
const emit = defineEmits<{ const emit = defineEmits<{
'update:activeZone': [value: string] 'update:activeZone': [value: string]
@@ -36,10 +36,7 @@ describe('useHomeFilters', () => {
const publishOptions = ref(emptyListingPublishOptions) const publishOptions = ref(emptyListingPublishOptions)
const listings = ref([]) const listings = ref([])
const { filters, setStringFilter, closeFilterPopover } = useHomeFilters( const { filters, setStringFilter } = useHomeFilters(publishOptions, listings)
publishOptions,
listings
)
setStringFilter('region', '上海') setStringFilter('region', '上海')
@@ -45,7 +45,6 @@ const {
loadingMore, loadingMore,
listings, listings,
totalListings, totalListings,
zoneCounts,
hasMoreListings, hasMoreListings,
loadListingsPage, loadListingsPage,
zoneCount, zoneCount,
@@ -28,7 +28,6 @@ import {
getOnlineTimeText, getOnlineTimeText,
getLoginMethod, getLoginMethod,
getServerRegion, getServerRegion,
readAssetNumber,
readAssetString, readAssetString,
} from '@/utils/listingDisplay' } from '@/utils/listingDisplay'
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { import {
emptyListingPublishOptions, emptyListingPublishOptions,
@@ -30,7 +30,6 @@ import {
readAssetNumber, readAssetNumber,
readAssetString, readAssetString,
} from '@/utils/listingDisplay' } from '@/utils/listingDisplay'
import { listingStatusLabel } from '@/utils/statusLabels'
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
/* 数据加载 */ /* 数据加载 */
@@ -256,12 +256,6 @@ function readError(error: unknown, fallback: string) {
} }
return fallback return fallback
} }
/** 判断当前底部导航是否激活 */
function isNavActive(path: string) {
if (path === '/m') return route.path === '/m'
return route.path.startsWith(path)
}
</script> </script>
<template> <template>
@@ -36,7 +36,6 @@ const {
screenshotSlots, screenshotSlots,
priceConfig, priceConfig,
fireLevelPlaceholder, fireLevelPlaceholder,
coinMAmount,
dailyLossMAmount, dailyLossMAmount,
calculatedDefaultSaleRatio, calculatedDefaultSaleRatio,
maxAcceleratedSaleRatio, maxAcceleratedSaleRatio,
@@ -100,15 +100,6 @@ async function handleSubmit() {
} }
} }
function accountTypeLabel(type: string) {
const labels: Record<string, string> = {
alipay: '支付宝',
wechat: '微信',
bank: '银行卡',
}
return labels[type] || type
}
async function handleUpload(event: Event) { async function handleUpload(event: Event) {
const input = event.target as HTMLInputElement const input = event.target as HTMLInputElement
const file = input.files?.[0] const file = input.files?.[0]
@@ -2,7 +2,7 @@
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { Wallet, Money, DocumentChecked, Warning } from '@element-plus/icons-vue' import { Wallet, Money } from '@element-plus/icons-vue'
import { import {
fetchPaymentAccounts, fetchPaymentAccounts,