- 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>
177 行
7.8 KiB
Vue
177 行
7.8 KiB
Vue
<template>
|
|
<div>
|
|
<n-space justify="space-between" align="flex-start" style="margin-bottom: 20px;">
|
|
<div>
|
|
<div style="font-size: 22px; font-weight: 600; color: #111827; margin-bottom: 4px;">旅行日历</div>
|
|
<div style="font-size: 13px; color: #9ca3af;">管理12个月份的出行建议,对应官网「旅行日历」页面</div>
|
|
</div>
|
|
<n-space>
|
|
<a href="/calendar" target="_blank" style="text-decoration: none;">
|
|
<n-button>查看前台 ↗</n-button>
|
|
</a>
|
|
<n-button type="primary" :loading="saving" :disabled="saving" @click="save">
|
|
{{ saving ? '保存中...' : '保存' }}
|
|
</n-button>
|
|
</n-space>
|
|
</n-space>
|
|
|
|
<n-spin v-if="!loaded" style="display:block; padding: 60px; text-align: center;" />
|
|
<template v-else>
|
|
<n-card title="页面概述" style="margin-bottom: 20px;">
|
|
<n-form-item label="页面标题">
|
|
<n-input v-model:value="data.meta.pageTitle" />
|
|
</n-form-item>
|
|
<n-form-item label="最佳时间">
|
|
<n-input v-model:value="data.meta.bestTime" />
|
|
</n-form-item>
|
|
<n-form-item label="页面介绍">
|
|
<n-input v-model:value="data.meta.pageIntro" type="textarea" :rows="3" />
|
|
</n-form-item>
|
|
</n-card>
|
|
|
|
<n-card title="快速推荐" style="margin-bottom: 20px;">
|
|
<template #header-extra>
|
|
<n-button size="small" type="primary" @click="data.meta.quickRecommendations.push({ label: '', months: '', reason: '' })">添加</n-button>
|
|
</template>
|
|
<n-space vertical :size="10">
|
|
<n-space v-for="(r, ri) in data.meta.quickRecommendations" :key="ri" align="center">
|
|
<n-input v-model:value="r.label" placeholder="标签" style="width: 120px" />
|
|
<n-input v-model:value="r.months" placeholder="月份" style="width: 140px" />
|
|
<n-input v-model:value="r.reason" placeholder="原因" style="width: 360px" />
|
|
<n-button size="tiny" type="error" quaternary @click="data.meta.quickRecommendations.splice(ri, 1)">删</n-button>
|
|
</n-space>
|
|
</n-space>
|
|
</n-card>
|
|
|
|
<n-card title="出行建议" style="margin-bottom: 20px;">
|
|
<template #header-extra>
|
|
<n-button size="small" type="primary" @click="data.meta.travelAdvice.push({ period: '', level: '', levelText: '', description: '' })">添加</n-button>
|
|
</template>
|
|
<n-space vertical :size="10">
|
|
<n-card v-for="(a, ai) in data.meta.travelAdvice" :key="ai" size="small" style="background: #fafafa;">
|
|
<n-space align="center" justify="end" style="margin-bottom: 6px;">
|
|
<n-button size="tiny" type="error" quaternary @click="data.meta.travelAdvice.splice(ai, 1)">删除</n-button>
|
|
</n-space>
|
|
<n-grid :cols="2" :x-gap="12">
|
|
<n-gi>
|
|
<n-form-item label="时段" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="a.period" size="small" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="推荐等级标识" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="a.level" size="small" placeholder="如 best_value / peak / not_recommended" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="等级文字" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="a.levelText" size="small" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="描述" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="a.description" size="small" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
</n-grid>
|
|
</n-card>
|
|
</n-space>
|
|
</n-card>
|
|
|
|
<n-grid :cols="3" :x-gap="16" :y-gap="16" responsive="screen" :collapsed-rows="999">
|
|
<n-gi v-for="m in data.months" :key="m.month">
|
|
<n-card
|
|
:style="m.isPeakSeason ? 'border: 2px solid #3a7d44;' : ''"
|
|
>
|
|
<template #header>
|
|
<n-space justify="space-between" align="center">
|
|
<span style="font-size: 15px; font-weight: 600;">{{ m.month }}月 · {{ m.name }}</span>
|
|
<n-tag size="small">{{ m.season }}</n-tag>
|
|
</n-space>
|
|
</template>
|
|
<n-form-item label="温度范围" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="m.tempRange" size="small" />
|
|
</n-form-item>
|
|
<n-form-item label="天气特征" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="m.weatherFeature" size="small" />
|
|
</n-form-item>
|
|
<n-form-item label="推荐指数 (1-5)" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input-number v-model:value="m.ratingStars" :min="1" :max="5" size="small" style="width: 100%;" />
|
|
</n-form-item>
|
|
<n-form-item label="Tagline" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="m.tagline" size="small" />
|
|
</n-form-item>
|
|
<n-form-item label="穿衣建议" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input v-model:value="m.clothingTips" type="textarea" :rows="2" size="small" />
|
|
</n-form-item>
|
|
<n-form-item label="亮点(每行一个)" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input
|
|
type="textarea"
|
|
:rows="3"
|
|
size="small"
|
|
:value="(m.highlights||[]).join('\n')"
|
|
@input="m.highlights = $event.split('\n').filter(Boolean)"
|
|
/>
|
|
</n-form-item>
|
|
<n-form-item label="推荐产品(每行一个)" :show-feedback="false" style="margin-bottom: 8px;">
|
|
<n-input
|
|
type="textarea"
|
|
:rows="2"
|
|
size="small"
|
|
:value="(m.recommendedProducts||[]).join('\n')"
|
|
@input="m.recommendedProducts = $event.split('\n').filter(Boolean)"
|
|
/>
|
|
</n-form-item>
|
|
<n-space align="center" style="margin-top: 4px;">
|
|
<n-tag
|
|
:type="m.isPeakSeason ? 'success' : 'default'"
|
|
checkable
|
|
:checked="m.isPeakSeason"
|
|
@update:checked="m.isPeakSeason = $event"
|
|
size="small"
|
|
>
|
|
旺季
|
|
</n-tag>
|
|
</n-space>
|
|
</n-card>
|
|
</n-gi>
|
|
</n-grid>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { NButton, NCard, NSpace, NInput, NInputNumber, NFormItem, NSpin, NGrid, NGi, NTag } from 'naive-ui'
|
|
import { useMessage } from 'naive-ui'
|
|
|
|
definePageMeta({ layout: 'admin', middleware: 'admin' })
|
|
const { adminFetch } = useAdmin()
|
|
const message = useMessage()
|
|
const data = ref({ meta: { quickRecommendations: [], travelAdvice: [] }, months: [] })
|
|
const loaded = ref(false)
|
|
const saving = ref(false)
|
|
|
|
async function load() {
|
|
const res = await adminFetch('/api/admin/site-content?key=calendar')
|
|
const d = res.data
|
|
if (!d.meta) d.meta = {}
|
|
if (!d.meta.quickRecommendations) d.meta.quickRecommendations = []
|
|
if (!d.meta.travelAdvice) d.meta.travelAdvice = []
|
|
if (d.months) {
|
|
d.months.forEach(m => {
|
|
if (!m.recommendedProducts) m.recommendedProducts = []
|
|
})
|
|
}
|
|
data.value = d
|
|
loaded.value = true
|
|
}
|
|
async function save() {
|
|
saving.value = true
|
|
try {
|
|
await adminFetch('/api/admin/site-content', { method: 'PUT', body: { key: 'calendar', data: data.value } })
|
|
message.success('已保存')
|
|
} catch { message.error('保存失败') } finally { saving.value = false }
|
|
}
|
|
onMounted(load)
|
|
</script>
|