增加前端格式检查配置
This commit is contained in:
@@ -3,7 +3,12 @@ import { Plus, Refresh } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
|
||||
import { fetchSellerListings, offlineListing, submitListingReview, type Listing } from '@/features/listings'
|
||||
import {
|
||||
fetchSellerListings,
|
||||
offlineListing,
|
||||
submitListingReview,
|
||||
type Listing,
|
||||
} from '@/features/listings'
|
||||
import { listingReviewStatusLabel, listingStatusLabel } from '@/utils/statusLabels'
|
||||
import { getListingSellerPrice } from '@/utils/listingDisplay'
|
||||
|
||||
@@ -15,15 +20,27 @@ const statusFilter = ref('all')
|
||||
|
||||
const displayListings = computed(() => {
|
||||
if (statusFilter.value === 'all') return listings.value
|
||||
if (statusFilter.value === 'pending') return listings.value.filter((item) => isPendingReview(item))
|
||||
return listings.value.filter((item) => item.status === statusFilter.value)
|
||||
if (statusFilter.value === 'pending') return listings.value.filter(item => isPendingReview(item))
|
||||
return listings.value.filter(item => item.status === statusFilter.value)
|
||||
})
|
||||
|
||||
const stats = computed(() => [
|
||||
{ key: 'all', label: '全部发布', value: listings.value.length },
|
||||
{ key: 'published', label: '已上架', value: listings.value.filter((item) => item.status === 'published').length },
|
||||
{ key: 'pending', label: '待审核', value: listings.value.filter((item) => isPendingReview(item)).length },
|
||||
{ key: 'offline', label: '已下架', value: listings.value.filter((item) => item.status === 'offline').length },
|
||||
{
|
||||
key: 'published',
|
||||
label: '已上架',
|
||||
value: listings.value.filter(item => item.status === 'published').length,
|
||||
},
|
||||
{
|
||||
key: 'pending',
|
||||
label: '待审核',
|
||||
value: listings.value.filter(item => isPendingReview(item)).length,
|
||||
},
|
||||
{
|
||||
key: 'offline',
|
||||
label: '已下架',
|
||||
value: listings.value.filter(item => item.status === 'offline').length,
|
||||
},
|
||||
])
|
||||
|
||||
onMounted(loadListings)
|
||||
@@ -45,7 +62,7 @@ async function submitReview(row: Listing) {
|
||||
ElMessage.success(
|
||||
listing.status === 'published' && listing.review_status === 'approved'
|
||||
? '已上架'
|
||||
: '已提交审核,等待后台处理',
|
||||
: '已提交审核,等待后台处理'
|
||||
)
|
||||
} finally {
|
||||
submittingID.value = null
|
||||
@@ -54,11 +71,15 @@ async function submitReview(row: Listing) {
|
||||
|
||||
async function offline(row: Listing) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认下架「${row.title}」吗?下架后后台待审列表会同步移除。`, '下架确认', {
|
||||
confirmButtonText: '确认下架',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
await ElMessageBox.confirm(
|
||||
`确认下架「${row.title}」吗?下架后后台待审列表会同步移除。`,
|
||||
'下架确认',
|
||||
{
|
||||
confirmButtonText: '确认下架',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
@@ -73,7 +94,7 @@ async function offline(row: Listing) {
|
||||
}
|
||||
|
||||
function replaceListing(next: Listing) {
|
||||
const index = listings.value.findIndex((item) => item.id === next.id)
|
||||
const index = listings.value.findIndex(item => item.id === next.id)
|
||||
if (index >= 0) {
|
||||
listings.value.splice(index, 1, next)
|
||||
} else {
|
||||
@@ -166,7 +187,9 @@ function isPendingReview(row: Listing) {
|
||||
<div class="listing-title-row">
|
||||
<h3>{{ item.title }}</h3>
|
||||
<div class="listing-tags">
|
||||
<span class="status-pill" :class="statusTone(item.status)">{{ listingStatusLabel(item.status) }}</span>
|
||||
<span class="status-pill" :class="statusTone(item.status)">{{
|
||||
listingStatusLabel(item.status)
|
||||
}}</span>
|
||||
<span class="status-pill" :class="reviewTone(effectiveReviewStatus(item))">
|
||||
{{ listingReviewStatusLabel(effectiveReviewStatus(item)) }}
|
||||
</span>
|
||||
@@ -273,7 +296,10 @@ function isPendingReview(row: Listing) {
|
||||
color: #64748b;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
|
||||
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
|
||||
transition:
|
||||
transform 0.18s ease,
|
||||
border-color 0.18s ease,
|
||||
box-shadow 0.18s ease;
|
||||
}
|
||||
|
||||
.stat-card span {
|
||||
|
||||
Reference in New Issue
Block a user