From b85c69b3ec2c5a1aec0a5fcfd03c78f6aed7f6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Fri, 11 Sep 2026 02:23:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E4=B8=8E=E4=BB=A3=E7=A0=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 移除markdown代码块的默认文字颜色变量 2. 简化快捷导航背景色为hex8格式统一管理 3. 重构联系页社交链接逻辑与空状态展示 4. 优化about页的颜色转换工具函数与默认配色 5. 调整App.vue初始化调用与移除冗余代码 --- src/App.vue | 13 ++++--- .../uh-home-quick-nav/uh-home-quick-nav.vue | 12 +++---- src/config/markdown.ts | 1 - src/pages-blog/contact/contact.vue | 35 +++++++++++-------- src/pages/tabbar/about/about.vue | 34 +++++++++--------- src/store/appConfig.ts | 15 ++------ 6 files changed, 52 insertions(+), 58 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6d7eff8..efa130e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,4 @@ - - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/uh-home-quick-nav/uh-home-quick-nav.vue b/src/components/uh-home-quick-nav/uh-home-quick-nav.vue index 5b89197..03c7bde 100644 --- a/src/components/uh-home-quick-nav/uh-home-quick-nav.vue +++ b/src/components/uh-home-quick-nav/uh-home-quick-nav.vue @@ -24,14 +24,14 @@ // 是否使用本地的快捷导航数据(本地的可以任意修改图标、路径,插件端的无法修改图标) const useLocalNav = false - /** 内置默认项(未配置时回退;字段命名与插件端一致,可作配置缺失字段的兜底) */ + /** 内置默认项(未配置时回退;字段命名与插件端一致,可作配置缺失字段的兜底;颜色统一 hex8) */ const DEFAULT_NAV_LIST : QuickNavItem[] = [ { key: 'archives', title: '文章归档', subTitle: '全部文章', color: '#03A9F4', - bgColor: 'rgba(3, 169, 244, 0.14)', + bgColor: '#03A9F424', iconPrefix: 'uhemoji2-icon', icon: '-mask', path: '/pages-blog/archives/archives', @@ -41,7 +41,7 @@ key: 'vote', title: '投票中心', color: '#00BCD4', - bgColor: 'rgba(0, 188, 212, 0.14)', + bgColor: '#00BCD424', iconPrefix: 'uhemoji2-icon', icon: '-confused', path: '/pages-blog/votes/votes', @@ -51,7 +51,7 @@ key: 'disclaimers', title: '友情链接', color: '#009688', - bgColor: 'rgba(0, 150, 136, 0.14)', + bgColor: '#00968824', iconPrefix: 'uhemoji2-icon', icon: '-wink', path: '/pages-blog/friend-links/friend-links', @@ -61,7 +61,7 @@ key: 'love', title: '恋爱日记', color: '#FF4C67', - bgColor: 'rgba(255, 76, 103, 0.14)', + bgColor: '#FF4C6724', iconPrefix: 'uhemoji2-icon', icon: '-in-love', path: '/pages-blog/love/love', @@ -71,7 +71,7 @@ key: 'contact-blogger', title: '联系博主', color: '#FF9800', - bgColor: 'rgba(255, 152, 0, 0.14)', + bgColor: '#FF980024', iconPrefix: 'uhemoji2-icon', icon: '-cool', path: '/pages-blog/contact/contact', diff --git a/src/config/markdown.ts b/src/config/markdown.ts index 610e4bc..eca0689 100644 --- a/src/config/markdown.ts +++ b/src/config/markdown.ts @@ -11,7 +11,6 @@ export const markdownConfig = { margin-bottom: 18px; overflow: hidden; font-size: 13px; - color: var(--routine); background: #f2f6fc; border: 1px solid #dcdcdc; border-radius: 4px; diff --git a/src/pages-blog/contact/contact.vue b/src/pages-blog/contact/contact.vue index 60761f3..8622258 100644 --- a/src/pages-blog/contact/contact.vue +++ b/src/pages-blog/contact/contact.vue @@ -14,10 +14,8 @@ }) interface ISoical { - key ?: string name : string content : string - icon ?: string, color : string, bgColor : string, priority ?: number, @@ -45,11 +43,11 @@ return [] } return [...configured] - .filter(item => item.visible !== false) + .filter(item => item.visible && item.content.trim()) .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0)) }) - const isNotEmpty = computed(() => socialList.value.some(item => item.visible && !!item.content)) + const isNotEmpty = computed(() => socialList.value.some(item => item.visible && item.content.trim())) const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus() watchEffect(() => { @@ -67,7 +65,6 @@ }) } - /* ---------------- 实时时间(收信日期,formatTime 工具每秒刷新) ---------------- */ const nowText = ref('') let clock : ReturnType | null = null function refreshNowText() { @@ -121,11 +118,16 @@ 展信安: - + + + + + 祝你早安,午安,晚安。每天都有好心情,生活愉快! + {{ bloggerInfo.nickname }} {{ nowText }} @@ -133,16 +135,21 @@ + + 若有意,可依此觅: + - {{ item.icon }} + + {{ item.name ? item.name.charAt(0) : '' }} + - {{ item.name }} - + {{ item.name }} + {{ item.content }} diff --git a/src/pages/tabbar/about/about.vue b/src/pages/tabbar/about/about.vue index dd7bc8c..f01fd8c 100644 --- a/src/pages/tabbar/about/about.vue +++ b/src/pages/tabbar/about/about.vue @@ -157,14 +157,14 @@ }) /* ---------------- 功能导航 ---------------- */ - /** 图标块浅色背景:品牌深色 rgba 降透明度 → 轻量底色 */ - function toLightBg(rgba : string) { - return rgba.replace('0.95)', '0.15)') + /** 图标块浅色背景:品牌深色 hex8 降透明度 → 轻量底色(#rrggbbaa 后两位替换为 26,≈0.15 透明度) */ + function toLightBg(hex8 : string) { + return (hex8 || '').replace(/(#[0-9a-fA-F]{6})[0-9a-fA-F]{2}$/, (_m, base) => `${base}26`) } - /** 图标颜色:品牌深色实色 */ - function toSolidColor(rgba : string) { - return rgba.replace('0.95)', '1)') + /** 图标颜色:品牌深色实色(#rrggbbaa 后两位替换为 FF,不透明) */ + function toSolidColor(hex8 : string) { + return (hex8 || '').replace(/(#[0-9a-fA-F]{6})[0-9a-fA-F]{2}$/, (_m, base) => `${base}FF`) } /** 收藏导航项右侧文案跟随收藏总数(收藏页返回/切回时刷新) */ @@ -188,7 +188,7 @@ title: e.title || '', iconPrefix: e.iconPrefix, icon: e.icon || '', - bgColor: e.bgColor || 'rgba(150, 150, 150, 0.95)', + bgColor: e.bgColor || '#969696F2', color: e.color, rightText: e.subTitle || '', path: e.path || null, @@ -216,7 +216,7 @@ title: '我的收藏', iconPrefix: 'uhemoji2-icon', icon: '-smiling', - bgColor: 'rgba(255, 179, 0, 0.95)', + bgColor: '#FFB300F2', rightText: '', path: '/pages-blog/favorites/favorites', show: true, @@ -227,7 +227,7 @@ title: '数据看板', iconPrefix: 'uhemoji2-icon', icon: '-surprised', - bgColor: 'rgba(102, 60, 201, 0.95)', + bgColor: '#663CC9F2', rightText: '站点数据可视化', path: '/pages-blog/data-visual/data-visual', show: dataVisualAvailable, @@ -238,7 +238,7 @@ title: calcAuditModeEnabled.value ? '内容归档' : '文章归档', iconPrefix: 'uhemoji2-icon', icon: '-mask', - bgColor: 'rgba(3, 169, 244, 0.95)', + bgColor: '#03A9F4F2', rightText: calcAuditModeEnabled.value ? '全部已归档内容' : '全部已归档文章', path: '/pages-blog/archives/archives', show: true, @@ -249,7 +249,7 @@ title: '恋爱日记', iconPrefix: 'uhemoji2-icon', icon: '-in-love', - bgColor: 'rgba(255, 76, 103, 0.95)', + bgColor: '#FF4C67F2', rightText: '博主的恋爱日记', path: '/pages-blog/love/love', show: loveEnabled.value, @@ -261,7 +261,7 @@ title: '投票中心', iconPrefix: 'uhemoji2-icon', icon: '-confused', - bgColor: 'rgba(0, 188, 212, 0.95)', + bgColor: '#00BCD4F2', rightText: '查看和进行投票', path: '/pages-blog/votes/votes', show: !calcAuditModeEnabled.value && voteAvailable, @@ -273,7 +273,7 @@ title: '友情链接', iconPrefix: 'uhemoji2-icon', icon: '-cool', - bgColor: 'rgba(0, 150, 136, 0.95)', + bgColor: '#009688F2', rightText: '看看博主朋友们吧', path: '/pages-blog/friend-links/friend-links', show: linksAvailable, @@ -285,7 +285,7 @@ title: '免责声明', iconPrefix: 'uhemoji2-icon', icon: '-smirking', - bgColor: 'rgba(121, 85, 72, 0.95)', + bgColor: '#795548F2', rightText: '博客内容免责声明', path: '/pages-blog/disclaimers/disclaimers', // 2026-09-10 起无 enabled 开关,按内容非空判定入口显隐 @@ -298,7 +298,7 @@ title: '联系博主', iconPrefix: 'uhemoji2-icon', icon: '-wink', - bgColor: 'rgba(255, 152, 0, 0.95)', + bgColor: '#FF9800F2', rightText: '博主常用联系方式', path: '/pages-blog/contact/contact', show: socialEnabled.value, @@ -310,7 +310,7 @@ title: '关于项目', iconPrefix: 'uhemoji2-icon', icon: '-happy-', - bgColor: 'rgba(96, 125, 139, 0.95)', + bgColor: '#607D8BF2', rightText: '小莫唐尼开源项目', path: '/pages-blog/about/about', // showAboutSystem 2026-09-10 下线(入口由插件端功能入口 myPageConfig 统一管理),默认展示 @@ -323,7 +323,7 @@ title: '偏好设置', iconPrefix: 'uhemoji2-icon', icon: '-tired', - bgColor: 'rgba(121, 134, 203, 0.95)', + bgColor: '#7986CBF2', rightText: '首页布局、卡片样式等本地偏好', path: '/pages-blog/setting/setting', show: true, diff --git a/src/store/appConfig.ts b/src/store/appConfig.ts index c303812..4f09463 100644 --- a/src/store/appConfig.ts +++ b/src/store/appConfig.ts @@ -1,6 +1,5 @@ /** - * 应用配置 store(源自旧项目 store/config.js 的 configs/auditData 部分) - * 注意:旧 fetchConfigs 中会把 basicConfig.tokenConfig 写入缓存,供 getPersonalToken 使用,此处保留 + * 应用配置 */ import { defineStore } from 'pinia' import { computed, ref } from 'vue' @@ -10,8 +9,6 @@ import { deepMerge } from '@/utils/merge' import { setCache } from '@/utils/storage' import type { IAppConfig, IAuditDataResult } from '@/api/types/uni-halo' -/** 个人令牌存储 key(与 src/store/token.ts 的 getPersonalToken 保持一致) */ -const APP_TOKENS_KEY = 'APP_TOKENS' /** 合并后配置缓存 key(与 utils/url.ts / api/uni-halo.ts 的 APP_GLOBAL_CONFIGS 读取保持一致) */ const APP_GLOBAL_CONFIGS_KEY = 'APP_GLOBAL_CONFIGS' /** @@ -30,8 +27,7 @@ export interface IStaticLoveConfig { } } /** - * 静态配置后台刷新间隔(ms): onShow 距上次拉取在 TTL 内则不再重复请求(设计见 - * .docs/static-config-unified-fetch-design.md) + * 静态配置后台刷新间隔(ms): onShow 距上次拉取在 TTL 内则不再重复请求 */ const STATIC_TTL = 5 * 60 * 1000 @@ -65,14 +61,7 @@ export const useAppConfigStore = defineStore( if (body) { configs.value = deepMerge(JSON.parse(JSON.stringify(DefaultAppConfigs)), body) - // 合并结果写入 APP_GLOBAL_CONFIGS 缓存,供 utils/url.ts 图片兜底与 - // api/uni-halo.ts 第三方插件授权头等按 storage 路径读取 setCache(APP_GLOBAL_CONFIGS_KEY, configs.value) - - // 存储个人令牌(供 getPersonalToken 使用,如非匿名投票) - if (body?.basicConfig?.tokenConfig) { - setCache(APP_TOKENS_KEY, body.basicConfig.tokenConfig) - } return body } setDefaultAppSettings()