You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

105 lines
2.2 KiB

<template>
<div class="nos-message-page app_content">
<van-nav-bar title="消息" fixed placeholder />
<div class="message-body">
<van-cell-group inset>
<van-cell title="任务通知" is-link @click="goNoticeList">
<template #value>
<span v-if="unreadCount > 0" class="unread-badge">
{{ unreadCount > 99 ? '99+' : unreadCount }}
</span>
</template>
</van-cell>
<van-cell title="非现场执法评价" is-link @click="goEvaluationList" />
</van-cell-group>
</div>
<FooterBar active="message" />
</div>
</template>
<script setup name="nosMessageHub">
import { ref, onMounted, onActivated } from 'vue';
import { useRouter } from 'vue-router';
import FooterBar from '@/components/FooterBar.vue';
import { nosTaskListUnReadCountAPi } from '@/api/nos/enfDemo';
import { setMessageUnread } from '@/store/messageState';
const router = useRouter();
const unreadCount = ref(0);
const fetchUnreadCount = () => {
nosTaskListUnReadCountAPi(
{},
(res) => {
if (res.code === 200) {
const count = Number(res.data ?? 0) || 0;
unreadCount.value = count;
setMessageUnread(count);
}
},
() => {},
);
};
const goNoticeList = () => {
router.push('/enterprise/nos/noticeList');
};
const goEvaluationList = () => {
router.push('/enterprise/nos/evaluationList');
};
onMounted(fetchUnreadCount);
onActivated(fetchUnreadCount);
</script>
<style lang="less" scoped>
.nos-message-page {
display: flex;
flex-direction: column;
height: 100%;
background: #f5f7fa;
overflow: hidden;
}
:deep(.van-nav-bar) {
background-color: #fff;
}
:deep(.van-nav-bar__title) {
font-size: 17px;
font-weight: 600;
color: #333;
}
.message-body {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 12px 0;
}
:deep(.van-cell-group--inset) {
margin: 0 12px;
}
:deep(.van-cell__title) {
font-size: 15px;
color: #333;
}
.unread-badge {
display: inline-block;
min-width: 18px;
height: 18px;
line-height: 18px;
padding: 0 6px;
background: #f5222d;
color: #fff;
font-size: 12px;
text-align: center;
border-radius: 9px;
}
</style>