From 5cd763edc85f3b14bc98af906828521d65276f48 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期四, 13 十月 2022 17:57:11 +0800
Subject: [PATCH] 修改系统框架、消息管理新增

---
 src/views/layout/components/Header/index.vue |  309 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 260 insertions(+), 49 deletions(-)

diff --git a/src/views/layout/components/Header/index.vue b/src/views/layout/components/Header/index.vue
index eba3484..8169db6 100644
--- a/src/views/layout/components/Header/index.vue
+++ b/src/views/layout/components/Header/index.vue
@@ -1,38 +1,150 @@
 <template>
   <!-- 澶撮儴 -->
   <el-header>
-      <!-- 鍙充晶鑿滃崟 -->
-      <div class="header-title">
-        <div class="bell">
-          <el-icon class="el-icon-bell" style="color: white"></el-icon>
-        </div>
-        <div class="userinfo">
-          <div class="avatar"></div>
-          <span class="username">admin</span>
-        </div>
-        <div class="loginout" @click="loginout">閫�鍑虹櫥褰�</div>
+    <!-- 宸︿晶鑿滃崟 -->
+    <div class="header-left">
+      <div class="menu-left__item" v-for="(item,index) in menuLeftList" :key="item.id" @click="changeActive(index)">
+        <span :class="item.checked ? 'my-active':''">{{item.label}}</span>
       </div>
-    </el-header>
+    </div>
+    <!-- 鍙充晶鑿滃崟 -->
+    <div class="header-right">
+      <!-- 鎼滅储妗� -->
+      <div class="menu-right__item search">
+        <el-input suffix-icon="el-icon-search" placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�"></el-input>
+      </div>
+      <!-- 鐧诲綍鐢ㄦ埛 -->
+      <div class="menu-right__item user" @mousemove="flag.user=true" @mouseleave="flag.user=false">
+        <el-avatar :size="20" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"></el-avatar>
+        <span style="padding: 0 5px;">Admin</span>
+        <i class="el-icon-arrow-down"></i>
+        <!-- 鐢ㄦ埛鎿嶄綔 -->
+        <div class="user-card" v-if="flag.user" @mouseleave="flag.user = false">
+          <el-card class="box-card">
+            <div class="user-card__item">淇敼瀵嗙爜</div>
+            <div style="margin-top: 10px;" class="user-card__item">鍩烘湰淇℃伅</div>
+          </el-card>
+        </div>
+      </div>
+      <!-- 娑堟伅 -->
+      <div class="menu-right__item btn" @mousemove="flag.message = true" @mouseleave=" flag.message = false ">
+        <el-tooltip effect="dark" content="娑堟伅涓績" placement="bottom-end" :hide-after="600">
+          <el-badge :value="50" :max="99" class="item">
+            <i class="el-icon-message-solid"></i>
+          </el-badge>
+        </el-tooltip>
+        <!-- 娑堟伅鎿嶄綔 -->
+        <div class="message-card" v-if="flag.message" @mouseleave=" flag.message = false ">
+          <el-card class="box-card">
+            <div class="card-header">
+              <span>娑堟伅涓績</span>
+              <el-button type="text">鎺ユ敹璁剧疆</el-button>
+            </div>
+            <div v-for="item in menuMessageList" :key="item.id" class="message-card__item">
+              <span class="label">{{item.label}}</span>
+              <span>({{item.num}})</span>
+            </div>
+          </el-card>
+        </div>
+      </div>
+      <!-- 璁剧疆 -->
+      <div class="menu-right__item btn">
+        <el-tooltip effect="dark" content="璐︽埛璁剧疆" placement="bottom-end" :hide-after="1000">
+          <i class="el-icon-s-tools"></i>
+        </el-tooltip>
+      </div>
+      <!-- 閫�鍑虹櫥褰� -->
+      <div class="menu-right__item btn" @click="loginout">
+        <el-tooltip effect="dark" content="閫�鍑虹櫥褰�" placement="bottom-end" :hide-after="1000">
+          <i class="el-icon-switch-button"></i>
+        </el-tooltip>
+      </div>
+    </div>
+  </el-header>
 </template>
 
 <script>
 export default {
   data() {
     return {
-      opened: false,
+      menuLeftList: [
+        {
+          label: '椹鹃┒鑸�',
+          checked: true,
+          url: '',
+          id: '1f'
+        },
+        {
+          label: '瑙嗛宸℃煡',
+          checked: false,
+          url: '',
+          id: '2f'
+        },
+        {
+          label: '鎵ф硶绠$悊',
+          checked: false,
+          url: '',
+          if: '3f',
+        },
+      ],
+      flag: {
+        user: false,
+        message: false
+      },
+      menuMessageList: [
+        {
+          label: '鍏ㄩ儴娑堟伅',
+          num: 10,
+          id: '1m'
+        },
+        {
+          label: '浜у搧娑堟伅',
+          num: 10,
+          id: '2m'
+        },
+        {
+          label: '瀹夊叏娑堟伅',
+          num: 10,
+          id: '3m'
+        },
+        {
+          label: '鏈嶅姟娑堟伅',
+          num: 10,
+          id: '4m'
+        },
+      ]
     };
   },
-  methods:{
-    loginout(){
-      sessionStorage.removeItem('token');
-      sessionStorage.removeItem('tokenHead');
-      this.$router.push({path:"/login"})
-    }
+  methods: {
+    // 閫�鍑哄姛鑳�
+    loginout() {
+      this.$confirm('閫�鍑虹郴缁熺‘璁�', '纭鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        sessionStorage.removeItem('token');
+        sessionStorage.removeItem('tokenHead');
+        this.$router.push({ path: "/login" })
+      }).catch(err=>{
+        console.log(err);
+      })
+    },
+    // 鏀瑰彉閫変腑鐘舵��
+    changeActive(idx) {
+      this.menuLeftList.forEach((item, index) => {
+        if (index === idx) {
+          item.checked = true;
+        } else {
+          item.checked = false;
+        }
+      })
+    },
   }
 };
 </script>
 
-<style lang="scss" >
+<style lang="scss" scoped>
 .el-header {
   background-color: #071a38;
   color: #333;
@@ -40,42 +152,141 @@
   line-height: 60px;
   display: flex;
   align-items: center;
-  justify-content: flex-end;
-  padding: 0;
-  width: 100%;
-  .header-title {
+  justify-content: space-between;
+  padding: 0 20px;
+  // width: 100%;
+  color: #4b9bb7;
+
+  .header-left {
     display: flex;
-    align-items: center;
-    width: 280px;
-    justify-content: space-evenly;
-    .bell {
-      background-color: #00d1fa;
-      width: 25px;
-      height: 25px;
-      border-radius: 5px;
-      text-align: center;
-      line-height: 25px;
+
+    .menu-left__item {
+      width: 120px;
+
+      span {
+        display: block;
+        line-height: 40px;
+        width: 100%;
+        &:hover{
+          cursor: pointer;
+          color: #fff;
+        }
+      }
     }
-    .userinfo {
-      width: 100xp;
+
+    .my-active {
+      border-radius: 20px;
+      color: #fff;
+      background-color: #092c4a;
+    }
+  }
+
+  .header-right {
+    display: flex;
+
+    .item {
+      width: 60px;
+      position: relative;
+
+      :deep(.is-fixed) {
+        width: 20px;
+        height: 20px;
+        padding: 0;
+        top: 20px;
+        right: 30px;
+        border-radius: 50%;
+        position: absolute;
+      }
+    }
+
+    .search {
+      width: 200px;
+    }
+
+    .user {
+      margin-left: 20px;
+      width: 120px;
       display: flex;
       align-items: center;
-      .avatar {
-        width: 25px;
-        height: 25px;
-        border-radius: 50%;
-        background-image: url("@/assets/imgs/user/default-avatar.jpg");
-        background-size: cover;
-      }
-      .username {
-        margin: 0 5px;
-        color: #22d3eb;
-        font-size: 14px;
+      justify-content: center;
+      position: relative;
+
+      .user-card {
+        position: absolute;
+        top: 60px;
+        width: 120px;
+
+        .user-card__item {
+          padding: 5px 0;
+
+          &:hover {
+            color: #fff;
+            background-color: #071a38;
+          }
+        }
+
+        :deep(.el-card) {
+          background-color: #092c4a;
+          border: 1px solid #17324c;
+          color: #4b9bb7;
+        }
+
+        :deep(.el-card__body) {
+          line-height: 20px;
+          padding: 10px;
+        }
       }
     }
-    .loginout {
-      color: #22d3eb;
-      font-size: 14px;
+
+    .btn {
+      width: 60px;
+      font-size: 20px;
+      position: relative;
+
+      .message-card {
+        position: absolute;
+        top: 60px;
+        width: 180px;
+        left: -50px;
+
+        :deep(.el-card__body) {
+          padding: 0;
+        }
+
+        :deep(.el-card) {
+          background-color: #092c4a;
+          border: 1px solid #17324c;
+          color: #4b9bb7;
+        }
+
+        .card-header {
+          padding: 0 20px;
+          line-height: 40px;
+          font-size: 14px;
+          display: flex;
+          border-bottom: 1px solid #17324c;
+          justify-content: space-between;
+        }
+
+        .message-card__item {
+          line-height: 30px;
+          font-size: 14px;
+          display: flex;
+          justify-content: space-between;
+          padding: 0 20px;
+
+          .label:hover {
+            cursor: pointer;
+            color: #fff;
+          }
+        }
+      }
+    }
+
+    .user:hover,
+    .btn:hover {
+      background-color: #092c4a;
+      cursor: pointer;
     }
   }
 }

--
Gitblit v1.8.0