fix(admin): 修复公共内容展示时段与编辑表单时区不一致

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-12 09:24:25 +08:00
parent 283252c841
commit 5a15159ff3

View File

@@ -5,6 +5,10 @@ import type { TableInstance } from 'element-plus';
import { useAdminLocale } from '../composables/useAdminLocale'; import { useAdminLocale } from '../composables/useAdminLocale';
import api from '../api'; import api from '../api';
import AdminTableEmpty from '../components/AdminTableEmpty.vue'; import AdminTableEmpty from '../components/AdminTableEmpty.vue';
import {
normalizeStartTimeForApi,
normalizeStartTimeForPicker,
} from './match-form';
const { t, localeTag } = useAdminLocale(); const { t, localeTag } = useAdminLocale();
@@ -311,8 +315,8 @@ function openEdit(row: ContentItem) {
status: row.status, status: row.status,
linkType: (row.linkType as '' | 'ROUTE' | 'URL') || '', linkType: (row.linkType as '' | 'ROUTE' | 'URL') || '',
linkTarget: row.linkTarget ?? '', linkTarget: row.linkTarget ?? '',
startTime: row.startTime ? row.startTime.slice(0, 19) : '', startTime: normalizeStartTimeForPicker(row.startTime ?? undefined),
endTime: row.endTime ? row.endTime.slice(0, 19) : '', endTime: normalizeStartTimeForPicker(row.endTime ?? undefined),
translations: LOCALES.map((locale) => { translations: LOCALES.map((locale) => {
const tr = byLocale.get(locale); const tr = byLocale.get(locale);
return { return {
@@ -340,8 +344,8 @@ function buildPayload() {
linkType: isBanner.value && form.value.linkType ? form.value.linkType : null, linkType: isBanner.value && form.value.linkType ? form.value.linkType : null,
linkTarget: linkTarget:
isBanner.value && form.value.linkType ? form.value.linkTarget.trim() : null, isBanner.value && form.value.linkType ? form.value.linkTarget.trim() : null,
startTime: form.value.startTime || null, startTime: form.value.startTime ? normalizeStartTimeForApi(form.value.startTime) : null,
endTime: form.value.endTime || null, endTime: form.value.endTime ? normalizeStartTimeForApi(form.value.endTime) : null,
translations: form.value.translations.map((tr) => ({ translations: form.value.translations.map((tr) => ({
locale: tr.locale, locale: tr.locale,
title: tr.title.trim() || undefined, title: tr.title.trim() || undefined,