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 @@