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

refactor: 清理注释中的迁移来源、日期与文档引用等额外信息

删除“源自旧项目/与旧项目一致/已下线(日期)/设计见 xxx.md”等迁移记录
与文档引用,注释仅保留功能描述;TODO 与脚手架杂项注释保留原样
This commit is contained in:
小莫唐尼
2026-09-11 18:45:57 +08:00
parent 8bb76fcd08
commit f76e8a43d4
48 changed files with 80 additions and 91 deletions
+6 -6
View File
@@ -42,7 +42,7 @@ export interface IPostSpec {
excerpt?: string excerpt?: string
cover?: string cover?: string
owner:IOwner owner:IOwner
/** 发布时间(Halo 2.x 结构,旧项目直接使用) */ /** 发布时间(Halo 2.x 结构) */
publishTime?: string publishTime?: string
deleted: boolean deleted: boolean
publish: boolean publish: boolean
@@ -97,7 +97,7 @@ export interface IPost {
categories?: ICategory[] categories?: ICategory[]
tags?: ITag[] tags?: ITag[]
contributors?: IContributor[] contributors?: IContributor[]
/** 旧项目使用的顶层统计(兼容 Halo 旧版结构) */ /** 顶层统计(兼容 Halo 旧版结构) */
stats?: { stats?: {
visit?: number visit?: number
upvote?: number upvote?: number
@@ -123,7 +123,7 @@ export type IPostListRes = IListResult<IPost>
/** 文章搜索请求参数(关键字) */ /** 文章搜索请求参数(关键字) */
export interface ISearchReq { export interface ISearchReq {
keyword?: string keyword?: string
/** 返回条数上限(旧版默认 50) */ /** 返回条数上限(默认 50) */
limit?: number limit?: number
page?: number page?: number
size?: number size?: number
@@ -152,7 +152,7 @@ export interface ICategory {
visiblePostCount?: number visiblePostCount?: number
} }
children?: ICategory[] children?: ICategory[]
/** 文章数(旧项目首页直接读取/排序用) */ /** 文章数 */
postCount?: number postCount?: number
} }
@@ -355,7 +355,7 @@ export interface IPhoto {
displayName: string displayName: string
description?: string description?: string
url: string url: string
/** 封面图(部分接口返回,兼容旧代码) */ /** 封面图(部分接口返回) */
cover?: string cover?: string
priority?: number priority?: number
takeTime?: string takeTime?: string
@@ -447,7 +447,7 @@ export interface ITrackerCounterReq {
title?: string title?: string
referrer?: string referrer?: string
language?: string language?: string
/** 访问页面路径(旧项目埋点 url 字段) */ /** 访问页面路径(埋点 url 字段) */
url?: string url?: string
} }
+11 -14
View File
@@ -18,10 +18,7 @@ export interface IImagesConfig {
export interface IPluginConfig { export interface IPluginConfig {
toolsPlugin?: { Authorization?: string } & Record<string, unknown> toolsPlugin?: { Authorization?: string } & Record<string, unknown>
/** /**
* 友链信息(插件端 spec.linkInfo 直接下发到本键,结构 = {submissionEnabled, miniInfo, siteInfo},字段名无映射; * 友链信息(插件端 spec.linkInfo 直接下发到本键,结构 = {submissionEnabled, miniInfo, siteInfo},字段名无映射)
* linksSubmitPlugin 旧键已弃用不再下发;votePlugin/linksPlugin 已下线(2026-09-10,app 端改插件启用检测判定);
* 2026-09-11 起新增基本配置 submissionEnabled(公开提交申请开关,原 setting linkConfig);authorInfo 已下线,
* 作者信息改读 authorConfig.blogger)
*/ */
linkInfo?: { linkInfo?: {
/** 基本配置:是否开放公开提交申请(默认 true;false 时隐藏「提交申请」入口) */ /** 基本配置:是否开放公开提交申请(默认 true;false 时隐藏「提交申请」入口) */
@@ -34,7 +31,7 @@ export interface IPluginConfig {
description?: string description?: string
applyRemark?: string applyRemark?: string
} }
/** 站点信息(对齐 Halo 官方友链提交 API:displayName/url/logo/description/backlink/feedUrls,2026-09-11 起不再含 email) */ /** 站点信息(对齐 Halo 官方友链提交 API:displayName/url/logo/description/backlink/feedUrls) */
siteInfo?: { siteInfo?: {
displayName?: string displayName?: string
url?: string url?: string
@@ -118,17 +115,17 @@ export interface IPageConfig {
aboutConfig?: { aboutConfig?: {
bgImageUrl?: string bgImageUrl?: string
waveImageUrl?: string waveImageUrl?: string
/** 页脚版权(2026-09-10 起插件端从应用设置迁入,显示于关于页页脚) */ /** 页脚版权(显示于关于页页脚) */
copyrightConfig?: { copyrightConfig?: {
enabled?: boolean enabled?: boolean
content?: string content?: string
} }
} }
/** 免责声明页(2026-09-10 起插件端从应用设置迁入:不再有 enabled 开关,按内容非空展示) */ /** 免责声明页(按内容非空展示) */
disclaimers?: { disclaimers?: {
content?: string content?: string
} }
/** 文章详情页配置(2026-09-10 起插件端从应用设置迁入:评论开关与版权文案) */ /** 文章详情页配置(评论开关与版权文案) */
postDetailConfig?: { postDetailConfig?: {
showComment?: boolean showComment?: boolean
copyrightEnabled?: boolean copyrightEnabled?: boolean
@@ -184,14 +181,14 @@ export interface IAppConfig {
} }
} }
/** /**
* 恋爱配置(2026-09-10 起插件端 loveEnabled 总开关下线,入口显隐由模块入口开关 * 恋爱配置(入口显隐由模块入口开关
* (ourStory/lovePhoto/loveDaily.enabled)与 navList 统一管理,客户端按模块开关判定) * (ourStory/lovePhoto/loveDaily.enabled)与 navList 统一管理,客户端按模块开关判定)
*/ */
loveConfig?: Record<string, unknown> loveConfig?: Record<string, unknown>
imagesConfig?: IImagesConfig imagesConfig?: IImagesConfig
/** /**
* 博主与社交(插件端 GeneralConfig.profile.blogger/social 重建;blogger 含 * 博主与社交(blogger 含
* nickname/avatar/email/description/website(官网地址 2026-09-10 新增)) * nickname/avatar/email/description/website)
*/ */
authorConfig?: Record<string, unknown> authorConfig?: Record<string, unknown>
appConfig?: Record<string, unknown> appConfig?: Record<string, unknown>
@@ -219,7 +216,7 @@ export interface IAppConfig {
avatarRadius?: boolean avatarRadius?: boolean
} }
/** /**
* 维护模式(additive,2026-09-04 插件端 GeneralConfig.spec.maintenance 经 getConfigs * 维护模式(additive,插件端 GeneralConfig.spec.maintenance 经 getConfigs
* 下发;仅 scheduled/active 时存在,键缺失=未维护或已到点自动结束) * 下发;仅 scheduled/active 时存在,键缺失=未维护或已到点自动结束)
*/ */
maintenance?: IPublicMaintenance maintenance?: IPublicMaintenance
@@ -228,7 +225,7 @@ export interface IAppConfig {
/** /**
* getConfigs 顶层 maintenance 键(插件端输出;status 判定权威在服务端,客户端仅据此 * getConfigs 顶层 maintenance 键(插件端输出;status 判定权威在服务端,客户端仅据此
* 展示维护页与倒计时,设计见插件 .docs/maintenance-config-design.md) * 展示维护页与倒计时)
*/ */
export interface IPublicMaintenance { export interface IPublicMaintenance {
/** scheduled 维护预告(倒计时至 startTime)/ active 维护中(倒计时至 endTime) */ /** scheduled 维护预告(倒计时至 startTime)/ active 维护中(倒计时至 endTime) */
@@ -428,7 +425,7 @@ export interface ICommentCaptcha {
[key: string]: unknown [key: string]: unknown
} }
/* ---------- 通知公告(plugin-uni-halo notice,2026-09-03 客户端接入) ---------- */ /* ---------- 通知公告(plugin-uni-halo notice) ---------- */
/** 公告公开列表项(脱敏,不含 content;内嵌类型信息 typeDisplayName/typeColor) */ /** 公告公开列表项(脱敏,不含 content;内嵌类型信息 typeDisplayName/typeColor) */
export interface INoticeListVo { export interface INoticeListVo {
+2 -2
View File
@@ -127,7 +127,7 @@ export function getQRCodeInfo(key: string) {
}) })
} }
/* ==================== 防刷验证码(plugin-uni-halo,2026-09-03 客户端接入) ==================== */ /* ==================== 防刷验证码(plugin-uni-halo) ==================== */
/** 防刷验证码(服务端 captcha/generate 返回;受保护写接口 403 时响应体亦附带新验证码) */ /** 防刷验证码(服务端 captcha/generate 返回;受保护写接口 403 时响应体亦附带新验证码) */
export interface IPluginCaptcha { export interface IPluginCaptcha {
@@ -158,7 +158,7 @@ export function buildCaptchaQuery(captcha?: ICaptchaQuery | null): ICaptchaQuery
return { captchaId: captcha.captchaId, captchaCode: captcha.captchaCode } return { captchaId: captcha.captchaId, captchaCode: captcha.captchaCode }
} }
/* ==================== 通知公告(plugin-uni-halo,2026-09-03 客户端接入) ==================== */ /* ==================== 通知公告(plugin-uni-halo) ==================== */
/** /**
* 公告分页列表(公开,仅已发布;脱敏不含 content,内嵌类型信息)。 * 公告分页列表(公开,仅已发布;脱敏不含 content,内嵌类型信息)。
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 文章迷你卡片(源自旧项目 components/article-min-card,新建复刻) * 文章迷你卡片
* 用于分类页 list-post 视图的文章列表 * 用于分类页 list-post 视图的文章列表
*/ */
import { computed } from 'vue' import { computed } from 'vue'
@@ -334,7 +334,7 @@
</view> </view>
</view> </view>
<!-- 提交按钮(与旧项目一致:选择后才出现状态机) --> <!-- 提交按钮(选择后才出现状态机) -->
<view v-if="submitForm.voteData.length !== 0" class="mt-3"> <view v-if="submitForm.voteData.length !== 0" class="mt-3">
<wd-button v-if="isVoted" disabled block> <wd-button v-if="isVoted" disabled block>
您已参与投票 您已参与投票
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 贡献热度图(源自旧项目 components/heatmap,新建复刻,精简版) * 贡献热度图
* 按日期统计文章发布数量,以年度格子图展示 * 按日期统计文章发布数量,以年度格子图展示
*/ */
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
@@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 友链底部悬浮操作栏(通用组件) * 友链底部悬浮操作栏(通用组件)
* 参考瞬间详情页底部悬浮按钮设计;通过 :actions 控制显示的按钮,事件回调 emit('apply') / emit('info') * 通过 :actions 控制显示的按钮,事件回调 emit('apply') / emit('info')
* 站点 tab / 小程序 tab 分别引入(如 :actions="['apply','info']" @apply=... @info=...) * 站点 tab / 小程序 tab 分别引入(如 :actions="['apply','info']" @apply=... @info=...)
*/ */
withDefaults(defineProps<{ withDefaults(defineProps<{
@@ -25,7 +25,7 @@ const isShow = ref(false)
const appConfigStore = useAppConfigStore() const appConfigStore = useAppConfigStore()
/** 小程序申请信息(字段与 uh-links-mini-apply 表单一致;小程序信息读 linkInfo.miniInfo; /** 小程序申请信息(字段与 uh-links-mini-apply 表单一致;小程序信息读 linkInfo.miniInfo;
* 作者信息 2026-09-10 起改读应用设置-博主资料 authorConfig.blogger(linkInfo.authorInfo 已下线),字段名无映射) */ * 作者信息读应用设置-博主资料 authorConfig.blogger,字段名无映射) */
const miniInfo = computed(() => { const miniInfo = computed(() => {
const miniCfg = (appConfigStore.configs.pluginConfig?.linkInfo?.miniInfo || {}) as Record<string, unknown> const miniCfg = (appConfigStore.configs.pluginConfig?.linkInfo?.miniInfo || {}) as Record<string, unknown>
const blogger = (appConfigStore.configs.authorConfig?.blogger || {}) as Record<string, unknown> const blogger = (appConfigStore.configs.authorConfig?.blogger || {}) as Record<string, unknown>
@@ -34,7 +34,7 @@ const miniInfo = computed(() => {
displayName: str(miniCfg, 'displayName'), displayName: str(miniCfg, 'displayName'),
miniProgramCode: str(miniCfg, 'miniProgramCode'), miniProgramCode: str(miniCfg, 'miniProgramCode'),
link: str(miniCfg, 'link'), link: str(miniCfg, 'link'),
// 作者信息:博主资料 nickname/avatar/website(官网地址 2026-09-10 新增) // 作者信息:博主资料 nickname/avatar/website
authorName: str(blogger, 'nickname'), authorName: str(blogger, 'nickname'),
avatar: str(blogger, 'avatar'), avatar: str(blogger, 'avatar'),
website: str(blogger, 'website'), website: str(blogger, 'website'),
@@ -1,7 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 友链申请表单弹窗(站点版,源自旧页面 pages-blog/submit-link) * 友链申请表单弹窗(站点版)
* 参考小程序申请弹窗 uh-links-mini-apply 的封装方式(uh-glass-popup bottom + 表单 + 提交)
* 提交后等待站长审核,通过后展示在「站点」列表中 * 提交后等待站长审核,通过后展示在「站点」列表中
*/ */
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
@@ -86,8 +85,7 @@ async function handleSubmit() {
if (!validateForm()) if (!validateForm())
return return
// linksSubmitPlugin 已弃用(2026-09-08),第三方友链自助提交暂未开放; // 第三方友链自助提交暂未开放
// 后续可对接 Halo 官方 plugin-links link-applications 接口
uni.showToast({ icon: 'none', title: '友链申请功能暂未开放,请联系站长' }) uni.showToast({ icon: 'none', title: '友链申请功能暂未开放,请联系站长' })
} }
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 站点友链信息弹窗(源自旧页面 pages-blog/submit-link 的博客详情弹窗,重设计为底部玻璃弹窗) * 站点友链信息弹窗
* 展示本站友链交换信息(博客名片 + 复制交换信息 + 站点缩略图) * 展示本站友链交换信息(博客名片 + 复制交换信息 + 站点缩略图)
* 数据源为插件端 linkInfo.siteInfo 配置(字段对齐 Halo 官方友链提交 API:displayName/url/logo/description/email/backlink/feedUrls) * 数据源为插件端 linkInfo.siteInfo 配置(字段对齐 Halo 官方友链提交 API:displayName/url/logo/description/email/backlink/feedUrls)
*/ */
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 受限阅读骨架屏(源自旧项目 components/restrict-read-skeleton,新建复刻) * 受限阅读骨架屏
* 受限内容遮挡 + 提示文字 + 验证按钮 * 受限内容遮挡 + 提示文字 + 验证按钮
*/ */
withDefaults(defineProps<{ withDefaults(defineProps<{
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* Halo 全局配置默认值(源自旧项目 config/halo.config.js) * Halo 全局配置默认值
* 与 src/api/uni-halo.ts 的 getHaloGlobalInfo(/actuator/globalinfo)配合,deepMerge 使用 * 与 src/api/uni-halo.ts 的 getHaloGlobalInfo(/actuator/globalinfo)配合,deepMerge 使用
*/ */
import type { IHaloGlobalConfig } from '@/api/types/uni-halo' import type { IHaloGlobalConfig } from '@/api/types/uni-halo'
-1
View File
@@ -1,6 +1,5 @@
/** /**
* 插件清单与可用性 hook * 插件清单与可用性 hook
* 源自旧项目 utils/plugin.js(TS 化)与 utils/plugin.ts,整体迁移至 hooks 目录。
* 提供: * 提供:
* - 依赖插件 ID 常量(NeedPluginIds)与插件清单(NeedPlugins) * - 依赖插件 ID 常量(NeedPluginIds)与插件清单(NeedPlugins)
* - 底层可用性检查(checkNeedPluginAvailable) * - 底层可用性检查(checkNeedPluginAvailable)
@@ -408,7 +408,7 @@
/* ---------------- 格式化 ---------------- */ /* ---------------- 格式化 ---------------- */
function formatPublishTime(time ?: string) : string { function formatPublishTime(time ?: string) : string {
// 与旧项目一致:yyyy年MM月dd日 星期w // yyyy年MM月dd日 星期w
return time ? formatTime({ d: time, f: 'yyyy年MM月dd日 星期w' }) : '' return time ? formatTime({ d: time, f: 'yyyy年MM月dd日 星期w' }) : ''
} }
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 免责声明页(源自旧项目 pagesA/disclaimers,新建复刻) * 免责声明页
*/ */
import { computed } from 'vue' import { computed } from 'vue'
import { useAppConfigStore } from '@/store/appConfig' import { useAppConfigStore } from '@/store/appConfig'
+2 -2
View File
@@ -68,7 +68,7 @@ async function handleMiniPluginRefresh() {
handleGetMiniProgramLinks() handleGetMiniProgramLinks()
} }
/** 是否开放公开提交申请(通用配置-友链信息-基本配置 submissionEnabled,2026-09-11 由 setting linkConfig 迁入;默认 true) */ /** 是否开放公开提交申请(通用配置-友链信息-基本配置 submissionEnabled;默认 true) */
const submissionEnabled = computed(() => (haloPluginConfigs.value?.linkInfo?.submissionEnabled ?? true)) const submissionEnabled = computed(() => (haloPluginConfigs.value?.linkInfo?.submissionEnabled ?? true))
/* ---------------- tabs ---------------- */ /* ---------------- tabs ---------------- */
@@ -578,7 +578,7 @@ onReachBottom(() => {
</view> </view>
</view> </view>
<!-- 底部悬浮操作栏(通用组件);提交申请入口按 submissionEnabled 显隐(2026-09-11) --> <!-- 底部悬浮操作栏(通用组件);提交申请入口按 submissionEnabled 显隐 -->
<uh-links-actions :actions="submissionEnabled ? ['apply', 'info'] : ['info']" @apply="handleOpenApply" @info="handleOpenMiniInfo" /> <uh-links-actions :actions="submissionEnabled ? ['apply', 'info'] : ['info']" @apply="handleOpenApply" @info="handleOpenMiniInfo" />
</view> </view>
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 恋爱清单页(源自旧项目 pagesA/love/list.vue,新建复刻) * 恋爱清单页
* 恋爱清单卡片列表(未开始/进行中/已完成),展开查看详情与回忆图片 * 恋爱清单卡片列表(未开始/进行中/已完成),展开查看详情与回忆图片
*/ */
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
+2 -2
View File
@@ -54,7 +54,7 @@
updateTimestamp ?: string updateTimestamp ?: string
}[]>([]) }[]>([])
/* ---------------- 动画(对应旧版 mixin calcAniWait) ---------------- */ /* ---------------- 动画 ---------------- */
/** 预计算列表项入场延迟(每 10 项重置一轮,每项递增 50ms);必须在渲染外算好,渲染中修改响应式状态会导致递归更新 */ /** 预计算列表项入场延迟(每 10 项重置一轮,每项递增 50ms);必须在渲染外算好,渲染中修改响应式状态会导致递归更新 */
const calcAniDelays = computed(() => { const calcAniDelays = computed(() => {
let wait = 0 let wait = 0
@@ -103,7 +103,7 @@
} }
} }
/** 实时搜索:输入防抖 400ms 后触发(对应旧版 tm-search 的 @input) */ /** 实时搜索:输入防抖 400ms 后触发 */
const handleOnInput = debounce(() => { const handleOnInput = debounce(() => {
handleOnSearch() handleOnSearch()
}, 400) }, 400)
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 标签详情页(源自旧项目 pagesA/tag-detail,新建复刻) * 标签详情页
* 展示某标签下的文章列表,分页加载 * 展示某标签下的文章列表,分页加载
*/ */
import { ref } from 'vue' import { ref } from 'vue'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 文章标签页(源自旧项目 pagesA/tags,新建复刻) * 文章标签页
*/ */
definePage({ definePage({
style: { style: {
+3 -3
View File
@@ -57,7 +57,7 @@ const isEnded = computed(() => vote.value?.spec?.hasEnded || false)
/* ---------------- 工具 ---------------- */ /* ---------------- 工具 ---------------- */
function formatTime(date?: string, fmt = 'yyyy-MM-dd HH:mm'): string { function formatTime(date?: string, fmt = 'yyyy-MM-dd HH:mm'): string {
// 与旧项目一致:yyyy-MM-dd HH:mm // yyyy-MM-dd HH:mm
return date ? formatTimeUtil({ d: date, f: fmt }) : '' return date ? formatTimeUtil({ d: date, f: fmt }) : ''
} }
@@ -88,7 +88,7 @@ async function handleGetData() {
tempVote.spec.disabled = isVoted.value tempVote.spec.disabled = isVoted.value
tempVote.spec._uh_type = VOTE_TYPES[typeKey] || tempVote.spec.type tempVote.spec._uh_type = VOTE_TYPES[typeKey] || tempVote.spec.type
// 计算状态(与旧项目 calcVoteState 一致,含 timeLimit 非 custom 时 hasEnded 兜底) // 计算状态(含 timeLimit 非 custom 时 hasEnded 兜底)
tempVote.spec._uh_state = calcVoteState(tempVote) tempVote.spec._uh_state = calcVoteState(tempVote)
if (tempVote.spec._uh_state.state === '已结束') if (tempVote.spec._uh_state.state === '已结束')
tempVote.spec.hasEnded = true tempVote.spec.hasEnded = true
@@ -327,7 +327,7 @@ onShareTimeline(() => ({
</text> </text>
</view> </view>
<view class="options flex flex-col gap-3 w-full"> <view class="options flex flex-col gap-3 w-full">
<!-- PK 对抗条(与旧项目 pk-container 一致;样式需顶层定义,勿嵌套在 .vote-card 下) --> <!-- PK 对抗条(样式需顶层定义,勿嵌套在 .vote-card 下) -->
<view v-if="vote.spec?.type === 'pk'" class="pk-container box-border w-full flex"> <view v-if="vote.spec?.type === 'pk'" class="pk-container box-border w-full flex">
<view <view
v-for="(option, optionIndex) in vote.spec?.options" :key="optionIndex" v-for="(option, optionIndex) in vote.spec?.options" :key="optionIndex"
+5 -5
View File
@@ -67,7 +67,7 @@
options : IFilterOption[] options : IFilterOption[]
} }
/** 筛选维度(与旧项目 tm-dropDownMenu 一致) */ /** 筛选维度 */
const filterConfig : IFilterItem[] = [ const filterConfig : IFilterItem[] = [
{ {
key: 'type', key: 'type',
@@ -150,7 +150,7 @@
} }
/* ---------------- 搜索 ---------------- */ /* ---------------- 搜索 ---------------- */
/** 实时搜索:输入防抖 400ms 后触发(对应旧版 tm-search 的 @input) */ /** 实时搜索:输入防抖 400ms 后触发 */
const handleOnInput = debounce(() => { const handleOnInput = debounce(() => {
queryParams.value.page = 1 queryParams.value.page = 1
isLoadMore.value = false isLoadMore.value = false
@@ -196,12 +196,12 @@
? dataList.value.concat(tempItems) ? dataList.value.concat(tempItems)
: tempItems : tempItems
// 未投优先排序(与旧项目一致) // 未投优先排序
dataList.value = dataList.value.sort((a, b) => { dataList.value = dataList.value.sort((a, b) => {
return Number(a.spec?.isVoted) - Number(b.spec?.isVoted) return Number(a.spec?.isVoted) - Number(b.spec?.isVoted)
}) })
// 是否已投过滤(与旧项目一致) // 是否已投过滤
if (filterIsVoted.value !== undefined) { if (filterIsVoted.value !== undefined) {
dataList.value = dataList.value.filter(x => x.spec?.isVoted === filterIsVoted.value) dataList.value = dataList.value.filter(x => x.spec?.isVoted === filterIsVoted.value)
} }
@@ -221,7 +221,7 @@
} }
} }
/** 卡片点击跳详情(与旧项目 VoteCard @on-click 一致) */ /** 卡片点击跳详情 */
function handleOnVoteClick(vote : IVoteItem) { function handleOnVoteClick(vote : IVoteItem) {
const name = vote.metadata?.name const name = vote.metadata?.name
if (!name) if (!name)
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 网站浏览页(源自旧项目 pagesC/website,新建复刻) * 网站浏览页
* 内嵌 web-view 展示外部链接 * 内嵌 web-view 展示外部链接
*/ */
import { ref } from 'vue' import { ref } from 'vue'
+3 -3
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* 关于页(源自旧项目 pages/tabbar/about/about.vue,新建复刻) * 关于页
* 功能:博主信息 + 站点统计 + 功能导航 + 版权 * 功能:博主信息 + 站点统计 + 功能导航 + 版权
* 风格:对齐全站设计语言(bg-page + uh-global-card-glass + uh-section-title + 彩色图标块) * 风格:对齐全站设计语言(bg-page + uh-global-card-glass + uh-section-title + 彩色图标块)
*/ */
@@ -31,11 +31,11 @@
const { check: checkDataVisualPlugin } = usePluginAvailable({ const { check: checkDataVisualPlugin } = usePluginAvailable({
pluginId: NeedPluginIds.PluginDataStatistics, pluginId: NeedPluginIds.PluginDataStatistics,
}) })
/** 投票插件可用性(投票中心导航项显隐;pluginConfig.votePlugin 已下线,2026-09-10 改插件启用检测) */ /** 投票插件可用性(投票中心导航项显隐) */
const { check: checkVotePluginAvailable } = usePluginAvailable({ const { check: checkVotePluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginVote, pluginId: NeedPluginIds.PluginVote,
}) })
/** 链接插件可用性(友情链接导航项显隐;pluginConfig.linksPlugin 已下线,2026-09-10 改插件启用检测) */ /** 链接插件可用性(友情链接导航项显隐) */
const { check: checkLinksPluginAvailable } = usePluginAvailable({ const { check: checkLinksPluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginLinks, pluginId: NeedPluginIds.PluginLinks,
}) })
+1 -1
View File
@@ -105,7 +105,7 @@ export const useAppConfigStore = defineStore(
} }
/** /**
* 统一拉取静态配置(设计见 .docs/static-config-unified-fetch-design.md): * 统一拉取静态配置:
* getConfigs + audit-data + love-config 并行一次;TTL 内(默认 5 分钟,persist 恢复后 * getConfigs + audit-data + love-config 并行一次;TTL 内(默认 5 分钟,persist 恢复后
* 亦生效)直接返回缓存,避免每次冷启动/onShow 重复请求;force=true 强制刷新。 * 亦生效)直接返回缓存,避免每次冷启动/onShow 重复请求;force=true 强制刷新。
* 返回 ok = getConfigs 是否成功(失败时走内置默认/旧缓存,由调用方决定后续)。 * 返回 ok = getConfigs 是否成功(失败时走内置默认/旧缓存,由调用方决定后续)。
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* Halo 全局配置 store(源自旧项目 store/config.js 的 haloConfig 部分) * Halo 全局配置 store
*/ */
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { ref } from 'vue' import { ref } from 'vue'
+1 -3
View File
@@ -5,8 +5,6 @@
* - applySiteDefaults(site):启动 fetchConfigs 后把 getConfigs 收集的 L0 与本地差异合并(含旧数据迁移); * - applySiteDefaults(site):启动 fetchConfigs 后把 getConfigs 收集的 L0 与本地差异合并(含旧数据迁移);
* - savePreference(patch):写本地差异(uh_pref_local_v1)并立即重合并; * - savePreference(patch):写本地差异(uh_pref_local_v1)并立即重合并;
* - resetPreferences:清本地差异,立即回退「站点默认」(无 L0 时回退内置默认)。 * - resetPreferences:清本地差异,立即回退「站点默认」(无 L0 时回退内置默认)。
*
* 设计依据:插件仓库 .docs/config-system-v2-redesign.md §3-4(v2.2:远端=站点默认,无用户级远端层)。
*/ */
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { ref } from 'vue' import { ref } from 'vue'
@@ -36,7 +34,7 @@ export const useSettingStore = defineStore(
/** /**
* 应用站点默认并合并本地差异(启动 fetchConfigs 成功后调用;site 为 null/空时仅本地差异覆盖内置默认) * 应用站点默认并合并本地差异(启动 fetchConfigs 成功后调用;site 为 null/空时仅本地差异覆盖内置默认)
* 首次运行时顺带迁移旧版全量 persist(见 utils/preference.migrateLegacyLocalPrefs) * 首次运行时顺带迁移旧版全量 persist
*/ */
const applySiteDefaults = (site: LocalPrefs | null): void => { const applySiteDefaults = (site: LocalPrefs | null): void => {
siteDefaults.value = site && typeof site === 'object' ? site : null siteDefaults.value = site && typeof site === 'object' ? site : null
+2 -2
View File
@@ -15,11 +15,11 @@ import { isDoubleTokenRes, isSingleTokenRes } from '@/api/types/login'
import { useUserStore } from './user' import { useUserStore } from './user'
import { getCache } from '@/utils/storage' import { getCache } from '@/utils/storage'
/** 个人令牌存储 key(源自旧项目 utils/token.js,含 basicConfig.tokenConfig) */ /** 个人令牌存储 key */
const APP_TOKENS_KEY = 'APP_TOKENS' const APP_TOKENS_KEY = 'APP_TOKENS'
/** /**
* 获取个人令牌(旧项目 getPersonalToken) * 获取个人令牌
* 用于需要个人 token 的接口(如非匿名投票 submitVote) * 用于需要个人 token 的接口(如非匿名投票 submitVote)
* @returns 个人令牌,未配置时为空字符串 * @returns 个人令牌,未配置时为空字符串
*/ */
+1 -2
View File
@@ -1,9 +1,8 @@
/** /**
* 认证信息工具(请求头来源) * 认证信息工具(请求头来源)
* 源自旧项目 utils/auth.js,按需命名导出
*/ */
/** 管理员登录 token 存储 key(旧项目 APP_ADMIN_LOGIN_TOKEN) */ /** 管理员登录 token 存储 key */
const ADMIN_LOGIN_TOKEN_KEY = 'APP_ADMIN_LOGIN_TOKEN' const ADMIN_LOGIN_TOKEN_KEY = 'APP_ADMIN_LOGIN_TOKEN'
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 检查更新工具(源自旧项目 uni_modules/uhalo-upgrade/utils/check-update.ts,新建复刻) * 检查更新工具
* 业务侧调用 uni-halo 的 checkVersion 接口,有新版时弹窗提示并下载安装(APP 端) * 业务侧调用 uni-halo 的 checkVersion 接口,有新版时弹窗提示并下载安装(APP 端)
* 使用方式:App.vue onLaunch 中调用 checkUpdate(import.meta.env.VITE_SERVER_BASEURL) * 使用方式:App.vue onLaunch 中调用 checkUpdate(import.meta.env.VITE_SERVER_BASEURL)
*/ */
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* Cookie 处理工具(源自旧项目 utils/cookies.js,按需命名导出) * Cookie 处理工具
*/ */
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 时间格式化工具(源自旧项目 common/filters/index.js 的 formatTime,改 utils 按需导出) * 时间格式化工具
* 支持格式化 yyyy年MM月dd日 HH点mm分ss秒 星期w q季 * 支持格式化 yyyy年MM月dd日 HH点mm分ss秒 星期w q季
* 兼容对象形式传入 { d: '2021-06-04', f: 'yyyy年' }(d 必传,f 默认 yyyy-MM-dd HH:mm:ss) * 兼容对象形式传入 { d: '2021-06-04', f: 'yyyy年' }(d 必传,f 默认 yyyy-MM-dd HH:mm:ss)
*/ */
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 图片缓存工具(源自旧项目 utils/imageCache.js,按需命名导出) * 图片缓存工具
* 下载图片到本地缓存(APP 端),返回本地路径 * 下载图片到本地缓存(APP 端),返回本地路径
*/ */
import { checkIsUrl } from './url' import { checkIsUrl } from './url'
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* JSON 解析工具(源自旧项目 utils/index.js 的 checkJsonAndParse,按需命名导出) * JSON 解析工具
*/ */
export interface IParseResult<T = unknown> { export interface IParseResult<T = unknown> {
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 对象合并/克隆工具(源自旧项目 utils/index.js 的 deepMerge/deepClone,按需命名导出) * 对象合并/克隆工具
*/ */
/** 判断是否为普通对象(非数组、非 null) */ /** 判断是否为普通对象(非数组、非 null) */
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 网络状态工具(源自旧项目 utils/network.js,按需命名导出) * 网络状态工具
* 网络可用性检查、断网提示、错误文案处理 * 网络可用性检查、断网提示、错误文案处理
*/ */
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 页面通用工具(源自旧项目 common/mixins/index.js 的 methods/computed,改 utils 按需导出) * 页面通用工具
* haloConfig/haloPluginsConfig/globalAppSettings 对应新架构用 Pinia store 读取,此处不再提供 * haloConfig/haloPluginsConfig/globalAppSettings 对应新架构用 Pinia store 读取,此处不再提供
*/ */
import { useAppConfigStore } from '@/store/appConfig' import { useAppConfigStore } from '@/store/appConfig'
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 平台判断工具(源自旧项目 common/mixins/index.js 的 _isWechat data,改 utils 按需导出) * 平台判断工具
*/ */
/** 是否微信小程序平台(条件编译,编译期确定) */ /** 是否微信小程序平台(条件编译,编译期确定) */
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 随机数工具(源自旧项目 utils/random.js,按需命名导出) * 随机数工具
*/ */
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 受限阅读工具(源自旧项目 utils/restrictRead.js,按需命名导出) * 受限阅读工具
* 处理文章受限内容(密码/验证码/登录/付费/评论)的检测与占位符替换 * 处理文章受限内容(密码/验证码/登录/付费/评论)的检测与占位符替换
*/ */
import type { IPost } from '@/api/types/halo' import type { IPost } from '@/api/types/halo'
+1 -2
View File
@@ -1,7 +1,6 @@
/** /**
* 统一弹窗工具(源自旧项目 js_sdk/fy-showModal,改 utils 按需导出) * 统一弹窗工具
* 新架构简单场景直接用 uni.showModal + Promise 包装;需要统一视觉时用 wot-ui wd-dialog/wd-message-box * 新架构简单场景直接用 uni.showModal + Promise 包装;需要统一视觉时用 wot-ui wd-dialog/wd-message-box
* 替代旧项目的 uni.$eShowModal 全局挂载
*/ */
import { isWechat } from './platform' import { isWechat } from './platform'
-1
View File
@@ -1,6 +1,5 @@
/** /**
* 通用缓存(带过期时间) * 通用缓存(带过期时间)
* 源自旧项目 utils/storage.js,按需命名导出
*/ */
interface ICacheItem<T> { interface ICacheItem<T> {
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 节流工具(源自旧项目 utils/throttle.js,按需命名导出) * 节流工具
* 首次立即执行,之后在 wait 时间窗口内最多执行一次 * 首次立即执行,之后在 wait 时间窗口内最多执行一次
*/ */
let timer: ReturnType<typeof setTimeout> | null = null let timer: ReturnType<typeof setTimeout> | null = null
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 点赞状态工具(源自旧项目 utils/upvote.js,按需命名导出) * 点赞状态工具
* 文章/瞬间点赞状态本地缓存 * 文章/瞬间点赞状态本地缓存
*/ */
import { getCache, setCache } from './storage' import { getCache, setCache } from './storage'
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* URL 处理工具(源自旧项目 utils/index.js 的 URL 相关方法,按需命名导出) * URL 处理工具
* 依赖 BASE_API(env)与应用图片配置(storage) * 依赖 BASE_API(env)与应用图片配置(storage)
*/ */
import { getCache } from './storage' import { getCache } from './storage'
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* URL 参数工具(源自旧项目 utils/url.params.js,按需命名导出) * URL 参数工具
*/ */
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* UUID 生成工具(源自旧项目 utils/uuid.js,按需命名导出) * UUID 生成工具
*/ */
/** /**
+6 -6
View File
@@ -1,5 +1,5 @@
/** /**
* 投票工具(源自旧项目 utils/vote.js,按需命名导出) * 投票工具
* 投票状态计算、UID 缓存、投票周期判断 * 投票状态计算、UID 缓存、投票周期判断
*/ */
import { getCache, setCache } from './storage'; import { getCache, setCache } from './storage';
@@ -10,7 +10,7 @@ const UnihaloVoteUid = 'unihalo_vote_uid';
export type VoteType = 'single' | 'multiple' | 'pk'; export type VoteType = 'single' | 'multiple' | 'pk';
export type VoteState = 'not-voted' | 'voting' | 'voted' | 'vote-ended'; export type VoteState = 'not-voted' | 'voting' | 'voted' | 'vote-ended';
/** 投票类型中文映射(与旧项目一致:key 为插件小写 type) */ /** 投票类型中文映射(key 为插件小写 type) */
export const VOTE_TYPES: Record<string, string> = { export const VOTE_TYPES: Record<string, string> = {
pk: '双选PK', pk: '双选PK',
multiple: '多选', multiple: '多选',
@@ -25,7 +25,7 @@ export const VOTE_STATES: { NOT_VOTED: VoteState; VOTING: VoteState; VOTED: Vote
VOTE_ENDED: 'vote-ended' VOTE_ENDED: 'vote-ended'
}; };
/** 投票展示状态(与旧项目 VOTE_STATES 一致:中文 + unocss 文字/背景色类) */ /** 投票展示状态(中文 + unocss 文字/背景色类) */
export const VOTE_STATE_LABELS: Record<string, { state: string; color: string; bgColor: string }> = { export const VOTE_STATE_LABELS: Record<string, { state: string; color: string; bgColor: string }> = {
未开始: { state: '未开始', color: 'text-orange-400', bgColor: 'bg-orange-100' }, 未开始: { state: '未开始', color: 'text-orange-400', bgColor: 'bg-orange-100' },
进行中: { state: '进行中', color: 'text-green-400', bgColor: 'bg-green-100' }, 进行中: { state: '进行中', color: 'text-green-400', bgColor: 'bg-green-100' },
@@ -45,7 +45,7 @@ export function getOrCreateVoteUid(): string {
} }
/** /**
* 计算投票展示状态(与旧项目 calcVoteState 一致) * 计算投票展示状态
* 非 custom 期限(permanent 等)直接看 hasEnded;custom 按起止时间判断 * 非 custom 期限(permanent 等)直接看 hasEnded;custom 按起止时间判断
* @param vote 投票对象(含 spec.timeLimit/hasEnded/startDate/endDate) * @param vote 投票对象(含 spec.timeLimit/hasEnded/startDate/endDate)
* @returns { state: '未开始' | '进行中' | '已结束', color: unocss 文字色类, bgColor: unocss 背景色类 } * @returns { state: '未开始' | '进行中' | '已结束', color: unocss 文字色类, bgColor: unocss 背景色类 }
@@ -73,7 +73,7 @@ export function calcVoteState(vote: { spec?: { timeLimit?: string; hasEnded?: bo
} }
/** /**
* 计算选项票数占比(与旧项目一致:整数百分比) * 计算选项票数占比(整数百分比)
* @param vote 投票对象(含 stats.voteCount) * @param vote 投票对象(含 stats.voteCount)
* @param option 选项(含 count) * @param option 选项(含 count)
*/ */
@@ -95,7 +95,7 @@ interface IVoteCacheData {
} }
/** /**
* 投票缓存工具(源自旧项目 utils/vote.js 的 voteCacheUtil) * 投票缓存工具
*/ */
export const voteCacheUtil = { export const voteCacheUtil = {
/** 是否已缓存(已投票) */ /** 是否已缓存(已投票) */