diff --git a/app/assets/css/main.scss b/app/assets/css/main.scss index c6ddffa..cad0e0a 100644 --- a/app/assets/css/main.scss +++ b/app/assets/css/main.scss @@ -15,6 +15,7 @@ } * { box-sizing: border-box; } +.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } html { scroll-behavior: smooth; background: var(--paper); } body { margin: 0; color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.65; background: var(--paper); -webkit-font-smoothing: antialiased; } body.nav-open { overflow: hidden; } @@ -40,9 +41,11 @@ img { max-width: 100%; } .section-heading.centered { max-width: 780px; margin: 0 auto 56px; text-align: center; } .site-header { position: absolute; z-index: 20; top: 0; left: 0; display: grid; grid-template-columns: 250px 1fr 160px; align-items: center; width: 100%; padding: 26px 4.2vw; } -.main-nav { display: flex; justify-content: center; gap: clamp(24px, 3.2vw, 54px); } -.main-nav a { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: #17364e; font-size: 14px; white-space: nowrap; } -.main-nav a::after { position: absolute; right: 50%; bottom: -12px; left: 50%; height: 1px; content: ""; background: var(--ink); transition: .28s ease; } +.main-nav { display: flex; justify-content: center; gap: clamp(18px, 2.4vw, 42px); } +.main-nav a { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; padding: 0 3px; color: #17364e; white-space: nowrap; } +.nav-label { font-size: 14px; line-height: 1.2; } +.nav-english { margin-top: 5px; color: #71889b; font-size: 9px; font-weight: 500; line-height: 1; letter-spacing: .12em; } +.main-nav a::after { position: absolute; right: 50%; bottom: -8px; left: 50%; height: 1px; content: ""; background: var(--ink); transition: .28s ease; } .main-nav a:hover::after, .main-nav a:focus-visible::after, .main-nav a[aria-current="page"]::after { right: 0; left: 0; } .header-cta, .primary-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 11px; overflow: hidden; border-radius: 999px; color: white; background: linear-gradient(135deg, #2b5f8b, #0a3456); box-shadow: 0 12px 28px rgba(10, 52, 86, .2); isolation: isolate; } .header-cta::before, .primary-button::before { position: absolute; top: -80%; left: -45%; z-index: -1; width: 32%; height: 260%; content: ""; background: linear-gradient(90deg, transparent, rgba(255,255,255,.32), transparent); transform: rotate(20deg) translateX(-260%); transition: transform .65s cubic-bezier(.2,.7,.2,1); } @@ -187,6 +190,20 @@ img { max-width: 100%; } .story-body .lead { margin-bottom: 30px; color: #315a7a; font: 400 22px/1.8 var(--serif); } .long-copy { color: #516b80; font-size: 16px; line-height: 2.15; white-space: pre-line; } .story-body .primary-button { min-height: 50px; margin-top: 38px; padding: 0 28px; } +.rich-text-content { color: #516b80; font-size: 16px; line-height: 2.15; overflow-wrap: anywhere; } +.rich-text-content > :first-child { margin-top: 0; } +.rich-text-content > :last-child { margin-bottom: 0; } +.rich-text-content p { margin: 0 0 1.2em; } +.rich-text-content h2, .rich-text-content h3 { color: var(--ink); font-family: var(--serif); font-weight: 500; line-height: 1.45; } +.rich-text-content h2 { margin: 1.7em 0 .7em; font-size: 30px; } +.rich-text-content h3 { margin: 1.5em 0 .6em; font-size: 23px; } +.rich-text-content ul, .rich-text-content ol { margin: 1.1em 0; padding-left: 1.7em; } +.rich-text-content li { margin: .45em 0; } +.rich-text-content blockquote { margin: 1.5em 0; padding: 15px 22px; border-left: 3px solid #7b9ab2; color: #426782; background: #f3f7fa; } +.rich-text-content a { color: #286895; text-decoration: underline; text-underline-offset: 3px; } +.rich-text-content hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); } +.rich-text-content img { display: block; max-width: 100%; height: auto; margin: 1.4em 0; border-radius: 10px; } +.rich-text-content pre { overflow-x: auto; padding: 16px 18px; border-radius: 10px; color: #edf4f8; background: #17364e; font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; } .statement-page { max-width: 900px; } .statement-page header { padding: 66px 30px; border-radius: 34px; background: rgba(255,255,255,.7); box-shadow: var(--shadow); } .detail-hero { display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; max-width: 1260px; min-height: 620px; margin: 0 auto; padding: 54px 32px 80px; } @@ -306,6 +323,33 @@ img { max-width: 100%; } .content-list > button small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; } .content-list .add-content { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 5px; border: 1px dashed #aac0d2; color: #35698f; } .content-editor { padding: 28px; } +.field-group { display: grid; gap: 8px; color: #38566e; font-size: 13px; } +.form-grid .field-group.full { grid-column: 1 / 3; } +.rich-text-editor { border: 1px solid #d5dfe7; border-radius: 12px; background: #fbfcfd; } +.rich-text-editor:focus-within { border-color: #6d96b7; box-shadow: 0 0 0 3px rgba(78,128,168,.08); } +.rich-text-toolbar { position: sticky; z-index: 5; top: 95px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid #dbe4eb; border-radius: 11px 11px 0 0; background: #f4f7fa; } +.rich-text-toolbar button, .rich-text-toolbar select, .toolbar-color { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 10px; border: 1px solid #cfdbe5; border-radius: 7px; color: #294d68; background: white; font-size: 12px; cursor: pointer; } +.rich-text-toolbar select { width: auto; max-width: 160px; } +.rich-text-toolbar button { min-width: 34px; } +.rich-text-toolbar button:hover, .rich-text-toolbar button.active, .toolbar-color:hover { border-color: #7396b3; color: #164d77; background: #e4eef7; } +.rich-text-toolbar button:disabled { opacity: .4; cursor: not-allowed; } +.toolbar-divider { width: 1px; height: 25px; margin: 0 2px; background: #cfdbe5; } +.toolbar-color { position: relative; width: 34px; padding: 0; border-bottom: 4px solid #17364e; font-weight: 700; } +.toolbar-color.highlight { border-bottom-color: #fff1c9; background: #fff9e8; } +.toolbar-color input { position: absolute; width: 1px; height: 1px; opacity: 0; } +.rich-text-editor .tiptap { min-height: 420px; padding: 24px; outline: 0; color: #26465f; font: 400 16px/1.85 var(--sans); } +.rich-text-editor .tiptap > :first-child { margin-top: 0; } +.rich-text-editor .tiptap h2, .rich-text-editor .tiptap h3 { font-family: var(--serif); font-weight: 500; } +.rich-text-editor .tiptap h2 { font-size: 28px; } +.rich-text-editor .tiptap h3 { font-size: 22px; } +.rich-text-editor .tiptap blockquote { margin: 18px 0; padding: 12px 18px; border-left: 3px solid #7b9ab2; background: #edf3f7; } +.rich-text-editor .tiptap a { color: #286895; text-decoration: underline; } +.rich-text-editor .tiptap img { display: block; max-width: 100%; height: auto; margin: 18px 0; border-radius: 10px; } +.rich-text-editor .tiptap pre { overflow-x: auto; margin: 18px 0; padding: 16px 18px; border-radius: 10px; color: #edf4f8; background: #17364e; font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; } +.rich-text-editor .tiptap hr { margin: 24px 0; border: 0; border-top: 1px solid #cbd8e2; } +.rich-text-editor .tiptap p.is-editor-empty:first-child::before { float: left; height: 0; color: #98aaba; content: "在此输入正文,可像 Word 一样选择文字后设置格式…"; pointer-events: none; } +.rich-text-message { margin: 0; padding: 8px 12px; color: #a84d43; background: #fff3f1; font-size: 12px; } +.rich-text-footer { display: flex; justify-content: space-between; gap: 20px; padding: 9px 12px; border-top: 1px solid #e2e9ef; color: #7890a3; font-size: 11px; } .danger-link, .inline-add { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border: 0; border-radius: 8px; color: #9b4b43; background: #fff1ef; cursor: pointer; } .inline-add { color: #35698f; background: #e9f1f8; } .form-grid select { width: 100%; padding: 12px 13px; border: 1px solid #d5dfe7; border-radius: 9px; color: #1c3c56; background: #fbfcfd; } @@ -380,12 +424,14 @@ img { max-width: 100%; } @keyframes panel-wipe { from { opacity: .4; clip-path: inset(0 100% 0 0 round 38px); transform: translateY(22px); } to { opacity: 1; clip-path: inset(0 0 0 0 round 38px); transform: none; } } @keyframes float-cue { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 7px); } } -@media (max-width: 1100px) { +@media (max-width: 1300px) { .site-header { position: fixed; grid-template-columns: 1fr auto; min-height: 72px; padding: 12px 24px; border-bottom: 1px solid rgba(28,62,88,.08); background: rgba(248,250,252,.9); backdrop-filter: blur(18px); } .menu-toggle { z-index: 3; display: inline-flex; padding: 10px; cursor: pointer; } - .main-nav { position: fixed; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100vw; height: 100svh; gap: 28px; visibility: hidden; opacity: 0; background: rgba(247,249,251,.97); transition: visibility .28s ease, opacity .28s ease; } + .main-nav { position: fixed; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100vw; height: 100svh; gap: 20px; visibility: hidden; opacity: 0; background: rgba(247,249,251,.97); transition: visibility .28s ease, opacity .28s ease; } .main-nav.open { visibility: visible; opacity: 1; } - .main-nav a { display: flex; min-width: 180px; min-height: 48px; justify-content: center; font: 500 24px var(--serif); } + .main-nav a { display: flex; min-width: 220px; min-height: 56px; justify-content: center; } + .main-nav .nav-label { font: 500 23px/1.15 var(--serif); } + .main-nav .nav-english { margin-top: 6px; font: 500 9px/1 var(--sans); letter-spacing: .18em; } .header-cta { display: none; } .teacher-card { grid-template-columns: .9fr 1.1fr; } .official-grid { grid-template-columns: repeat(2, 1fr); } @@ -482,6 +528,10 @@ img { max-width: 100%; } .editor-panel { padding: 20px 16px; } .form-grid { grid-template-columns: 1fr; } .form-grid label.full { grid-column: 1; } + .form-grid .field-group.full { grid-column: 1; } + .rich-text-toolbar { gap: 5px; } + .rich-text-toolbar select { max-width: 118px; } + .rich-text-editor .tiptap { min-height: 340px; padding: 18px; } } @media (max-width: 520px) { diff --git a/app/components/RichTextContent.vue b/app/components/RichTextContent.vue new file mode 100644 index 0000000..4e282d0 --- /dev/null +++ b/app/components/RichTextContent.vue @@ -0,0 +1,10 @@ + + + diff --git a/app/components/RichTextEditor.vue b/app/components/RichTextEditor.vue new file mode 100644 index 0000000..07afb37 --- /dev/null +++ b/app/components/RichTextEditor.vue @@ -0,0 +1,183 @@ + + + diff --git a/app/components/SiteHeader.vue b/app/components/SiteHeader.vue index 243b3d8..16a2420 100644 --- a/app/components/SiteHeader.vue +++ b/app/components/SiteHeader.vue @@ -6,16 +6,17 @@ const toggle = ref() const navigation = ref() const props = withDefaults(defineProps<{ logo?: string; brandName?: string; englishName?: string }>(), { brandName: '慧遇书院', + englishName: 'HUIYU ACADEMY', }) const route = useRoute() const links = computed(() => [ - { label: '首页', href: '/#home' }, - { label: `关于${props.brandName}`, href: '/#about' }, - { label: '卢慧老师', href: '/luhui' }, - { label: '课程与产品', href: '/products' }, - { label: '官方信息', href: '/#official' }, - { label: '品牌动态', href: '/news' }, - { label: '联系我们', href: '/#contact' }, + { label: '首页', englishLabel: 'HOME', href: '/#home' }, + { label: `关于${props.brandName}`, englishLabel: `ABOUT ${props.englishName}`, href: '/#about' }, + { label: '卢慧老师', englishLabel: 'LU HUI', href: '/luhui' }, + { label: '课程与产品', englishLabel: 'COURSES & PRODUCTS', href: '/products' }, + { label: '官方信息', englishLabel: 'OFFICIAL INFO', href: '/#official' }, + { label: '品牌动态', englishLabel: 'BRAND NEWS', href: '/news' }, + { label: '联系我们', englishLabel: 'CONTACT US', href: '/#contact' }, ]) function closeMenu(returnFocus = false) { @@ -47,7 +48,10 @@ onBeforeUnmount(() => { 官方渠道 diff --git a/app/pages/admin/content.vue b/app/pages/admin/content.vue index fdbcc79..55398fe 100644 --- a/app/pages/admin/content.vue +++ b/app/pages/admin/content.vue @@ -4,7 +4,6 @@ import { apiErrorMessage } from '~/composables/useUnsavedChanges' import type { SiteDocument } from '../../../server/utils/site-schema' definePageMeta({ layout: false }) -useHead(() => ({ title: `内容管理|${document.value?.brand.name || '慧遇书院'}` })) type ContentTab = 'products' | 'articles' | 'team' const tab = ref('products') @@ -14,6 +13,7 @@ const loading = ref(true) const busy = ref(false) const message = ref('') const { dirty, markClean } = useUnsavedChanges(document) +useHead(() => ({ title: `内容管理|${document.value?.brand.name || '慧遇书院'}` })) onMounted(async () => { try { @@ -123,21 +123,21 @@ async function uploadImage(event: Event, apply: (url: string) => void) {
-