<template>
|
|
<div class="navbar">
|
|
<div class="navbar-brand">
|
|
<img :src="headerLogo" class="header-logo" alt="" />
|
|
<span class="platform-title">智能巡视管控平台</span>
|
|
</div>
|
|
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav" />
|
|
<div v-else class="navbar-spacer" />
|
|
|
|
<div class="right-menu">
|
|
<template v-if="device !== 'mobile'">
|
|
<!-- <search id="header-search" class="right-menu-item" />
|
|
|
|
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
|
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
|
</el-tooltip> -->
|
|
|
|
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">
|
|
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
|
</el-tooltip> -->
|
|
<el-dropdown
|
|
trigger="click"
|
|
class="international right-menu-item hover-effect"
|
|
@command="handleSetLanguage"
|
|
>
|
|
<span>
|
|
<svg-icon class-name="international-icon" icon-class="language" style="font-size: 22px;"/>
|
|
</span>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item :disabled="language === 'zh_CN'" command="zh_CN">
|
|
中文
|
|
</el-dropdown-item>
|
|
<el-dropdown-item :disabled="language === 'en_US'" command="en_US">
|
|
English
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
|
|
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">
|
|
<size-select id="size-select" class="right-menu-item hover-effect" />
|
|
</el-tooltip> -->
|
|
</template>
|
|
|
|
<el-dropdown
|
|
class="avatar-container right-menu-item hover-effect"
|
|
trigger="click"
|
|
>
|
|
<div class="avatar-wrapper">
|
|
<img :src="avatar" class="user-avatar" />
|
|
<i class="el-icon-caret-bottom" />
|
|
</div>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<!-- <router-link to="/user/profile">
|
|
<el-dropdown-item>{{ $t('navBar.IndividualCenter') }}</el-dropdown-item>
|
|
</router-link> -->
|
|
<el-dropdown-item @click.native="setting = true">
|
|
<span>{{ $t('navBar.LayoutSetting') }}</span>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item divided @click.native="logout">
|
|
<span>{{ $t('navBar.LogOut') }}</span>
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from "vuex";
|
|
import TopNav from "@/components/TopNav";
|
|
import Screenfull from "@/components/Screenfull";
|
|
import headerLogo from "@/assets/images/header/logo.png";
|
|
// import { changeLanguage } from "@/api/login";
|
|
export default {
|
|
components: {
|
|
TopNav,
|
|
Screenfull,
|
|
},
|
|
data() {
|
|
return {
|
|
headerLogo
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters(["avatar", "device"]),
|
|
setting: {
|
|
get() {
|
|
return this.$store.state.settings.showSettings;
|
|
},
|
|
set(val) {
|
|
this.$store.dispatch("settings/changeSetting", {
|
|
key: "showSettings",
|
|
value: val,
|
|
});
|
|
},
|
|
},
|
|
topNav: {
|
|
get() {
|
|
return this.$store.state.settings.topNav;
|
|
},
|
|
},
|
|
language() {
|
|
localStorage.setItem("language", this.$store.getters.language)
|
|
return this.$store.getters.language
|
|
}
|
|
},
|
|
methods: {
|
|
async logout() {
|
|
this.$confirm("确定注销并退出系统吗?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
this.$store.dispatch("LogOut").then(() => {
|
|
location.href = "/index";
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
handleSetLanguage(value) {
|
|
this.$i18n.locale = value
|
|
this.$store.dispatch('app/setLanguage', value)
|
|
this.$message({ message: '设置语言成功', type: 'success' })
|
|
window.location.reload();
|
|
return
|
|
changeLanguage(value).then(response => {
|
|
window.location.reload();
|
|
});
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@import "~@/assets/styles/variables.scss";
|
|
|
|
.navbar {
|
|
height: 68px;
|
|
overflow: hidden;
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 18px 0 14px;
|
|
background: $base-navbar-background url("~@/assets/images/header/dingbu2.png") center / 100% 100% no-repeat;
|
|
box-shadow: none;
|
|
box-sizing: border-box;
|
|
|
|
.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);
|
|
}
|
|
}
|
|
|
|
.navbar-brand {
|
|
width: 430px;
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
flex: 0 0 430px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.header-logo {
|
|
width: 147px;
|
|
height: 37px;
|
|
display: block;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.platform-title {
|
|
margin-left: 10px;
|
|
color: #fff;
|
|
font-size: 34px;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
white-space: nowrap;
|
|
letter-spacing: 0;
|
|
text-shadow: 0 0 6px rgba(84, 255, 255, 0.55), 0 2px 2px rgba(0, 17, 74, 0.65);
|
|
}
|
|
|
|
.navbar-spacer {
|
|
flex: 1 1 auto;
|
|
min-width: 0;
|
|
}
|
|
|
|
.topmenu-container {
|
|
flex: 1 1 auto;
|
|
min-width: 0;
|
|
height: 100%;
|
|
align-self: stretch;
|
|
}
|
|
|
|
.errLog-container {
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
}
|
|
|
|
.right-menu {
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
flex: 0 0 auto;
|
|
line-height: 1;
|
|
|
|
&:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.right-menu-item {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 10px;
|
|
height: 40px;
|
|
font-size: 18px;
|
|
color: #54FFFF;
|
|
vertical-align: middle;
|
|
|
|
&.hover-effect {
|
|
cursor: pointer;
|
|
transition: background 0.3s;
|
|
border-radius: 2px;
|
|
|
|
&:hover {
|
|
background: rgba(84, 255, 255, 0.1);
|
|
}
|
|
}
|
|
}
|
|
|
|
.avatar-container {
|
|
margin-right: 18px;
|
|
|
|
.avatar-wrapper {
|
|
margin-top: 0;
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
padding-right: 16px;
|
|
|
|
.user-avatar {
|
|
cursor: pointer;
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.el-icon-caret-bottom {
|
|
color: #54FFFF;
|
|
cursor: pointer;
|
|
position: absolute;
|
|
right: 0;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
font-size: 12px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
padding: 0 10px;
|
|
|
|
.navbar-brand {
|
|
width: 300px;
|
|
flex-basis: 300px;
|
|
}
|
|
|
|
.platform-title {
|
|
font-size: 18px;
|
|
}
|
|
|
|
.right-menu {
|
|
.avatar-container {
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|