1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
- <div class="aui-navbar__hd">
- <h1 class="aui-navbar__brand" @click="$router.push({ name: 'home' })">
- <a class="aui-navbar__brand-lg" href="javascript:;"><img src="" /></a>
- </h1>
- </div>
- <div class="aui-navbar__bd">
- <navbar-menu></navbar-menu>
- <navbar-news></navbar-news>
- <navbar-user></navbar-user>
- </div>
- </nav>
- </template>
- <script>
- import { messages } from '@/i18n'
- import screenfull from 'screenfull'
- import { clearLoginInfo } from '@/utils'
- import NavbarMenu from './main-navbar-menu'
- import NavbarNews from './main-navbar-news'
- import NavbarUser from './main-navbar-user'
- export default {
- inject: ['refresh'],
- data () {
- return {
- i18nMessages: messages,
- updatePassowrdVisible: false
- }
- },
- components: {
- NavbarMenu,
- NavbarNews,
- NavbarUser
- },
- methods: {
- // 全屏
- fullscreenHandle () {
- if (!screenfull.enabled) {
- return this.$message({
- message: this.$t('fullscreen.prompt'),
- type: 'warning',
- duration: 500
- })
- }
- screenfull.toggle()
- },
- // 修改密码
- updatePasswordHandle () {
- this.updatePassowrdVisible = true
- this.$nextTick(() => {
- this.$refs.updatePassowrd.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()
- this.$router.push({ name: 'login' })
- }).catch(() => {})
- }).catch(() => {})
- }
- }
- }
- </script>
|