This commit is contained in:
2026-09-24 16:25:22 +08:00
commit 7428184f01
1198 changed files with 314515 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
<template>
<hr-page page-bg="#F3F4F6" status-bg="#FFFFFF" nav-title="消息中心" :xloading="true" @right-click="onReadAll">
<template v-slot:right>
<x-icon name="check-double-line" color="#6B7280" font-size="17"></x-icon>
</template>
<view class="hr-body">
<!-- 消息分类筛选(组件库 xRadioButton 分段切换) -->
<view style="margin-bottom:8rpx">
<x-radio-button v-model="chipId" :list="chipTabs" height="64rpx" space="4rpx" round="22rpx"
text-style="font-weight:bold;" bg-color="#E5E7EB" active-color="#2563EB"
active-font-color="#FFFFFF" font-color="#6B7280" font-size="22rpx"></x-radio-button>
</view>
<view v-for="(g, gi) in groups" :key="gi">
<hr-sec :title="g.title" :more="g.count > 0 ? g.count.toString() + ' 条' : ''"></hr-sec>
<hr-card :variant="g.danger ? 'danger' : 'list'">
<hr-lrow v-for="(m, i) in g.items" :key="i" :icon="m.icon" :theme="m.theme" :title="m.title"
:sub="m.sub" :value="m.action" :value-theme="m.theme == 'red' ? 'red' : 'pri'"
:value-bold="true" :is-last="i == g.items.length - 1" @click="onMsgClick(m)"></hr-lrow>
</hr-card>
</view>
<view style="height:14px"></view>
</view>
</hr-page>
</template>
<script lang="uts" setup>
import { ref, computed } from 'vue'
import { rescuerMsgGroups } from '@/mock/index.uts'
import { HrMsg, HrMsgGroup } from '@/mock/types.uts'
import { navTo } from '@/utils/nav.uts'
import { markMessagesRead } from '@/utils/unread.uts'
import { RADIO_BUTTON } from '@/uni_modules/tmx-ui/interface.uts'
/**
* s27 消息中心 · 救护端
* P0 派单消息可直接「去接收」,跳转到事件中心查看进行中的派单。
* 查看后清未读 → 「我的」页消息中心入口角标消失。
*/
/**
* 消息分类筛选(组件库 xRadioButton 分段切换,替代原 hr-chip 横向滚动)
* ⚠ RADIO_BUTTON 的 id 是 string:统一用下标字符串,选中值即筛选序号。
*/
const chipTabs : RADIO_BUTTON[] = [
{ id: '0', title: '全部 5' } as RADIO_BUTTON,
{ id: '1', title: '派单通知 2' } as RADIO_BUTTON,
{ id: '2', title: '系统消息 3' } as RADIO_BUTTON
]
const chipId = ref('0')
/** 由字符串 id 换算分类序号,供 groups 筛选使用 */
const chip = computed(() : number => {
const i = parseInt(chipId.value)
return isNaN(i) ? 0 : i
})
onPageShow(() => {
markMessagesRead()
})
const groups = computed(() : HrMsgGroup[] => {
if (chip.value == 1) { return [rescuerMsgGroups[0]] }
if (chip.value == 2) { return [rescuerMsgGroups[1]] }
return rescuerMsgGroups
})
function onMsgClick(m : HrMsg) : void {
if (m.action == '去接收 ') {
navTo('/pages/event/index')
return
}
if (m.title == 'BLS 证书即将到期提醒') {
navTo('/pages/study/certificates')
return
}
if (m.title.indexOf('新课题') > -1) {
navTo('/pages/course/library')
return
}
uni.showModal({ title: m.title, content: m.sub, showCancel: false })
}
function onReadAll() : void {
uni.showToast({ title: '已全部标记为已读', icon: 'success' })
}
</script>