From d90c5955f5b618e33eb25f9d62e1b6400a4ea373 Mon Sep 17 00:00:00 2001 From: Mavis Date: Thu, 11 Jun 2026 09:28:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E6=8E=92=E7=89=88=E9=80=82=E9=85=8D=20=E2=80=94=20=E5=AA=92?= =?UTF-8?q?=E4=BD=93=E6=9F=A5=E8=AF=A2=20+=20=E6=8A=BD=E5=B1=89=E5=BC=8F?= =?UTF-8?q?=E4=BE=A7=E6=A0=8F=20+=20=E8=BF=87=E6=BB=A4=E5=8C=BA=20wrap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/AppLayout.vue | 83 ++++++++++++++++++++++----- frontend/src/style.css | 82 ++++++++++++++++++++++++++ frontend/src/views/ArticleDetail.vue | 18 +++++- frontend/src/views/Feed.vue | 51 +++++++++++++--- 4 files changed, 209 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/AppLayout.vue b/frontend/src/components/AppLayout.vue index 137342c..f8a38a5 100644 --- a/frontend/src/components/AppLayout.vue +++ b/frontend/src/components/AppLayout.vue @@ -1,13 +1,12 @@ + + diff --git a/frontend/src/style.css b/frontend/src/style.css index e90dba6..3763d7f 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -68,6 +68,88 @@ h1 { font-size: 28px; font-weight: 700; line-height: 1.3; } h2 { font-size: 22px; font-weight: 700; line-height: 1.35; } h3 { font-size: 18px; font-weight: 700; line-height: 1.4; } +/* ============================================================ + * 手机端适配 + * + * 触发断点: + * - 768px:pad / 小屏(侧栏改成抽屉) + * - 480px:手机竖屏(进一步压缩 padding / 字号) + * + * 改动: + * 1) 容器 padding 缩小,正文最大宽度限制放宽 + * 2) 卡片内边距 / 标题字号 / 评论钩子字号按档位缩 + * 3) 文章正文段间距、行高按手机阅读体验调 + * 4) 标签 / Tag 不再强制 nowrap(允许换行,避免溢出) + * 5) 顶栏 NSpace 在小屏允许换行,过滤区也允许 wrap + * ============================================================ */ +@media (max-width: 768px) { + :root { + --max-width: 100%; + } + + /* 顶栏/正文容器 padding 收紧 */ + .n-layout-header, + .n-layout-header.n-layout-header--absolute-positioned { + padding: 10px 14px !important; + } + .n-layout-content { + padding: 14px !important; + } + + /* 卡片 padding 缩 25% */ + .n-card.article-card .n-card__content { + padding: 12px 14px !important; + } + + /* 标题字号档位降 1 档 */ + h1 { font-size: 22px; line-height: 1.35; } + h2 { font-size: 20px; line-height: 1.4; } + h3 { font-size: 17px; line-height: 1.45; } + + /* 文章正文:行高微调(屏幕窄,行高再松一点) */ + .article-body { font-size: 16px; line-height: 1.8; } + .diary-para { font-size: 16px; line-height: 1.8; } + + /* 评论钩子字号微调 */ + .commentary-box { font-size: 13px; padding: 10px 12px; } + .commentary-text { font-size: 13px; } + + /* 详情页字段 */ + .commentary-text-detail { font-size: 14.5px; line-height: 1.8; } + .article-body-fallback { font-size: 15px; line-height: 1.8; } + + /* 顶栏字号 / 配额 tag */ + .n-layout-header span[style*="font-size: 20px"] { + font-size: 17px !important; + } + + /* 滚动条:手机端太窄,隐藏 */ + ::-webkit-scrollbar { width: 0; height: 0; } +} + +@media (max-width: 480px) { + .n-card.article-card .n-card__content { + padding: 10px 12px !important; + } + h1 { font-size: 20px; } + .article-body { font-size: 15.5px; } + .diary-para { font-size: 15.5px; } +} + +/* 工具类:手机端隐藏侧栏相关装饰 */ +@media (max-width: 768px) { + .mobile-hide { + display: none !important; + } + .mobile-stack { + flex-direction: column !important; + align-items: stretch !important; + } + .mobile-full-width { + width: 100% !important; + } +} + /* ===== 文章卡片 ===== */ .n-card.article-card { margin-bottom: 16px; diff --git a/frontend/src/views/ArticleDetail.vue b/frontend/src/views/ArticleDetail.vue index e91937d..9336800 100644 --- a/frontend/src/views/ArticleDetail.vue +++ b/frontend/src/views/ArticleDetail.vue @@ -114,7 +114,7 @@ onMounted(load) - + {{ article.source.name }} {{ article.lang_src.toUpperCase() }} @@ -126,7 +126,7 @@ onMounted(load) {{ c }} - + {{ fmtTime(publishedAt) }} @@ -148,7 +148,7 @@ onMounted(load) - + \ No newline at end of file diff --git a/frontend/src/views/Feed.vue b/frontend/src/views/Feed.vue index dd9cb35..5dc8f05 100644 --- a/frontend/src/views/Feed.vue +++ b/frontend/src/views/Feed.vue @@ -116,22 +116,22 @@ onMounted(async () => {