浏览代码

邮箱未读数量

cz 1 年之前
父节点
当前提交
c67d7589d3
共有 1 个文件被更改,包括 34 次插入23 次删除
  1. 34 23
      src/views/connect/E-mail/mail/com/left.vue

+ 34 - 23
src/views/connect/E-mail/mail/com/left.vue

@@ -3,12 +3,16 @@
     <div class="top">
       <el-dropdown>
         <span class="mail">
-          <!-- <el-badge :value="12" :max="99" class="item"> -->
-          {{ selectMail.mailUser }}
-          <el-icon class="el-icon--right" style="margin-right: 15px">
-            <arrow-down />
-          </el-icon>
-          <!-- </el-badge> -->
+          <el-badge
+            :value="selectMail.allUnreadMessageCount"
+            :max="99"
+            class="item"
+          >
+            {{ selectMail.mailUser }}
+            <el-icon class="el-icon--right" style="margin-right: 15px">
+              <arrow-down />
+            </el-icon>
+          </el-badge>
         </span>
         <template #dropdown>
           <el-dropdown-menu>
@@ -97,9 +101,9 @@
               v-else-if="item.sort === 6"
             ></i>
             <span style="margin-left: 5px">{{ item.name }}</span>
-            <!-- <div v-if="item.sort === 1" class="badge">
-              <span> 40 </span>
-            </div> -->
+            <div v-if="item.sort === 1" class="badge">
+              <span> {{ item.unreadMessageCount }} </span>
+            </div>
           </li>
         </ul>
         <!-- 员工邮箱 -->
@@ -125,6 +129,9 @@
                     (点击获取员工邮箱)</span
                   ></span
                 >
+                <div v-if="data.isMailUser" class="badge">
+                  <span> {{ data.allUnreadMessageCount }} </span>
+                </div>
               </span>
             </template>
           </el-tree>
@@ -528,8 +535,10 @@ const handleMapMailListData = (arr) => {
     const iele = arr[i];
     iele.mailFolderInfoListCopy = [];
     iele.otherFolder = [];
+    iele.allUnreadMessageCount = 0;
     for (let j = 0; j < iele.mailFolderInfoList.length; j++) {
       const jele = iele.mailFolderInfoList[j];
+      iele.allUnreadMessageCount += jele.unreadMessageCount;
       if (mailMapData["inbox"].includes(jele.name)) {
         iele.mailFolderInfoListCopy.push({
           ...jele,
@@ -570,6 +579,7 @@ const handleMapMailListData = (arr) => {
         iele.otherFolder.push(jele);
       }
     }
+
     if (iele.otherFolder.length > 0) {
       iele.otherFolder = [
         {
@@ -727,6 +737,7 @@ const handleTreeNodeNewClick = (data, node) => {
             arr = arr.map((x) => ({
               ...x,
               name: x.mailUser,
+              isMailUser: true,
               children: x.mailFolderInfoList.map((x) => ({
                 ...x,
                 isFolder: true,
@@ -805,20 +816,6 @@ defineExpose({
           font-size: 16px;
           color: #999999;
         }
-        .badge {
-          background: #eeeeee;
-          height: 20px;
-          width: 30px;
-          border-radius: 10px;
-          line-height: 20px;
-          text-align: center;
-          font-weight: normal;
-          margin-left: auto;
-          margin-right: 10px;
-          span {
-            color: #666666;
-          }
-        }
       }
     }
   }
@@ -845,6 +842,20 @@ defineExpose({
     }
   }
 }
+.badge {
+  background: #eeeeee;
+  height: 20px;
+  width: 30px;
+  border-radius: 10px;
+  line-height: 20px;
+  text-align: center;
+  font-weight: normal;
+  margin-left: auto;
+  margin-right: 10px;
+  span {
+    color: #666666;
+  }
+}
 </style>
 <style lang="scss">
 .body {