Browse Source

天家验证管理员

qinzhipeng_v@didiglobal.com 4 năm trước cách đây
mục cha
commit
b65589b391
1 tập tin đã thay đổi với 42 bổ sung4 xóa
  1. 42 4
      src/components/newLayout/Head.vue

+ 42 - 4
src/components/newLayout/Head.vue

@@ -36,7 +36,7 @@
     <div v-if="userInfo" class="user-info">
       <a-popover placement="rightBottom" overlay-class-name="head-popover">
         <template #content>
-          <div class="user-control">
+          <div :class="memberCheck ? 'user-admin-one' : 'user-admin'">
             <div class="user-name">{{ userInfo.name }}</div>
             <div class="line" />
             <div class="user-logout">
@@ -44,10 +44,10 @@
               <el-button v-if="navTagType === 2" type="primary" plain size="small" @click="setNavTagType(1)">侧边导航</el-button>
             </div>
             <div class="line" />
-            <div class="user-logout">
+            <div v-if="memberCheck" class="user-logout">
               <el-button type="primary" plain size="small" @click="administratorsJump()"> 管 理 员 </el-button>
             </div>
-            <div class="line" />
+            <div v-if="memberCheck" class="line" />
             <div class="user-logout">
               <el-button type="primary" plain size="small" @click="layout()">退出登录</el-button>
             </div>
@@ -64,12 +64,14 @@ import routes from '@/router/newRouter'
 import websocket from '@/views/workbench/mixins/websocket'
 import { memberGetLoginInMemberInfoByLdap } from '@/api/projectIndex'
 import { logoutUrl } from '@/apiConfig/requestIP.js'
+import { verifyIsAdmin } from '@/api/configure.js'
 export default {
   mixins: [websocket],
   data() {
     return {
       headList: routes.filter(item => item.name !== '业务线'),
       userInfo: null,
+      memberCheck: false,
       target: true
     }
   },
@@ -86,6 +88,7 @@ export default {
   },
   created() {
     this.getLoginUser()
+    this.verifyIsAdmin()
   },
   methods: {
     getTarget() {
@@ -117,6 +120,11 @@ export default {
       const res = await memberGetLoginInMemberInfoByLdap()
       if (res && res.data) this.userInfo = res.data || null
     },
+    // 查看是否为管理员
+    async verifyIsAdmin() {
+      const res = await verifyIsAdmin()
+      if (res.code === 200) this.memberCheck = res.data
+    },
     // 退出登录
     layout() {
       window.location.href = logoutUrl
@@ -228,7 +236,22 @@ export default {
     height: 30px;
   }
 }
-.user-control {
+.user-admin {
+  height: 143px;
+  width: 95px;
+  display: flex;
+  flex-direction: column;
+  display: grid;
+  grid-template-rows: 47px 1px 47px 1px 47px;
+  justify-items: center;
+  align-items: center;
+  .line {
+    width: 100%;
+    height: 1px;
+    background-color: rgba(112, 112, 112, 0.2);
+  }
+}
+.user-admin-one {
   height: 190px;
   width: 95px;
   display: flex;
@@ -243,6 +266,21 @@ export default {
     background-color: rgba(112, 112, 112, 0.2);
   }
 }
+
+// .user-control {
+//   width: 95px;
+//   display: flex;
+//   flex-direction: column;
+//   display: grid;
+//   grid-template-rows: 47px 1px 47px 1px 47px;
+//   justify-items: center;
+//   align-items: center;
+//   .line {
+//     width: 100%;
+//     height: 1px;
+//     background-color: rgba(112, 112, 112, 0.2);
+//   }
+// }
 </style>
 <style lang="scss" scoped>
 .head-popover {