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

refactor: 重构偏好设置与恋爱模块,对齐插件端字段结构

1. 重构布局偏好字段映射,移除嵌套layout结构,直接使用插件端同名字段
2. 新增恋爱模块token管理与密码解锁功能,支持恋爱故事/相册/清单的密码保护
3. 重构首页快捷导航,支持插件端直接配置导航项
4. 清理废弃配置字段,统一站点默认值与插件端结构
5. 修复文章卡片布局读取逻辑,适配新的偏好字段结构
This commit is contained in:
小莫唐尼
2026-09-10 00:07:33 +08:00
parent b0f101c96c
commit 260d6965e3
19 changed files with 467 additions and 344 deletions
+5 -16
View File
@@ -2,15 +2,13 @@
* 应用配置默认值(源自旧项目 config/index.js 的 DefaultAppConfigs)
* 与 src/api/uni-halo.ts 的 getAppConfigs(plugin-uni-halo/getConfigs)配合,deepMerge 使用
* 页面/组件依赖其字段结构(pluginConfig.toolsPlugin.Authorization 等),改动需谨慎
* 2026-09-08 清理:与插件端 getConfigs 结构统一,移除已下线/无消费的默认字段
* (tokenConfig/pageTitle/bannerConfig/categoryConfig.type 等)
*/
import type { IAppConfig } from '@/api/types/uni-halo'
export const DefaultAppConfigs: IAppConfig = {
basicConfig: {
tokenConfig: {
personalToken: '',
},
},
basicConfig: {},
loveConfig: {},
imagesConfig: {},
authorConfig: {},
@@ -19,6 +17,7 @@ export const DefaultAppConfigs: IAppConfig = {
votePlugin: {},
toolsPlugin: {},
linksPlugin: {},
// 保留:友链提交授权头(pluginConfig.linksSubmitPlugin.Authorization)与站点信息展示仍读取
linksSubmitPlugin: {},
doubanPlugin: {
position: 'bottom',
@@ -26,19 +25,9 @@ export const DefaultAppConfigs: IAppConfig = {
},
pageConfig: {
homeConfig: {
pageTitle: '首页',
useCategory: true,
bannerConfig: {
enabled: true,
showTitle: true,
showIndicator: true,
height: '400rpx',
dotPosition: 'right',
},
},
categoryConfig: {
type: 'list',
},
categoryConfig: {},
momentConfig: {
useTagRandomColor: true,
},
+19 -80
View File
@@ -1,89 +1,28 @@
/**
* 应用设置默认值与类型(源自旧项目 utils/app.js 的 _DefaultAppSettings)
* 布局偏好字段命名与插件端 getConfigs.preferences 一致(2026-09-08 起去映射,以插件端字段为准)
* 2026-09-08 清理:banner/ad/gallery/links/about/article/contact 等无消费字段已移除,
* 仅保留偏好相关字段(与插件端 preferences 结构对齐)
*/
/** 单页布局偏好(列表布局 + 卡片样式,与后端 preferences 分区对齐) */
export interface IPageLayoutPref {
/** 列表布局:single=单列 / double=双列 */
listLayout: string
/** 卡片样式(组件 layout 值):image_top=上图下文 / image_right=左文右图 / image_bottom=上文下图(社交卡片) / image_left=左图右文 */
cardType: string
}
export interface IAppSettings {
/** 评论头像是否圆形 */
isAvatarRadius: boolean
banner: {
useDot: boolean
dotPosition: string
}
/** 布局配置(按页面分组,每组可独立自定义) */
layout: {
/** 首页 */
home: IPageLayoutPref
/** 文章列表页 */
articles: IPageLayoutPref
/** 文章归档页 */
archives: IPageLayoutPref
}
/** 广告配置 */
ad: {
/** 屏蔽广告时长,时间到后自动恢复展示(单位小时) */
timeout: number
/** 是否屏蔽广告 */
disabled: boolean
}
gallery: {
/** 是否使用瀑布流 */
useWaterfull: boolean
}
links: {
useSimple: boolean
useGroup: boolean
}
about: {
/** 显示后台登录入口 */
showAdmin: boolean
/** 显示所有的统计信息(关于页面) */
showAllCount: boolean
}
/** 文章配置 */
article: Record<string, unknown>
/** 联系博主页面 */
contact: {
/** 链接是否使用复制的方式,否则直接在内部打开 */
isLinkCopy: boolean
}
/** 评论头像是否圆形(插件端字段 avatarRadius) */
avatarRadius: boolean
/** 布局偏好(按页面分组,字段名 = 插件端 preferences 字段名,可直接消费 getConfigs) */
homeListLayout: string
homeCardType: string
articlesListLayout: string
articleCardType: string
archivesListLayout: string
archivesCardType: string
}
export const DefaultAppSettings: IAppSettings = {
isAvatarRadius: false,
banner: {
useDot: true,
dotPosition: 'right',
},
layout: {
home: { listLayout: 'single', cardType: 'image_top' },
articles: { listLayout: 'double', cardType: 'image_top' },
archives: { listLayout: 'single', cardType: 'image_top' },
},
ad: {
timeout: 3,
disabled: false,
},
gallery: {
useWaterfull: true,
},
links: {
useSimple: false,
useGroup: false,
},
about: {
showAdmin: false,
showAllCount: false,
},
article: {},
contact: {
isLinkCopy: true,
},
avatarRadius: false,
homeListLayout: 'single',
homeCardType: 'image_top',
articlesListLayout: 'double',
articleCardType: 'image_top',
archivesListLayout: 'single',
archivesCardType: 'image_top',
}