feat: 站内通知
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m29s

This commit is contained in:
luo
2026-07-25 11:08:03 +08:00
parent 3929156ef4
commit 9c1c296d2e
10 changed files with 394 additions and 3 deletions

View File

@@ -17,7 +17,8 @@
<WifiCard v-if="userInfo.isDevice" :deviceInfo="deviceInfo" @modify="modifyWifi" @copy="copy" />
<FunctionCard :realNameStatus="realNameStatus" :alreadyBindPhone="alreadyBindPhone"
:isDevice="userInfo.isDevice" :walletBalance="deviceInfo.walletBalance" @enter="enterDetail" @sync="onSync">
:isDevice="userInfo.isDevice" :walletBalance="deviceInfo.walletBalance" :unreadCount="notificationUnreadCount"
@enter="enterDetail" @sync="onSync">
<!-- 修改WIFI弹窗 -->
<up-popup :show="showModifyWifi" mode="center" @close="showModifyWifi=false">
<view class="wifi-popup">
@@ -124,7 +125,8 @@
import FloatingButton from '@/components/FloatingButton.vue';
import {
assetApi,
deviceApi
deviceApi,
notificationApi
} from '@/api/index.js';
import {
useUserStore
@@ -210,6 +212,7 @@
let smsCodePhone = ref('');
let smsCode = ref('');
let indexEntryChecking = ref(false);
let notificationUnreadCount = ref(0);
const formatDate = (dateStr) => {
if (!dateStr) return '-';
@@ -699,6 +702,11 @@
const enterDetail = (name) => {
switch (name) {
case 'notifications':
uni.navigateTo({
url: '/pages/notifications/notifications'
});
break;
case 'package-order':
uni.navigateTo({
url: '/pages/package-order/package-order'
@@ -767,12 +775,22 @@
}
};
const loadNotificationUnreadCount = async () => {
try {
const data = await notificationApi.getUnreadCount();
notificationUnreadCount.value = Number(data?.count || 0);
} catch (error) {
console.error('加载通知未读数失败', error);
}
};
onMounted(() => {
initCurrentMonth();
});
onShow(() => {
handleIndexEntry();
loadNotificationUnreadCount();
});
</script>