123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <template>
- <div class="work-layout-title">
- <div class="work-layout-left">
- <div class="work-layout-image">
- <img src="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/2f7b4bfaf9e64817bc2cb46f3a632b01"
- alt="logo.png" />
- </div>
- <div class="work-layout-label">WORKARK</div>
- </div>
- <div class="work-layout-right">
- <div class="work-layout-badge">
- <el-badge :is-dot="systemCountStatus">
- <i class="iconfont huifont-xiaoxi"></i>
- </el-badge>
- </div>
- <el-dropdown @visible-change="value => userDropdown = value" @command="userCommand">
- <div class="work-layout-user">
- <div class="work-layout-avatar">
- <avatar :user="users"></avatar>
- </div>
- <i :class="'iconfont huifont-gerenzhongxinxiala'+ (userDropdown ? ' dropdown-icon' : '')"></i>
- </div>
- <el-dropdown-menu class="user-dropdown" slot="dropdown">
- <el-dropdown-item command="user">{{users.name}}</el-dropdown-item>
- <el-dropdown-item command="detail">个人信息</el-dropdown-item>
- <el-dropdown-item command="loginout">退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </div>
- </template>
- <script>
- import {
- removeToken
- } from '@/uitls/auth';
- import {
- mapGetters
- } from 'vuex';
- export default {
- data() {
- return {
- users: {},
- userDropdown: false,
- systemCountStatus: false
- }
- },
- mounted() {
- this.init();
- },
- methods: {
- init() {
- this.users = this.$store.getters.user;
- },
- userCommand(command) {
- switch (command) {
- case 'detail':
- break;
- case 'loginout':
- this.loginout();
- break;
- default:
- break;
- }
- },
- loginout() {
- this.$confirm('是否要退出登录?', () => {
- removeToken();
- this.$router.replace('/loginRegister/login')
- this.$message.success('退出成功');
- });
- },
- },
- watch: {
- user() {
- this.init();
- }
- },
- computed: {
- ...mapGetters(['user'])
- },
- }
- </script>
- <style lang="scss" scoped>
- .work-layout-title {
- display: flex;
- height: 52px;
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- justify-content: space-between;
- background: $--color-white;
- border-bottom: 1px solid $--border-color-lighter;
- }
- .work-layout-left {
- height: 100%;
- padding-left: 24px;
- display: flex;
- align-items: center;
- }
- .work-layout-image {
- width: 36px;
- height: 36px;
- border-radius: 4px;
- overflow: hidden;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .work-layout-label {
- padding-left: 10px;
- font-size: 18px;
- font-weight: bold;
- font-weight: 600;
- margin-right: 77px;
- }
- .work-layout-right {
- height: 100%;
- padding-right: 24px;
- display: flex;
- align-items: center;
- }
- .work-layout-badge {
- margin-right: 35px;
- cursor: pointer;
- margin-left: 20px;
- .iconfont {
- font-size: 22px;
- }
- .el-badge__content {
- border: none;
- }
- }
- .work-layout-user {
- display: flex;
- align-items: center;
- cursor: pointer;
- .work-layout-avatar {
- width: 32px;
- height: 32px;
- border-radius: 50%;
- overflow: hidden;
- margin-right: 8px;
- }
- .iconfont {
- font-size: 14px;
- transition: all 300ms;
- }
- .dropdown-icon {
- transform: rotate(180deg);
- }
- }
- </style>
|