增加前端格式检查配置
This commit is contained in:
@@ -69,25 +69,39 @@ const agreementsVisible = ref(false)
|
||||
const postRentalNoticeVisible = ref(false)
|
||||
const generalVisible = ref(false)
|
||||
|
||||
const publishConfig = computed(() => configs.value.find((item) => item.key === 'listing.publish_options') || null)
|
||||
const salePriceConfig = computed(() => configs.value.find((item) => item.key === 'listing.sale_price_config') || null)
|
||||
const homeAnnouncementsConfig = computed(() => configs.value.find((item) => item.key === 'mobile.home_announcements') || null)
|
||||
const homeBannersConfig = computed(() => configs.value.find((item) => item.key === 'mobile.home_banners') || null)
|
||||
const listingPublishAgreementsConfig = computed(() => configs.value.find((item) => item.key === 'listing.publish_agreements') || null)
|
||||
const orderAgreementsConfig = computed(() => configs.value.find((item) => item.key === 'order.agreements') || null)
|
||||
const postRentalNoticeConfig = computed(() => configs.value.find((item) => item.key === 'profile.post_rental_notice') || null)
|
||||
const publishConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'listing.publish_options') || null
|
||||
)
|
||||
const salePriceConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'listing.sale_price_config') || null
|
||||
)
|
||||
const homeAnnouncementsConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'mobile.home_announcements') || null
|
||||
)
|
||||
const homeBannersConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'mobile.home_banners') || null
|
||||
)
|
||||
const listingPublishAgreementsConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'listing.publish_agreements') || null
|
||||
)
|
||||
const orderAgreementsConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'order.agreements') || null
|
||||
)
|
||||
const postRentalNoticeConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'profile.post_rental_notice') || null
|
||||
)
|
||||
|
||||
const regularConfigs = computed(() =>
|
||||
configs.value.filter(
|
||||
(item) =>
|
||||
item =>
|
||||
item.key !== 'listing.publish_options' &&
|
||||
item.key !== 'listing.sale_price_config' &&
|
||||
item.key !== 'mobile.home_announcements' &&
|
||||
item.key !== 'mobile.home_banners' &&
|
||||
item.key !== 'listing.publish_agreements' &&
|
||||
item.key !== 'order.agreements' &&
|
||||
item.key !== 'profile.post_rental_notice',
|
||||
),
|
||||
item.key !== 'profile.post_rental_notice'
|
||||
)
|
||||
)
|
||||
|
||||
// 只读计算属性,用于渲染卡片上的统计信息
|
||||
@@ -134,7 +148,9 @@ const agreementStats = computed(() => {
|
||||
})
|
||||
|
||||
const listingPublishAgreementStats = computed(() => {
|
||||
const agreements = parseListingPublishAgreements(listingPublishAgreementsConfig.value?.value || '')
|
||||
const agreements = parseListingPublishAgreements(
|
||||
listingPublishAgreementsConfig.value?.value || ''
|
||||
)
|
||||
return {
|
||||
saleTitle: agreements.virtual_asset_sale.title || '出售协议',
|
||||
sellerTitle: agreements.seller_agreement.title || '号主协议',
|
||||
@@ -199,12 +215,24 @@ function parseOrderAgreements(raw: string) {
|
||||
const parsed = safeParseJSON(raw, defaultOrderAgreements)
|
||||
return {
|
||||
virtual_asset_purchase: {
|
||||
title: readText(parsed.virtual_asset_purchase?.title, defaultOrderAgreements.virtual_asset_purchase.title),
|
||||
content: readText(parsed.virtual_asset_purchase?.content, defaultOrderAgreements.virtual_asset_purchase.content),
|
||||
title: readText(
|
||||
parsed.virtual_asset_purchase?.title,
|
||||
defaultOrderAgreements.virtual_asset_purchase.title
|
||||
),
|
||||
content: readText(
|
||||
parsed.virtual_asset_purchase?.content,
|
||||
defaultOrderAgreements.virtual_asset_purchase.content
|
||||
),
|
||||
},
|
||||
renter_agreement: {
|
||||
title: readText(parsed.renter_agreement?.title, defaultOrderAgreements.renter_agreement.title),
|
||||
content: readText(parsed.renter_agreement?.content, defaultOrderAgreements.renter_agreement.content),
|
||||
title: readText(
|
||||
parsed.renter_agreement?.title,
|
||||
defaultOrderAgreements.renter_agreement.title
|
||||
),
|
||||
content: readText(
|
||||
parsed.renter_agreement?.content,
|
||||
defaultOrderAgreements.renter_agreement.content
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -213,12 +241,24 @@ function parseListingPublishAgreements(raw: string) {
|
||||
const parsed = safeParseJSON(raw, defaultListingPublishAgreements)
|
||||
return {
|
||||
virtual_asset_sale: {
|
||||
title: readText(parsed.virtual_asset_sale?.title, defaultListingPublishAgreements.virtual_asset_sale.title),
|
||||
content: readText(parsed.virtual_asset_sale?.content, defaultListingPublishAgreements.virtual_asset_sale.content),
|
||||
title: readText(
|
||||
parsed.virtual_asset_sale?.title,
|
||||
defaultListingPublishAgreements.virtual_asset_sale.title
|
||||
),
|
||||
content: readText(
|
||||
parsed.virtual_asset_sale?.content,
|
||||
defaultListingPublishAgreements.virtual_asset_sale.content
|
||||
),
|
||||
},
|
||||
seller_agreement: {
|
||||
title: readText(parsed.seller_agreement?.title, defaultListingPublishAgreements.seller_agreement.title),
|
||||
content: readText(parsed.seller_agreement?.content, defaultListingPublishAgreements.seller_agreement.content),
|
||||
title: readText(
|
||||
parsed.seller_agreement?.title,
|
||||
defaultListingPublishAgreements.seller_agreement.title
|
||||
),
|
||||
content: readText(
|
||||
parsed.seller_agreement?.content,
|
||||
defaultListingPublishAgreements.seller_agreement.content
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -343,8 +383,12 @@ function formatConfigValue(row: SystemConfig) {
|
||||
<span>管理首页公告滚动内容和顶部轮播图,保存后移动端会从接口读取最新配置。</span>
|
||||
</div>
|
||||
<div class="panel-actions">
|
||||
<el-button v-if="homeAnnouncementsConfig" @click="openEdit(homeAnnouncementsConfig)">编辑公告</el-button>
|
||||
<el-button v-if="homeBannersConfig" type="primary" @click="openEdit(homeBannersConfig)">编辑轮播图</el-button>
|
||||
<el-button v-if="homeAnnouncementsConfig" @click="openEdit(homeAnnouncementsConfig)"
|
||||
>编辑公告</el-button
|
||||
>
|
||||
<el-button v-if="homeBannersConfig" type="primary" @click="openEdit(homeBannersConfig)"
|
||||
>编辑轮播图</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="publish-stat-grid home-stat-grid">
|
||||
@@ -378,7 +422,9 @@ function formatConfigValue(row: SystemConfig) {
|
||||
<h2>发布协议配置</h2>
|
||||
<span>管理发布账号前必须勾选确认的虚拟资产出售协议和号主协议。</span>
|
||||
</div>
|
||||
<el-button type="primary" @click="openEdit(listingPublishAgreementsConfig)">编辑发布协议</el-button>
|
||||
<el-button type="primary" @click="openEdit(listingPublishAgreementsConfig)"
|
||||
>编辑发布协议</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="publish-stat-grid home-stat-grid">
|
||||
<div class="publish-stat">
|
||||
|
||||
Reference in New Issue
Block a user