增加前端格式检查配置
This commit is contained in:
@@ -4,7 +4,12 @@ import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import { fetchAdminFileBlob } from '@/shared/api/files'
|
||||
import { adminMarkListingAbnormal, adminOfflineListing, fetchAdminListing, type Listing } from '@/features/listings'
|
||||
import {
|
||||
adminMarkListingAbnormal,
|
||||
adminOfflineListing,
|
||||
fetchAdminListing,
|
||||
type Listing,
|
||||
} from '@/features/listings'
|
||||
import { listingReviewStatusLabel, listingStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
|
||||
@@ -15,8 +20,15 @@ const listing = ref<Listing | null>(null)
|
||||
const actionType = ref<'offline' | 'abnormal' | ''>('')
|
||||
const reason = ref('')
|
||||
|
||||
const actionTitle = computed(() => (actionType.value === 'offline' ? '强制下架商品' : '标记商品异常'))
|
||||
const canOperate = computed(() => !!listing.value && listing.value.status !== 'rented' && !['offline', 'abnormal'].includes(listing.value.status))
|
||||
const actionTitle = computed(() =>
|
||||
actionType.value === 'offline' ? '强制下架商品' : '标记商品异常'
|
||||
)
|
||||
const canOperate = computed(
|
||||
() =>
|
||||
!!listing.value &&
|
||||
listing.value.status !== 'rented' &&
|
||||
!['offline', 'abnormal'].includes(listing.value.status)
|
||||
)
|
||||
|
||||
onMounted(loadListing)
|
||||
|
||||
@@ -100,8 +112,12 @@ function readError(error: unknown, fallback: string) {
|
||||
<RouterLink to="/admin/listings">
|
||||
<el-button>返回列表</el-button>
|
||||
</RouterLink>
|
||||
<el-button type="warning" :disabled="!canOperate" @click="openAction('offline')">强制下架</el-button>
|
||||
<el-button type="danger" :disabled="!canOperate" @click="openAction('abnormal')">标记异常</el-button>
|
||||
<el-button type="warning" :disabled="!canOperate" @click="openAction('offline')"
|
||||
>强制下架</el-button
|
||||
>
|
||||
<el-button type="danger" :disabled="!canOperate" @click="openAction('abnormal')"
|
||||
>标记异常</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -164,10 +180,22 @@ function readError(error: unknown, fallback: string) {
|
||||
<p v-else>暂无截图</p>
|
||||
</div>
|
||||
|
||||
<el-dialog :model-value="!!actionType" :title="actionTitle" width="560px" @update:model-value="actionType = ''">
|
||||
<el-dialog
|
||||
:model-value="!!actionType"
|
||||
:title="actionTitle"
|
||||
width="560px"
|
||||
@update:model-value="actionType = ''"
|
||||
>
|
||||
<div v-if="listing" class="dialog-body">
|
||||
<p><strong>{{ listing.title }}</strong></p>
|
||||
<el-input v-model="reason" type="textarea" :rows="4" placeholder="填写后台操作原因,会写入审计日志并通知号主" />
|
||||
<p>
|
||||
<strong>{{ listing.title }}</strong>
|
||||
</p>
|
||||
<el-input
|
||||
v-model="reason"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="填写后台操作原因,会写入审计日志并通知号主"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="actionType = ''">取消</el-button>
|
||||
|
||||
Reference in New Issue
Block a user