From cf9c02cfc336744fc2cc104a114320f8cedb3917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Wed, 2 Sep 2026 16:32:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AB=AF?= =?UTF-8?q?=E8=BD=AE=E6=92=AD=E5=9B=BE=E9=87=8D=E5=86=99=EF=BC=8C=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=20Banner=20=E5=BD=92=E4=B8=80=E5=8C=96=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - uh-swiper 组件高内聚:内部请求 banners 公开列表,去掉前 5 条 上限,日期角标显示条目 date 快照,新增作者/日期信息浮层 - home.vue 移除配置 list 与审核模式劫持组装,点击分发改为 post→文章详情(postId)、custom→banner-detail 详情页 - 新增 banner-detail 详情页:公开详情接口 + mp-html 富文本 + 外链平台条件编译(非 App 端复制链接 / App 端访问按钮) - 类型与默认配置同步清理(IBannerConfig 移除 type/list) Co-Authored-By: AtomCode (deepseek-v4-flash) --- src/api/types/uni-halo.ts | 25 +- src/api/uni-halo.ts | 20 ++ src/components/uh-swiper/uh-swiper.vue | 290 +++++++++++------- src/config/appConfig.ts | 2 - .../banner-detail/banner-detail.vue | 189 ++++++++++++ src/pages/tabbar/home/home.vue | 107 +------ 6 files changed, 422 insertions(+), 211 deletions(-) create mode 100644 src/pages-blog/banner-detail/banner-detail.vue diff --git a/src/api/types/uni-halo.ts b/src/api/types/uni-halo.ts index 80abc45..cf7656b 100644 --- a/src/api/types/uni-halo.ts +++ b/src/api/types/uni-halo.ts @@ -31,8 +31,29 @@ export interface IBannerConfig { showIndicator?: boolean height?: string dotPosition?: string - type?: string - list?: unknown[] +} + +/** 轮播图公开条目(plugin-uni-halo Banner 归一化模型公开接口,列表脱敏不含 content) */ +export interface IBannerPublicItem { + /** Banner 条目 metadata.name */ + name: string + title?: string + cover?: string + /** 展示日期(ISO) */ + date?: string + authorName?: string + authorAvatar?: string + /** 来源:post=文章快照 / custom=自定义 */ + source?: 'post' | 'custom' + /** 文章 id(source=post 时跳转文章详情) */ + postId?: string + link?: string + priority?: number +} + +/** 轮播图公开详情(含 content 富文本 HTML) */ +export interface IBannerPublicDetail extends IBannerPublicItem { + content?: string } export interface IPageConfig { diff --git a/src/api/uni-halo.ts b/src/api/uni-halo.ts index 0df460b..bbeee8b 100644 --- a/src/api/uni-halo.ts +++ b/src/api/uni-halo.ts @@ -15,6 +15,8 @@ import { getPersonalToken } from '@/store/token' import type { IAppConfig, IAuditDataResult, + IBannerPublicDetail, + IBannerPublicItem, ICommentWidgetConfig, IDoubanDetail, IHaloGlobalConfig, @@ -67,6 +69,24 @@ export function getAuditData() { }) } +/** + * 获取首页轮播图列表(公开;按 priority 有序,脱敏不含 content) + */ +export function getBanners() { + return http.Get>('/apis/api.unihalo.ialley.cn/v1alpha1/plugins/plugin-uni-halo/banners', { + meta: { requestFrom: RequestFrom.Halo }, + }) +} + +/** + * 获取轮播图详情(公开;含 content 富文本 HTML) + */ +export function getBannerDetail(name: string) { + return http.Get>(`/apis/api.unihalo.ialley.cn/v1alpha1/plugins/plugin-uni-halo/banners/${name}`, { + meta: { requestFrom: RequestFrom.Halo }, + }) +} + /** * 获取 Halo 全局配置信息 */ diff --git a/src/components/uh-swiper/uh-swiper.vue b/src/components/uh-swiper/uh-swiper.vue index a44f871..7a031ac 100644 --- a/src/components/uh-swiper/uh-swiper.vue +++ b/src/components/uh-swiper/uh-swiper.vue @@ -1,19 +1,33 @@