This commit is contained in:
2026-09-24 16:25:22 +08:00
commit 7428184f01
1198 changed files with 314515 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
/**
* 未读角标状态(全站唯一来源)
* ------------------------------------------------------------
* 角标 = 未读数。对应内容被查看后置 0 → 角标自动隐藏。
*
* 使用:
* - TabBar`utils/role.uts` 里用 `badgeText(hrUnread.events)` 生成 dotLabel
* - 列表行:`<view v-if="hrUnread.msgCenter > 0" class="hr-badge">`
* - 页面「查看后」:onPageShow 里调 markEventsRead() / markMessagesRead()
*/
import { reactive } from 'vue'
export type HrUnread = {
/** 事件 TabBar 角标(救援人员端 · 事件 Tab) */
events : number
/** 消息 TabBar 角标(仓管人员端 · 消息 Tab) */
messages : number
/** 「我的」页消息中心入口 / 消息中心分组角标 */
msgCenter : number
}
/** 全局未读数 */
export const hrUnread = reactive({
events: 4,
messages: 4,
msgCenter: 4
} as HrUnread)
/** 角标文案:0 时返回空串 —— x-badge 收到空 label 会自行隐藏,无需额外判断 */
export function badgeText(n : number) : string {
return n > 0 ? n.toString() : ''
}
/** 查看事件列表后调用(救援端事件 Tab 页 onPageShow */
export function markEventsRead() : void {
hrUnread.events = 0
}
/** 查看消息中心后调用(消息页 onPageShow */
export function markMessagesRead() : void {
hrUnread.messages = 0
hrUnread.msgCenter = 0
}