首页卡片开发

This commit is contained in:
冯辉
2025-10-24 16:54:52 +08:00
parent 92ee5c5311
commit 2d6370b796
22 changed files with 896 additions and 205 deletions

View File

@@ -48,31 +48,22 @@ export const useReadMsg = defineStore('readMsg', () => {
const count = unreadCount.value
const index = 3
const countVal = count > 99 ? '99+' : String(count)
if (count === 0) {
uni.removeTabBarBadge({
index
}) // 替换为你消息页面的 TabBar index
badges.value[index] = {
count: 0
}
} else {
badges.value[index] = {
count: countVal
}
uni.setTabBarBadge({
index,
text: countVal
})
// 更新徽章数据,不直接调用 uni.removeTabBarBadge 和 uni.setTabBarBadge
// 因为项目使用的是自定义 TabBar这些方法只能在原生 TabBar 页面使用
badges.value[index] = {
count: count === 0 ? 0 : countVal
}
// 如果需要使用原生 TabBar 的徽章功能,需要确保在 TabBar 页面中调用
// 这里只更新数据,让自定义 TabBar 组件根据数据来显示徽章
}
// 拉取消息列表
async function fetchMessages() {
try {
$api.createRequest('/app/notice/info', {
isRead: 1
}, "GET").then((res) => {
$api.createRequest('/app/notice/info', {}, "GET").then((res) => {
msgList.value = res.data || []
updateTabBarBadge()
})