fix: 后台编辑器字段全覆盖 + 新建 about/versions/pricing 专用编辑器
- tour 编辑器补全:selectionGuide 3维度、isMainProduct、timeline 正确结构 - camp 编辑器补全:name、campEssentials - calendar 补全:quickRecommendations、travelAdvice、recommendedProducts - guides 补全:穿搭章节 months[] 每月数据 - brand 补全:ctaButtons、conversionPath、icpUrl、eContract - qualifications 补全:enterpriseMatrix - youji 补全:notes[].tags - gallery 补全:页面配置(intro/stats/categories) - 新建 about.vue 专用编辑器(14个分区) - 新建 versions.vue 专用编辑器(8个分区) - 新建 pricing.vue 专用编辑器(5个分区) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
这个提交包含在:
@@ -11,6 +11,41 @@
|
||||
</n-space>
|
||||
</n-space>
|
||||
|
||||
<!-- 页面配置 -->
|
||||
<n-card title="页面配置" style="margin-bottom: 20px">
|
||||
<template #header-extra>
|
||||
<n-button type="primary" size="small" :loading="configSaving" @click="saveConfig">保存配置</n-button>
|
||||
</template>
|
||||
<n-spin :show="!configLoaded">
|
||||
<template v-if="configLoaded">
|
||||
<!-- 介绍描述 -->
|
||||
<n-form-item label="旅拍简介" style="margin-bottom: 12px">
|
||||
<n-input v-model:value="config.intro.description" type="textarea" :rows="3" placeholder="旅拍服务简介文字" />
|
||||
</n-form-item>
|
||||
|
||||
<!-- 数据亮点 -->
|
||||
<div style="font-weight: 500; margin-bottom: 8px; color: #374151">数据亮点(stats)</div>
|
||||
<div v-for="(s, i) in config.intro.stats" :key="i" style="display: flex; gap: 8px; align-items: center; margin-bottom: 8px;">
|
||||
<n-input v-model:value="s.value" placeholder="数值,如 200+" style="width: 100px" size="small" />
|
||||
<n-input v-model:value="s.label" placeholder="标签,如 件蒙古服饰" style="width: 130px" size="small" />
|
||||
<n-input v-model:value="s.note" placeholder="说明文字" style="flex: 1" size="small" />
|
||||
<n-button size="tiny" type="error" quaternary @click="config.intro.stats.splice(i, 1)">删</n-button>
|
||||
</div>
|
||||
<n-button dashed size="small" style="margin-bottom: 16px" @click="config.intro.stats.push({ value: '', label: '', note: '' })">+ 添加数据项</n-button>
|
||||
|
||||
<!-- 分类 -->
|
||||
<div style="font-weight: 500; margin-bottom: 8px; color: #374151">分类筛选(categories)</div>
|
||||
<div v-for="(cat, i) in config.categories" :key="i" style="display: flex; gap: 8px; align-items: center; margin-bottom: 8px;">
|
||||
<n-input v-model:value="cat.key" placeholder="key,如 family" style="width: 120px" size="small" />
|
||||
<n-input v-model:value="cat.label" placeholder="显示名称,如 亲子家庭" style="width: 130px" size="small" />
|
||||
<n-button size="tiny" type="error" quaternary :disabled="cat.key === 'all'" @click="config.categories.splice(i, 1)">删</n-button>
|
||||
</div>
|
||||
<n-button dashed size="small" @click="config.categories.push({ key: '', label: '' })">+ 添加分类</n-button>
|
||||
</template>
|
||||
</n-spin>
|
||||
</n-card>
|
||||
|
||||
<!-- 照片列表 -->
|
||||
<n-card>
|
||||
<n-space style="margin-bottom: 16px">
|
||||
<n-input v-model:value="search" placeholder="搜索标题、分类..." clearable style="width: 260px" @keyup.enter="loadData">
|
||||
@@ -42,7 +77,7 @@
|
||||
|
||||
<script setup>
|
||||
import { h } from 'vue'
|
||||
import { NButton, NCard, NSpace, NInput, NDataTable, NTag, NPagination, NImage, NPopconfirm } from 'naive-ui'
|
||||
import { NButton, NCard, NSpace, NInput, NDataTable, NTag, NPagination, NImage, NPopconfirm, NSpin, NFormItem } from 'naive-ui'
|
||||
import { useMessage } from 'naive-ui'
|
||||
|
||||
definePageMeta({ layout: 'admin', middleware: 'admin' })
|
||||
@@ -56,6 +91,46 @@ const totalPages = ref(1)
|
||||
const loading = ref(false)
|
||||
const search = ref('')
|
||||
|
||||
// 页面配置(site_content gallery key)
|
||||
const config = ref({ intro: { description: '', stats: [] }, categories: [] })
|
||||
const configLoaded = ref(false)
|
||||
const configSaving = ref(false)
|
||||
|
||||
async function loadConfig() {
|
||||
try {
|
||||
const res = await adminFetch('/api/admin/site-content?key=gallery')
|
||||
const d = res.data || {}
|
||||
config.value = {
|
||||
intro: {
|
||||
description: d.intro?.description || '',
|
||||
stats: d.intro?.stats || [],
|
||||
},
|
||||
categories: d.categories || [],
|
||||
}
|
||||
} catch {
|
||||
message.error('页面配置加载失败')
|
||||
} finally {
|
||||
configLoaded.value = true
|
||||
}
|
||||
}
|
||||
|
||||
async function saveConfig() {
|
||||
configSaving.value = true
|
||||
try {
|
||||
// 先获取完整数据再合并,避免覆盖 works 等其他字段
|
||||
const res = await adminFetch('/api/admin/site-content?key=gallery')
|
||||
const full = res.data || {}
|
||||
full.intro = { ...(full.intro || {}), description: config.value.intro.description, stats: config.value.intro.stats }
|
||||
full.categories = config.value.categories
|
||||
await adminFetch('/api/admin/site-content', { method: 'PUT', body: { key: 'gallery', data: full } })
|
||||
message.success('页面配置已保存')
|
||||
} catch {
|
||||
message.error('保存失败')
|
||||
} finally {
|
||||
configSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const columns = [
|
||||
{ title: 'ID', key: 'id', width: 50, render: (row) => h('span', { style: 'color: #9ca3af; font-size: 12px' }, row.id) },
|
||||
{
|
||||
@@ -131,5 +206,5 @@ async function handleDelete(item) {
|
||||
} catch { message.error('删除失败') }
|
||||
}
|
||||
|
||||
onMounted(loadData)
|
||||
onMounted(() => { loadData(); loadConfig() })
|
||||
</script>
|
||||
|
||||
在新工单中引用
屏蔽一个用户