From c4fc9c930ef4414f69d3744eb006a1ad54f10ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Mon, 15 Jun 2026 18:26:56 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E8=B0=83=E6=95=B4=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=89=B2=E4=B8=BA=E6=B7=B1=E7=81=B0=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E9=A1=B5=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将全局主题色替换为#1A1A1A 2. 重构markdown样式,优化间距与排版 3. 新增文章页返回顶部功能 4. 优化文章详情页的布局与交互细节 --- .../mp-html/components/mp-html/node/node.vue | 2 +- .../static/app-plus/mp-html/local.html | 2 +- src/config/markdown/config.ts | 35 ++++-- src/subpkg-blog/post-detail/post-detail.vue | 119 +++++++++++------- uno.config.ts | 2 +- 5 files changed, 98 insertions(+), 62 deletions(-) diff --git a/src/components/mp-html/components/mp-html/node/node.vue b/src/components/mp-html/components/mp-html/node/node.vue index ec1f0da..d2609f7 100644 --- a/src/components/mp-html/components/mp-html/node/node.vue +++ b/src/components/mp-html/components/mp-html/node/node.vue @@ -821,7 +821,7 @@ export default { } } -
\ No newline at end of file +
\ No newline at end of file diff --git a/src/config/markdown/config.ts b/src/config/markdown/config.ts index e7e90b2..786d141 100644 --- a/src/config/markdown/config.ts +++ b/src/config/markdown/config.ts @@ -1,6 +1,6 @@ import { useAppConfig } from '../useAppConfig' -const primaryColor = '#111827' +const primaryColor = '#1a1a1a' export const markdownConfig = { domain: useAppConfig().appBaseUrl.value, @@ -11,8 +11,8 @@ border-collapse:collapse; margin-bottom: 18px; overflow: hidden; font-size: 13px; -color: var(--routine); -background: #f2f6fc; +color: ${primaryColor}; +background: rgba(247, 247, 247, 1); border: 1px solid #dcdcdc; border-radius: 4px; `, @@ -28,68 +28,77 @@ border-bottom: 1px solid var(--classE); `, blockquote: ` padding: 8px 15px; +padding-bottom: 1px; color: #606266; -background: #f2f6fc; +background: rgba(247, 247, 247, 1); border-left: 5px solid ${primaryColor}; border-radius: 4px; line-height: 26px; margin-bottom: 18px; +margin-top: 4px; `, ul: 'padding-left: 15px;line-height: 1.85;', ol: 'padding-left: 15px;line-height: 1.85;', li: 'margin-bottom: 12px;line-height: 1.85;', h1: ` margin: 30px 0 20px; -color: var(--main); +color: ${primaryColor}; line-height: 24px; position: relative; font-size:1.2em; +font-weight: bold; `, h2: ` -color: var(--main); +color: ${primaryColor}; line-height: 24px; position: relative; margin: 22px 0 16px; font-size: 1.16em; +font-weight: bold; `, h3: ` -color: var(--main); +color: ${primaryColor}; line-height: 24px; position: relative; margin: 26px 0 18px; font-size: 1.14em; +font-weight: bold; `, h4: ` -color: var(--main); +color: ${primaryColor}; line-height: 24px; margin-bottom: 18px; position: relative; font-size: 1.12em; +font-weight: bold; `, h5: ` -color: var(--main); +color: ${primaryColor}; line-height: 24px; margin-bottom: 14px; position: relative; font-size: 1.1em; +font-weight: bold; `, h6: ` -color: #303133; +color: ${primaryColor}; line-height: 24px; margin-bottom: 14px; position: relative; font-size: 14px; +font-weight: bold; `, p: ` line-height: 1.65; -margin-bottom: 14px; +margin-bottom: 12px; font-size: 14px; `, code: ` `, - strong: 'font-weight: 700;color: rgb(248, 57, 41);', + strong: `font-weight: 700;color: ${primaryColor};`, video: 'width: 100%', }, - containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;', +// containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px; background-color:transparent;', + containStyle: 'word-spacing: 0.8px;letter-spacing: 0.8px; background-color:transparent;', loadingGif: '', emptyGif: '', diff --git a/src/subpkg-blog/post-detail/post-detail.vue b/src/subpkg-blog/post-detail/post-detail.vue index 2959855..5a2d5c2 100644 --- a/src/subpkg-blog/post-detail/post-detail.vue +++ b/src/subpkg-blog/post-detail/post-detail.vue @@ -122,6 +122,19 @@ async function loadData() { upvoteCount.value = post.value?.stats?.upvote ?? 0 } +// --- 返回顶部 --- +const showBackTop = ref(false) +let beforeScrollTop = 0 + +onPageScroll(({ scrollTop }) => { + showBackTop.value = scrollTop > 300 && scrollTop > beforeScrollTop + beforeScrollTop = scrollTop +}) + +function handleScrollToTop() { + uni.pageScrollTo({ scrollTop: 0, duration: 300 }) +} + // --- 生命周期 --- onLoad((options: IPostDetailLoadOptions) => { postName = options.metadataName @@ -145,8 +158,10 @@ onShareAppMessage(() => { diff --git a/uno.config.ts b/uno.config.ts index 87fceae..c119e18 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -95,7 +95,7 @@ export default defineConfig({ theme: { colors: { /** 主题色,用法如: text-primary */ - primary: 'var(--wot-color-theme,#0957DE)', + primary: '#1A1A1A', page: '#F8F8F8', page2: '#F9FAFB', page3: '#F8FAFC',