新增合作与反馈入口配置
This commit is contained in:
@@ -3,10 +3,12 @@ import { computed, ref, watch } from 'vue'
|
||||
import { RouterLink, onBeforeRouteLeave, useRoute, useRouter } from 'vue-router'
|
||||
import {
|
||||
defaultAWRecycleConfig,
|
||||
defaultCooperationFeedbackConfig,
|
||||
defaultHomeAnnouncements,
|
||||
defaultHomeBanners,
|
||||
fetchMobileHomeConfig,
|
||||
type AWRecycleConfig,
|
||||
type CooperationFeedbackConfig,
|
||||
type HomeBannerSlide,
|
||||
} from '@/features/listings/api/homeConfig'
|
||||
import { ElMessage } from 'element-plus'
|
||||
@@ -43,6 +45,8 @@ const announcements = ref<string[]>(defaultHomeAnnouncements)
|
||||
const banners = ref<HomeBannerSlide[]>(defaultHomeBanners)
|
||||
const awRecycle = ref<AWRecycleConfig>({ ...defaultAWRecycleConfig })
|
||||
const awRecycleDialogVisible = ref(false)
|
||||
const cooperationFeedback = ref<CooperationFeedbackConfig>({ ...defaultCooperationFeedbackConfig })
|
||||
const cooperationFeedbackDialogVisible = ref(false)
|
||||
const publishOptions = ref<ListingPublishOptions>(emptyListingPublishOptions)
|
||||
const sortBy = ref('recommended')
|
||||
const sortOptions = [
|
||||
@@ -156,11 +160,13 @@ async function loadHome() {
|
||||
announcements.value = config.announcements
|
||||
banners.value = config.banners
|
||||
awRecycle.value = config.aw_recycle
|
||||
cooperationFeedback.value = config.cooperation_feedback
|
||||
publishOptions.value = config.publish_options
|
||||
} catch {
|
||||
announcements.value = defaultHomeAnnouncements
|
||||
banners.value = defaultHomeBanners
|
||||
awRecycle.value = { ...defaultAWRecycleConfig }
|
||||
cooperationFeedback.value = { ...defaultCooperationFeedbackConfig }
|
||||
publishOptions.value = emptyListingPublishOptions
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -176,6 +182,14 @@ function openAWRecycle() {
|
||||
awRecycleDialogVisible.value = true
|
||||
}
|
||||
|
||||
function openCooperationFeedback() {
|
||||
if (!cooperationFeedback.value.image_url) {
|
||||
ElMessage.warning('合作与反馈图片尚未配置,请稍后再试')
|
||||
return
|
||||
}
|
||||
cooperationFeedbackDialogVisible.value = true
|
||||
}
|
||||
|
||||
function updateFilters(partial: Partial<typeof filters>) {
|
||||
Object.assign(filters, partial)
|
||||
}
|
||||
@@ -366,6 +380,15 @@ loadHome()
|
||||
<strong>{{ awRecycle.title }}</strong>
|
||||
<small>{{ awRecycle.subtitle }}</small>
|
||||
</button>
|
||||
<button
|
||||
v-if="cooperationFeedback.enabled"
|
||||
type="button"
|
||||
class="biz-entry cooperation-feedback"
|
||||
@click="openCooperationFeedback"
|
||||
>
|
||||
<strong>{{ cooperationFeedback.title }}</strong>
|
||||
<small>{{ cooperationFeedback.subtitle }}</small>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@@ -387,6 +410,25 @@ loadHome()
|
||||
<el-empty v-else description="暂无展示图片" />
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="cooperationFeedbackDialogVisible"
|
||||
:title="cooperationFeedback.title"
|
||||
width="720px"
|
||||
class="aw-recycle-dialog"
|
||||
align-center
|
||||
destroy-on-close
|
||||
>
|
||||
<AuthImage
|
||||
v-if="cooperationFeedback.image_url"
|
||||
:source="cooperationFeedback.image_url"
|
||||
:alt="cooperationFeedback.title"
|
||||
fit="contain"
|
||||
image-class="aw-recycle-image"
|
||||
:preview-src-list="[cooperationFeedback.image_url]"
|
||||
/>
|
||||
<el-empty v-else description="暂无展示图片" />
|
||||
</el-dialog>
|
||||
|
||||
<HomeFilters
|
||||
:filters="filters"
|
||||
:total-listings="totalListings"
|
||||
@@ -463,7 +505,7 @@ loadHome()
|
||||
|
||||
.biz-entry-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@@ -514,6 +556,11 @@ loadHome()
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 100%);
|
||||
}
|
||||
|
||||
.biz-entry.cooperation-feedback {
|
||||
border-color: #d9f0e5;
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f1fbf6 100%);
|
||||
}
|
||||
|
||||
:deep(.aw-recycle-image) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user