fix: 轮播管理强制展示点单第二横幅与个人中心背景选项
合并本地兜底 page_options,避免旧接口列表盖掉 UFO 两项;补充操作提示。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,10 +12,14 @@
|
||||
|
||||
<div class="header-bar">
|
||||
<h2>轮播图与公告管理</h2>
|
||||
<el-select v-model="pageKey" placeholder="选择页面" @change="onPageKeyChange">
|
||||
<el-select v-model="pageKey" placeholder="选择页面" @change="onPageKeyChange" style="min-width: 280px">
|
||||
<el-option v-for="opt in pageOptions" :key="opt.key" :label="opt.label" :value="opt.key" />
|
||||
</el-select>
|
||||
</div>
|
||||
<p class="page-hint">
|
||||
UFO 点单端:主轮播选「点单页主轮播」;公告下第二横幅选「点单页第二横幅(可多图)」;
|
||||
「我的」顶区背景选「点单个人中心背景(可多图)」。改图前请切到具体俱乐部(如 ufo),勿在集团视图下上传。
|
||||
</p>
|
||||
|
||||
<el-card class="section-card" shadow="never">
|
||||
<template #header><strong>{{ gonggaoTitle }}</strong></template>
|
||||
@@ -104,17 +108,43 @@ import request from '@/utils/request'
|
||||
import { JITUAN_API } from '@/utils/club-context'
|
||||
import ClubScopeHint from '@/components/ClubScopeHint.vue'
|
||||
|
||||
/** 本地兜底:即使接口 page_options 仍是旧列表,也要保证 UFO 两项可选 */
|
||||
const DEFAULT_PAGE_OPTIONS = [
|
||||
{ key: 'order_pool', label: '抢单池' },
|
||||
{ key: 'accept_order', label: '点单页主轮播' },
|
||||
{ key: 'accept_order_banner2', label: '点单页第二横幅(可多图)' },
|
||||
{ key: 'merchant_home', label: '商家首页' },
|
||||
{ key: 'dashou_center', label: '打手个人中心背景' },
|
||||
{ key: 'boss_center', label: '点单个人中心背景(可多图)' },
|
||||
]
|
||||
|
||||
function mergePageOptions(fromServer) {
|
||||
const map = new Map()
|
||||
DEFAULT_PAGE_OPTIONS.forEach((o) => map.set(o.key, { ...o }))
|
||||
;(fromServer || []).forEach((o) => {
|
||||
if (!o || !o.key) return
|
||||
const prev = map.get(o.key)
|
||||
map.set(o.key, {
|
||||
key: o.key,
|
||||
label: (prev && prev.label) || o.label || o.key,
|
||||
})
|
||||
})
|
||||
// 固定顺序:默认项在前,其余追加
|
||||
const ordered = []
|
||||
DEFAULT_PAGE_OPTIONS.forEach((o) => {
|
||||
if (map.has(o.key)) {
|
||||
ordered.push(map.get(o.key))
|
||||
map.delete(o.key)
|
||||
}
|
||||
})
|
||||
map.forEach((v) => ordered.push(v))
|
||||
return ordered
|
||||
}
|
||||
|
||||
const username = ref(localStorage.getItem('username') || '')
|
||||
const hasPermission = ref(true)
|
||||
const pageKey = ref('order_pool')
|
||||
const pageOptions = ref([
|
||||
{ key: 'order_pool', label: '抢单池' },
|
||||
{ key: 'accept_order', label: '点单页主轮播' },
|
||||
{ key: 'accept_order_banner2', label: '点单页横幅轮播' },
|
||||
{ key: 'merchant_home', label: '商家首页' },
|
||||
{ key: 'dashou_center', label: '打手个人中心背景' },
|
||||
{ key: 'boss_center', label: '点单个人中心背景' },
|
||||
])
|
||||
const pageOptions = ref(mergePageOptions([]))
|
||||
const gonggaoTitle = computed(() => {
|
||||
const opt = pageOptions.value.find((o) => o.key === pageKey.value)
|
||||
const label = opt ? opt.label : pageKey.value
|
||||
@@ -167,17 +197,7 @@ const fetchLunbo = async () => {
|
||||
})
|
||||
if (res.code === 0) {
|
||||
lunboList.value = res.data?.list || []
|
||||
pageOptions.value = res.data?.page_options || []
|
||||
if (!pageOptions.value.length) {
|
||||
pageOptions.value = [
|
||||
{ key: 'order_pool', label: '抢单池' },
|
||||
{ key: 'accept_order', label: '点单页主轮播' },
|
||||
{ key: 'accept_order_banner2', label: '点单页横幅轮播' },
|
||||
{ key: 'merchant_home', label: '商家首页' },
|
||||
{ key: 'dashou_center', label: '打手个人中心背景' },
|
||||
{ key: 'boss_center', label: '点单个人中心背景' },
|
||||
]
|
||||
}
|
||||
pageOptions.value = mergePageOptions(res.data?.page_options)
|
||||
} else if (res.code === 403) {
|
||||
hasPermission.value = false
|
||||
} else {
|
||||
@@ -354,6 +374,16 @@ onMounted(async () => {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
.page-hint {
|
||||
margin: -8px 0 16px;
|
||||
padding: 10px 14px;
|
||||
background: #ecf5ff;
|
||||
border: 1px solid #d9ecff;
|
||||
border-radius: 6px;
|
||||
color: #409eff;
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.header-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
Reference in New Issue
Block a user