mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-09-12 16:40:40 +08:00
feat: 实现全站布局偏好系统,支持多页面独立配置
本次提交完成了完整的偏好设置体系重构: 1. 新增preferences.md文档说明布局偏好设计与映射规则 2. 重构布局配置结构,按页面分组管理列表布局与卡片样式 3. 实现后端preferences字段到本地配置的自动映射转换 4. 完成首页、文章列表、归档页的布局动态切换逻辑 5. 重构投票组件样式绑定,改用unocss类名实现样式分离 6. 新增偏好设置页面,支持按页面配置布局参数 7. 兼容旧版布局参数的自动归一化转换 8. 补充完整的单元测试用例覆盖新旧数据迁移场景
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
* 应用设置默认值与类型(源自旧项目 utils/app.js 的 _DefaultAppSettings)
|
||||
*/
|
||||
|
||||
/** 单页布局偏好(列表布局 + 卡片样式,与后端 preferences 分区对齐) */
|
||||
export interface IPageLayoutPref {
|
||||
/** 列表布局:single=单列 / double=双列 */
|
||||
listLayout: string
|
||||
/** 卡片样式(组件 layout 值):image_top=上图下文 / image_right=左文右图 / image_bottom=上文下图(社交卡片) / image_left=左图右文 */
|
||||
cardType: string
|
||||
}
|
||||
|
||||
export interface IAppSettings {
|
||||
/** 评论头像是否圆形 */
|
||||
isAvatarRadius: boolean
|
||||
@@ -9,12 +17,14 @@ export interface IAppSettings {
|
||||
useDot: boolean
|
||||
dotPosition: string
|
||||
}
|
||||
/** 布局配置 */
|
||||
/** 布局配置(按页面分组,每组可独立自定义) */
|
||||
layout: {
|
||||
/** h_row_col1 = 一行一列 / h_row_col2 = 一行两列 */
|
||||
home: string
|
||||
/** lr_image_text=左图右文 / lr_text_image=左文右图 / tb_image_text=上图下文 / tb_text_image=上文下图 / only_text=仅文字 */
|
||||
cardType: string
|
||||
/** 首页 */
|
||||
home: IPageLayoutPref
|
||||
/** 文章列表页 */
|
||||
articles: IPageLayoutPref
|
||||
/** 文章归档页 */
|
||||
archives: IPageLayoutPref
|
||||
}
|
||||
/** 广告配置 */
|
||||
ad: {
|
||||
@@ -53,8 +63,9 @@ export const DefaultAppSettings: IAppSettings = {
|
||||
dotPosition: 'right',
|
||||
},
|
||||
layout: {
|
||||
home: 'h_row_col1',
|
||||
cardType: 'lr_image_text',
|
||||
home: { listLayout: 'single', cardType: 'image_bottom' },
|
||||
articles: { listLayout: 'double', cardType: 'image_bottom' },
|
||||
archives: { listLayout: 'single', cardType: 'image_bottom' },
|
||||
},
|
||||
ad: {
|
||||
timeout: 3,
|
||||
|
||||
Reference in New Issue
Block a user