|
@@ -122,34 +122,23 @@ const menuBarChange = ({ code }) => {
|
|
|
router.push({ name: code })
|
|
|
}
|
|
|
|
|
|
-//消息数量
|
|
|
-const msgCount = ref({
|
|
|
- allCount: 0,
|
|
|
- taskCount: 0,
|
|
|
- messageCount: 0,
|
|
|
- messageCount_1: 0,
|
|
|
- messageCount_2: 0,
|
|
|
- messageCount_3: 0,
|
|
|
- messageCount_4: 0,
|
|
|
- messageCount_5: 0,
|
|
|
-})
|
|
|
-
|
|
|
//项目合同段的ID
|
|
|
-let times = ref()
|
|
|
+const timeExamples = ref()
|
|
|
+const times = ref(10000)
|
|
|
const cascaderSend = async ({ projectId, contractId }) => {
|
|
|
//合同段id为空,清空定时器
|
|
|
if (isNullES(contractId)) {
|
|
|
- if (!isNullES(times.value)) clearInterval(times.value)
|
|
|
+ if (!isNullES(timeExamples.value)) clearInterval(timeExamples.value)
|
|
|
return
|
|
|
}
|
|
|
//先获取一次
|
|
|
await getUnreadMessage({ projectId, contractId })
|
|
|
//切换项目合同段时,先清空轮询
|
|
|
- if (!isNullES(times.value)) clearInterval(times.value)
|
|
|
+ if (!isNullES(timeExamples.value)) clearInterval(timeExamples.value)
|
|
|
//定时轮询获取数据
|
|
|
- times.value = setInterval(async () => {
|
|
|
+ timeExamples.value = setInterval(async () => {
|
|
|
await getUnreadMessage({ projectId, contractId })
|
|
|
- }, 10000)
|
|
|
+ }, times.value)
|
|
|
}
|
|
|
|
|
|
//获取未读消息数量
|
|
@@ -157,14 +146,19 @@ const taskCount = ref(0)
|
|
|
const getUnreadMessage = async ({ projectId, contractId }) => {
|
|
|
//如果退出登录了,清空轮询
|
|
|
if (isNullES(getToken())) {
|
|
|
- if (!isNullES(times.value)) clearInterval(times.value)
|
|
|
+ if (!isNullES(timeExamples.value)) clearInterval(timeExamples.value)
|
|
|
return
|
|
|
}
|
|
|
//获取数据
|
|
|
- const { data } = await messageApi.getUnreadMessage({
|
|
|
+ const { isRes, data } = await messageApi.getUnreadMessage({
|
|
|
projectId, contractId,
|
|
|
})
|
|
|
taskCount.value = data ?? 0
|
|
|
+ if (isRes) {
|
|
|
+ times.value = 10000
|
|
|
+ } else {
|
|
|
+ times.value = 300000 //5分钟
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 项目切换
|