182 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			182 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						|
  <div class="navbar navbar-flex-wrapper">
 | 
						|
    <div class="leftMenu">
 | 
						|
      <div class="navbar-flex-wrapper">
 | 
						|
        <hamburger
 | 
						|
          :is-active="sidebar.opened"
 | 
						|
          class="hamburger-container"
 | 
						|
          @toggleClick="toggleSideBar"
 | 
						|
        />
 | 
						|
 | 
						|
        <breadcrumb class="breadcrumb-container" />
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <div class="right-menu">
 | 
						|
      <div class="navbar-flex-wrapper">
 | 
						|
        <template v-if="device!=='mobile'">
 | 
						|
          <screenfull id="screenfull" class="right-menu-item hover-effect" />
 | 
						|
        </template>
 | 
						|
        <!-- <div class="avatar-container">
 | 
						|
        <img src="@/assets/avatar.png" class="user-avatar">
 | 
						|
      </div> -->
 | 
						|
        <div style="margin-left:20px;">
 | 
						|
          <el-dropdown class="dropdown-container" trigger="click">
 | 
						|
            <span class="el-dropdown-link">
 | 
						|
              {{ name }}
 | 
						|
              <span v-if="userTypeShortName">({{ userTypeShortName }})</span>
 | 
						|
              <i class="el-icon-caret-bottom" />
 | 
						|
            </span>
 | 
						|
            <el-dropdown-menu slot="dropdown" class="user-dropdown">
 | 
						|
              <el-dropdown-item v-if="!isReviewer">
 | 
						|
                <span style="display:block;" @click="editInfo">Edit Info</span>
 | 
						|
              </el-dropdown-item>
 | 
						|
              <el-dropdown-item>
 | 
						|
                <span style="display:block;" @click="account">Account</span>
 | 
						|
              </el-dropdown-item>
 | 
						|
              <el-dropdown-item divided>
 | 
						|
                <span style="display:block;" @click="logout">Log Out</span>
 | 
						|
              </el-dropdown-item>
 | 
						|
            </el-dropdown-menu>
 | 
						|
          </el-dropdown>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
import {mapGetters, mapMutations} from 'vuex'
 | 
						|
import Breadcrumb from '@/components/Breadcrumb'
 | 
						|
import Hamburger from '@/components/Hamburger'
 | 
						|
import Screenfull from '@/components/Screenfull'
 | 
						|
 | 
						|
export default {
 | 
						|
  components: {
 | 
						|
    Breadcrumb,
 | 
						|
    Hamburger,
 | 
						|
    Screenfull
 | 
						|
  },
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      isReviewer: false,
 | 
						|
      userTypeShortName: zzSessionStorage.getItem('userTypeShortName')
 | 
						|
    }
 | 
						|
  },
 | 
						|
  computed: {
 | 
						|
    ...mapGetters(['sidebar', 'name', 'device'])
 | 
						|
  },
 | 
						|
  created() {
 | 
						|
    this.isReviewer = JSON.parse(zzSessionStorage.getItem('IsReviewer'))
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    ...mapMutations({ setLanguage: 'lang/setLanguage' }),
 | 
						|
    toggleSideBar() {
 | 
						|
      this.$store.dispatch('app/toggleSideBar')
 | 
						|
    },
 | 
						|
    async logout() {
 | 
						|
      var loginType = zzSessionStorage.getItem('loginType')
 | 
						|
      await this.$store.dispatch('user/logout')
 | 
						|
      if (loginType) {
 | 
						|
        this.$router.push(`/login?loginType=${loginType}`)
 | 
						|
      } else {
 | 
						|
        this.$router.push(`/login`)
 | 
						|
      }
 | 
						|
      this.$i18n.locale = 'zh'
 | 
						|
      this.setLanguage('zh')
 | 
						|
      this.$updateDictionary()
 | 
						|
    },
 | 
						|
    editInfo() {
 | 
						|
      this.$router.push({ name: 'BaiscInfo' })
 | 
						|
    },
 | 
						|
    account() {
 | 
						|
      this.$router.push({ name: 'Account' })
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
</script>
 | 
						|
 | 
						|
<style lang="scss" scoped>
 | 
						|
.navbar-flex-wrapper{
 | 
						|
    display: flex;
 | 
						|
    flex-direction: row;
 | 
						|
    justify-content: space-between;
 | 
						|
  }
 | 
						|
.navbar {
 | 
						|
  height: 50px;
 | 
						|
  overflow: hidden;
 | 
						|
  // position: relative;
 | 
						|
  background: #fff;
 | 
						|
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
 | 
						|
  .hamburger-container {
 | 
						|
    line-height: 46px;
 | 
						|
    height: 100%;
 | 
						|
    // float: left;
 | 
						|
    cursor: pointer;
 | 
						|
    transition: background 0.3s;
 | 
						|
    -webkit-tap-highlight-color: transparent;
 | 
						|
 | 
						|
    &:hover {
 | 
						|
      background: rgba(0, 0, 0, 0.025);
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  // .breadcrumb-container {
 | 
						|
  //   float: left;
 | 
						|
  // }
 | 
						|
 | 
						|
  .right-menu {
 | 
						|
    // float: right;
 | 
						|
    height: 100%;
 | 
						|
    line-height: 50px;
 | 
						|
    // position: relative;
 | 
						|
    &:focus {
 | 
						|
      outline: none;
 | 
						|
    }
 | 
						|
 | 
						|
    .right-menu-item {
 | 
						|
      display: inline-block;
 | 
						|
      padding: 0 8px;
 | 
						|
      height: 100%;
 | 
						|
      font-size: 18px;
 | 
						|
      color: #5a5e66;
 | 
						|
      vertical-align: text-bottom;
 | 
						|
 | 
						|
      &.hover-effect {
 | 
						|
        cursor: pointer;
 | 
						|
        transition: background 0.3s;
 | 
						|
 | 
						|
        &:hover {
 | 
						|
          background: rgba(0, 0, 0, 0.025);
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
 | 
						|
    .avatar-container {
 | 
						|
      display: inline-block;
 | 
						|
      margin-right: 200px;
 | 
						|
      .user-avatar {
 | 
						|
        margin-top: 5px;
 | 
						|
        width: 40px;
 | 
						|
        height: 40px;
 | 
						|
        border-radius: 10px;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    .dropdown-container {
 | 
						|
      // margin-left: 30px;
 | 
						|
      // position: absolute;
 | 
						|
      // right: 20px;
 | 
						|
      // top: 0px;
 | 
						|
      cursor: pointer;
 | 
						|
      .el-icon-caret-bottom {
 | 
						|
        font-size: 12px;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    .el-dropdown-link {
 | 
						|
      color: #999c9e;
 | 
						|
      cursor: pointer;
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
</style>
 |