Просмотр исходного кода

Merge branch 'flow' of ruiqigogs/yf-portal-vue into master

yanghao 17 часов назад
Родитель
Сommit
3529d9a195
3 измененных файлов с 36 добавлено и 20 удалено
  1. 22 6
      src/components/home/header.vue
  2. 3 3
      src/config/axios/service.ts
  3. 11 11
      src/views/index.vue

+ 22 - 6
src/components/home/header.vue

@@ -19,11 +19,11 @@
           <li><a class="hover:text-[#02409b] cursor-pointer">典型案例</a></li>
           <li><a class="hover:text-[#02409b] cursor-pointer">典型案例</a></li>
           <li><a class="hover:text-[#02409b] cursor-pointer">平台服务</a></li>
           <li><a class="hover:text-[#02409b] cursor-pointer">平台服务</a></li>
 
 
-          <li>
+          <!-- <li>
             <a class="hover:text-[#02409b] cursor-pointer" @click="goFlow"
             <a class="hover:text-[#02409b] cursor-pointer" @click="goFlow"
               >流程门户</a
               >流程门户</a
             >
             >
-          </li>
+          </li> -->
         </ul>
         </ul>
       </nav>
       </nav>
 
 
@@ -347,6 +347,7 @@ import {
   getNotifyMessages,
   getNotifyMessages,
   getNotifyMessageList,
   getNotifyMessageList,
   markMessageAsRead,
   markMessageAsRead,
+  getUnreadNotifyMessageCount,
 } from "@api/user";
 } from "@api/user";
 
 
 import {
 import {
@@ -404,16 +405,31 @@ const unreadMessageCount = computed(() => {
 
 
 // oa未读
 // oa未读
 const oaMessagesList = ref([]);
 const oaMessagesList = ref([]);
+
+const unreadCount = ref(0); // 未读消息数量
+const getUnreadCount = async () => {
+  getUnreadNotifyMessageCount().then((data) => {
+    unreadCount.value = data;
+  });
+};
 onMounted(async () => {
 onMounted(async () => {
-  console.log("用户信息>>>>>>>>>>>>", isLoggedIn.value);
   if (isLoggedIn.value) {
   if (isLoggedIn.value) {
     await getNotifyMessages(userStore.getUser.username);
     await getNotifyMessages(userStore.getUser.username);
-
     const messageList = await getNotifyMessageList(userStore.getUser.username);
     const messageList = await getNotifyMessageList(userStore.getUser.username);
     messages.value = messageList;
     messages.value = messageList;
-
-    console.log("消息中心数据:", messages.value);
   }
   }
+
+  setInterval(
+    () => {
+      if (userStore.getIsSetUser) {
+        console.log("轮询刷新小红点");
+        getUnreadCount();
+      } else {
+        unreadCount.value = 0;
+      }
+    },
+    1000 * 60 * 1,
+  );
 });
 });
 
 
 function timestampToDateTime(timestamp) {
 function timestampToDateTime(timestamp) {

+ 3 - 3
src/config/axios/service.ts

@@ -208,12 +208,12 @@ const handleAuthorized = () => {
       return;
       return;
     }
     }
     isRelogin.show = true;
     isRelogin.show = true;
-    ElMessageBox.confirm("登陆超时,请重新登陆", "确定", {
+    ElMessageBox.confirm("登录超时,请重新登录", "确定", {
       showCancelButton: true,
       showCancelButton: true,
       closeOnClickModal: false,
       closeOnClickModal: false,
       showClose: false,
       showClose: false,
       closeOnPressEscape: false,
       closeOnPressEscape: false,
-      confirmButtonText: "重新登",
+      confirmButtonText: "重新登",
       cancelButtonText: "取消",
       cancelButtonText: "取消",
       type: "warning",
       type: "warning",
     })
     })
@@ -230,7 +230,7 @@ const handleAuthorized = () => {
         window.location.href = "/";
         window.location.href = "/";
       });
       });
   }
   }
-  return Promise.reject("登陆超时,请重新登陆");
+  return Promise.reject("登录超时,请重新登录");
 };
 };
 
 
 export { service };
 export { service };

+ 11 - 11
src/views/index.vue

@@ -251,17 +251,17 @@ onMounted(() => {
   // 首次加载小红点
   // 首次加载小红点
   // getUnreadCount();
   // getUnreadCount();
   // 轮询刷新小红点
   // 轮询刷新小红点
-  setInterval(
-    () => {
-      if (userStore.getIsSetUser) {
-        console.log("轮询刷新小红点");
-        getUnreadCount();
-      } else {
-        unreadCount.value = 0;
-      }
-    },
-    1000 * 60 * 1,
-  );
+  // setInterval(
+  //   () => {
+  //     if (userStore.getIsSetUser) {
+  //       console.log("轮询刷新小红点");
+  //       getUnreadCount();
+  //     } else {
+  //       unreadCount.value = 0;
+  //     }
+  //   },
+  //   1000 * 60 * 1,
+  // );
 });
 });
 
 
 onUnmounted(() => {
 onUnmounted(() => {