From 585d90f0e3194d6b988a424036291921794678ab Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期三, 18 十二月 2024 14:28:12 +0800
Subject: [PATCH] 修改首页

---
 src/layout/components/Navbar.vue |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index f75f237..e04cd9a 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -24,9 +24,10 @@
       </template>
       <div class="avatar-container">
         <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
-          <div class="avatar-wrapper">
+          <div class="avatar-wrapper" style="display: flex;align-items: center">
 <!--            <img :src="userStore.avatar" class="user-avatar" />-->
-            <img src="../../assets/images/avator.png" class="user-avatar" />
+            <img src="../../assets/images/avator.png" class="user-avatar"  />
+            <span style="font-size: 16px">{{userName}}({{userTypeName}})</span>
             <el-icon><caret-bottom /></el-icon>
           </div>
           <template #dropdown>
@@ -83,9 +84,13 @@
 const regRef = ref(null)
 const superRef = ref();
 const userInfo = ref();
+const userName = ref('')
+const userTypeName = ref('')
 onMounted(()=>{
   if(getToken()){
     userInfo.value = JSON.parse(Cookies.get('userInfo'))
+    userName.value = userInfo.value.username
+    userTypeName.value = userInfo.value.userType == 0 ? '管理员' : userInfo.value.userType == 1 ? '企业级' :userInfo.value.userType == 2 ? '部门级':userInfo.value.userType == 3 ? '车间级' :userInfo.value.userType == 4 ? '其他' : '学员'
     console.log("userInfo",userInfo.value )
   }
   // getState();
@@ -214,6 +219,7 @@
     height: 100%;
     line-height: 50px;
     display: flex;
+    align-items: center;
 
     &:focus {
       outline: none;
@@ -241,7 +247,7 @@
       margin-right: 40px;
 
       .avatar-wrapper {
-        margin-top: 5px;
+        margin-top: 15px;
         position: relative;
 
         .user-avatar {
@@ -249,13 +255,13 @@
           width: 40px;
           height: 40px;
           border-radius: 10px;
+          margin-right: 15px;
         }
 
         i {
           cursor: pointer;
           position: absolute;
           right: -20px;
-          top: 25px;
           font-size: 12px;
         }
       }

--
Gitblit v1.9.2