1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-11-13 22:11:42 +08:00

refactor: 移除启动页逻辑,新增全局组件与偏好设置系统

1.  移除旧版启动页分流逻辑,直接跳转首页
2.  新增返回顶部、章节标题、导航栏等全局组件
3.  重构偏好设置系统,实现站点默认与本地差异分层管理
4.  删除冗余的测试mock、插件模块与样式文件
5.  优化文章卡片与评论组件样式,更新全局主题色
6.  清理废弃的请求参数与配置项
This commit is contained in:
小莫唐尼
2026-09-03 22:36:26 +08:00
parent cf9c02cfc3
commit 902faa70e7
49 changed files with 3170 additions and 4288 deletions
+3 -1
View File
@@ -45,7 +45,7 @@ const COMMENT_WIDGET_CAPTCHA_COOKIES = 'comment-widget-captcha'
*/
export function getPostList(params: IPostListReq) {
return http.Get<IResponse<IPostListRes>>('/apis/api.content.halo.run/v1alpha1/posts', {
params,
query: params,
meta: { requestFrom: RequestFrom.Halo },
})
}
@@ -124,6 +124,7 @@ export function getPostByTagName(tagName: string, params: IPostListReq) {
export function getPostCommentList(params: ICommentListReq) {
return http.Get<IResponse<ICommentListRes>>('/apis/api.halo.run/v1alpha1/comments', {
params,
cacheFor: 0,
meta: { requestFrom: RequestFrom.Halo },
})
}
@@ -134,6 +135,7 @@ export function getPostCommentList(params: ICommentListReq) {
export function getPostCommentReplyList(commentName: string, params: ICommentListReq) {
return http.Get<IResponse<ICommentListRes>>(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, {
params,
cacheFor: 0,
meta: { requestFrom: RequestFrom.Halo },
})
}
+36 -5
View File
@@ -27,6 +27,13 @@ export interface IListResult<T> {
totalPages: number
}
export interface IOwner {
avatar?: string
displayName?: string
bio?: string
metadata:{name:string}
}
/* ---------- 文章 Post ---------- */
export interface IPostSpec {
@@ -34,6 +41,7 @@ export interface IPostSpec {
slug: string
excerpt?: string
cover?: string
owner:IOwner
/** 发布时间(Halo 2.x 结构,旧项目直接使用) */
publishTime?: string
deleted: boolean
@@ -83,6 +91,7 @@ export interface IContent {
export interface IPost {
metadata: IMetadata
spec: IPostSpec
owner: IOwner
status?: IPostStatus
content?: IContent
categories?: ICategory[]
@@ -270,13 +279,28 @@ export type ICommentListRes = IListResult<IComment>
export interface IMoment {
metadata: IMetadata
/** 作者(公开接口在顶层返回;spec.owner 只是作者用户名) */
owner?: {
avatar?: string
bio?: string
displayName: string
name: string
[key: string]: unknown
}
spec: {
content: string
owner: {
displayName: string
avatar?: string
website?: string
content: {
/** 正文 HTML */
html?: string
raw?: string
/** 多媒体(图片/视频/音频均在此,勿误读成 spec.medium) */
medium?: {
type?: 'PHOTO' | 'VIDEO' | 'AUDIO'
url?: string
[key: string]: unknown
}[]
[key: string]: unknown
}
owner?: string
visible: 'PUBLIC' | 'PRIVATE'
allowComment: boolean
approved: boolean
@@ -285,6 +309,13 @@ export interface IMoment {
tags?: string[]
releaseTime?: string
}
/** 互动数据(公开接口返回:点赞/评论数) */
stats?: {
approvedComment?: number
totalComment?: number
upvote?: number
[key: string]: unknown
}
status?: {
permalink: string
approved?: boolean
+9 -8
View File
@@ -77,10 +77,6 @@ export interface IPageConfig {
/** 审计模式配置 */
export interface IAuditConfig {
auditModeEnabled?: boolean
auditModeData?: {
jsonUrl?: string
jsonData?: string
}
}
/** 审核模式数据(公开接口 GET /audit-data 返回) */
@@ -119,6 +115,15 @@ export interface IAppConfig {
pluginConfig?: IPluginConfig
pageConfig?: IPageConfig
auditConfig?: IAuditConfig
/**
* 站点级展示偏好默认(L0,插件端 GeneralConfig.preferences 经 getConfigs additive 下发;
* 客户端 layout.home/cardType/isAvatarRadius 的站点默认来源,本地偏好可覆盖)
*/
preferences?: {
homeListLayout?: string
articleCardType?: string
avatarRadius?: boolean
}
[key: string]: unknown
}
@@ -139,10 +144,6 @@ export interface IQRCodeInfo {
[key: string]: unknown
}
export interface IQRCodeImg {
[key: string]: unknown
}
/** 检查更新结果(uhalo-upgrade 对接) */
export interface IUpdateCheckRes {
code: number
-9
View File
@@ -124,15 +124,6 @@ export function getQRCodeInfo(key: string) {
})
}
/**
* 获取文章二维码图片
*/
export function getQRCodeImg(postId: string) {
return http.Get<IResponse<unknown>>(`/apis/api.unihalo.ialley.cn/v1alpha1/plugins/plugin-uni-halo/getQRCodeImg/${postId}`, {
meta: { requestFrom: RequestFrom.Halo },
})
}
/* ==================== 恋爱模块 ==================== */
/**