diff --git a/.agents/skills/uni-halo/SKILL.md b/.agents/skills/uni-halo/SKILL.md index a34d734..6cf6b0b 100644 --- a/.agents/skills/uni-halo/SKILL.md +++ b/.agents/skills/uni-halo/SKILL.md @@ -534,7 +534,7 @@ function handleSubmit() { 投票状态、自己提交投票,页面只传 `vote-name`、监听 `on-vote-success` 提示 - **页面尽量薄**:页面只负责数据请求编排(hooks)、跳转、传参给组件 - **能抽 hooks 的就抽 hooks**:跨页面复用的业务逻辑放 `src/hooks/`(如 - `use-maintenance-intercept`、`useScroll`、`useUpload`),auto-import 免 import 直接调用 + `useMaintenanceIntercept`、`useScroll`、`useUpload`),auto-import 免 import 直接调用 - 组件不直接依赖 store 的散装字段,通过 props 传入、events 传出,降低耦合 --- diff --git a/src/api/types/uni-halo.ts b/src/api/types/uni-halo.ts index 96bb1be..a6a687a 100644 --- a/src/api/types/uni-halo.ts +++ b/src/api/types/uni-halo.ts @@ -141,7 +141,9 @@ export interface IPublicMaintenance { status: 'scheduled' | 'active' /** 维护页标题 */ title?: string - /** 维护说明(富文本 HTML,mp-html 渲染) */ + /** 维护说明(纯文本,维护页标题下方直接展示,留空展示默认文案) */ + notice?: string + /** 维护详情(富文本 HTML,「维护详情」弹窗内 mp-html 渲染) */ description?: string /** 维护开始时间(RFC3339 UTC 字符串) */ startTime?: string diff --git a/src/components/uh-button/uh-button.vue b/src/components/uh-button/uh-button.vue index d9384c2..e1e95e5 100644 --- a/src/components/uh-button/uh-button.vue +++ b/src/components/uh-button/uh-button.vue @@ -10,7 +10,7 @@ \ No newline at end of file diff --git a/src/components/uh-maintenance-detail/uh-maintenance-detail.vue b/src/components/uh-maintenance-detail/uh-maintenance-detail.vue new file mode 100644 index 0000000..ffcd485 --- /dev/null +++ b/src/components/uh-maintenance-detail/uh-maintenance-detail.vue @@ -0,0 +1,42 @@ + + + \ No newline at end of file diff --git a/src/components/uh-notify-dialog/uh-notify-dialog.vue b/src/components/uh-notify-dialog/uh-notify-dialog.vue index 8797385..4215130 100644 --- a/src/components/uh-notify-dialog/uh-notify-dialog.vue +++ b/src/components/uh-notify-dialog/uh-notify-dialog.vue @@ -1,12 +1,4 @@ \ No newline at end of file diff --git a/src/pages/maintenance/maintenance.vue b/src/pages/maintenance/maintenance.vue index 914de14..a7e8ec2 100644 --- a/src/pages/maintenance/maintenance.vue +++ b/src/pages/maintenance/maintenance.vue @@ -3,7 +3,6 @@ import { onLoad, onUnload } from '@dcloudio/uni-app' import { useAppConfigStore } from '@/store/appConfig' import { checkUrl } from '@/utils/url' - import { markdownConfig } from '@/config/markdown' import { usePluginAvailable } from '@/utils/plugin' import type { IPublicMaintenance } from '@/api/types/uni-halo' @@ -34,6 +33,8 @@ const spinning = ref(false) /** Toast 文案(空 = 隐藏) */ const toast = ref('') + /** 「维护详情」弹窗显隐 */ + const showDetail = ref(false) let timer : ReturnType | null = null let recoveryTimer : ReturnType | null = null let toastTimer : ReturnType | null = null @@ -42,8 +43,10 @@ const isIntercepted = computed(() => !!fromReason.value) const isScheduled = computed(() => maintenance.value?.status === 'scheduled') const title = computed(() => maintenance.value?.title || DEFAULT_MAINTENANCE_TITLE) - /** 配置的富文本说明(未配置时展示设计稿默认文案) */ - const description = computed(() => maintenance.value?.description || '') + /** 维护详情(富文本 HTML;小程序端「维护详情」弹窗内 mp-html 渲染) */ + const detailHtml = computed(() => maintenance.value?.description || '') + /** 维护说明(纯文本;标题下方按行直接展示,留空展示设计稿默认文案) */ + const noticeLines = computed(() => (maintenance.value?.notice || '').split('\n')) /** 应用信息 logo(相对插件内置资源路径 → BASE_API 补全) */ const appLogo = computed(() => { @@ -137,7 +140,8 @@ * 拉取失败(服务器停机)保持维护页不打扰。 */ async function silentCheck() { - if (refreshing) { return } + if (refreshing) + return refreshing = true try { await store.bootstrap({ force: true }) @@ -189,14 +193,12 @@ startRecoveryCheck() } else if (isIntercepted.value) { - // 拦截场景无维护信息(插件未激活/未配置)→ 默认文案 maintenance.value = null viewState.value = 'maintenance' startRecoveryCheck() } else if (ok) { - // 拉取成功但无 maintenance 键:未维护(或已到点自动结束)→ 服务正常 - viewState.value = 'normal' + goIndex() } else { viewState.value = 'error' @@ -251,7 +253,7 @@ onLoad((options) => { const from = options?.from fromReason.value = from === 'plugin' || from === 'maintenance' ? from : null - void load() + load() }) onUnload(() => { @@ -264,142 +266,153 @@ \ No newline at end of file diff --git a/src/pages/tabbar/category/category.vue b/src/pages/tabbar/category/category.vue index 8c85ccf..0fef65d 100644 --- a/src/pages/tabbar/category/category.vue +++ b/src/pages/tabbar/category/category.vue @@ -1,186 +1,181 @@ + + + + + + + + {{ item.spec.displayName }} + + + 共 {{ item.postCount }} 篇文章 + + + + + + {{ loadMoreText }} + + + + \ No newline at end of file diff --git a/src/pages/tabbar/gallery/gallery.vue b/src/pages/tabbar/gallery/gallery.vue index d53b73a..50d8576 100644 --- a/src/pages/tabbar/gallery/gallery.vue +++ b/src/pages/tabbar/gallery/gallery.vue @@ -1,250 +1,233 @@ + + \ No newline at end of file diff --git a/src/pages/tabbar/home/home.vue b/src/pages/tabbar/home/home.vue index 98ef5f6..e1f6b4b 100644 --- a/src/pages/tabbar/home/home.vue +++ b/src/pages/tabbar/home/home.vue @@ -6,6 +6,7 @@ import { useSettingStore } from '@/store/setting' import { checkAvatarUrl, checkImageUrl } from '@/utils/url' import { t } from '@/locale' + import { useMaintenanceIntercept } from '@/hooks/useMaintenanceIntercept' import type { IPost } from '@/api/types/halo' definePage({ @@ -146,12 +147,20 @@ }, }) } - + + function init(){ + if (!intercepted.value) { + handleQuery() + } + } + init() + /* ---------------- 生命周期 ---------------- */ // 维护检查 onShow(async () => { intercepted.value = await interceptOrContinue() + console.log('拦截状态', intercepted.value) }) onPullDownRefresh(() => { @@ -175,13 +184,6 @@ } }) - // 首次加载 - onMounted(() => { - if (intercepted.value) { - return - } - handleQuery() - })