You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.7 KiB

3 years ago
<template>
<nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
<div class="aui-navbar__header" style="height:100px;">
<!-- logo -->
<h1 class="aui-navbar__brand" @click="logoClick">
<a class="aui-navbar__brand-lg" style="text-align:center;">
2 years ago
<img v-if="!isDev" width="140" src="@/assets/img/xianganLogo3.png">
2 years ago
<div style="margin-top:5px;">眼科工作平台</div>
3 years ago
</a>
</h1>
</div>
<div class="aui-navbar__body">
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
<!-- 收缩 -->
<el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true"><use xlink:href="#icon-outdent" /></svg>
</el-menu-item>
<!-- 刷新 -->
<el-menu-item index="2" style="padding:0 6px;" @click="refresh()">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh" aria-hidden="true"><use xlink:href="#icon-sync" /></svg>
</el-menu-item>
2 years ago
<el-menu-item index="3" style="padding:0 6px;">
3 years ago
<bread-crumb />
</el-menu-item>
</el-menu>
<el-menu class="aui-navbar__menu" mode="horizontal">
<!-- 全屏 -->
<el-menu-item index="4" @click="fullscreenHandle()">
<svg-icon icon-class="fullscreen" />
</el-menu-item>
<!-- 头像按钮组 -->
2 years ago
<el-menu-item index="5" class="aui-navbar__avatar">
3 years ago
<el-dropdown placement="bottom" :show-timeout="0">
<span class="el-dropdown-link">
<img src="~@/assets/img/avatar.png">
<span>{{ $store.state.user.name }}</span>
<i class="el-icon-arrow-down" />
</span>
<el-dropdown-menu slot="dropdown">
<!-- 修改密码 -->
<el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
<!-- 退出 -->
<el-dropdown-item style="color:#FF4D4F" @click.native="logoutHandle()">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
</el-menu>
</div>
<!-- 弹窗, 修改密码 -->
<update-password v-if="updatePasswordVisible" ref="updatePassword" />
</nav>
</template>
<script>
import { messages } from '@/i18n'
import screenfull from 'screenfull'
import UpdatePassword from './main-navbar-update-password.vue'
import { clearLoginInfo } from '@/page-subspecialty/utils/request.js'
import breadCrumb from '@/components/bread-crumb'
import { resetRouter } from '@/page-subspecialty/router/index.js'
export default {
2 years ago
props: {
isDev: {
type: Boolean
}
},
3 years ago
inject: ['refresh'],
components: {
UpdatePassword,
breadCrumb
3 years ago
},
data() {
return {
i18nMessages: messages,
updatePasswordVisible: false,
messageTip: false,
2 years ago
logo: require('@/assets/img/logo.png')
3 years ago
}
},
created() {
},
methods: {
logoClick() {
2 years ago
this.$store.commit('activeIndexFun', window.SITE_CONFIG.menuList[0].children[0].id)
this.$router.push({ name: 'outpatientManagement-call' })
3 years ago
},
// 全屏
fullscreenHandle() {
if (!screenfull.enabled) {
return this.$message({
message: this.$t('fullscreen.prompt'),
type: 'warning',
duration: 500
})
}
screenfull.toggle()
},
// 修改密码
updatePasswordHandle() {
this.updatePasswordVisible = true
this.$nextTick(() => {
this.$refs.updatePassword.init()
})
},
// 退出
logoutHandle() {
this.$confirm(this.$t('prompt.info', { handle: this.$t('logout') }), this.$t('prompt.title'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.post('/logout').then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
clearLoginInfo()
resetRouter()
this.$router.push({ name: 'login' })
2 years ago
this.$store.commit('activeIndexFun', window.SITE_CONFIG.menuList[0].children[0].id)
3 years ago
}).catch(() => {})
}).catch(() => {})
}
}
}
</script>
<style lang='scss' scoped>
.aui-navbar__header{
width: 160px;
}
.logo{
font-size: 24px;
font-weight: bold;
letter-spacing: 10px;
}
3 years ago
.aui-navbar__brand{
font-size: 17px;
.sidebar-logo {
width: 36px;
height: 36px;
}
}
</style>