2023-01-06 10:03:31 +08:00
|
|
|
<!--
|
|
|
|
* @Author: zwq
|
|
|
|
* @Date: 2022-08-22 14:57:51
|
|
|
|
* @LastEditors: zwq
|
2023-05-12 13:43:45 +08:00
|
|
|
* @LastEditTime: 2023-05-12 12:46:50
|
2023-01-06 10:03:31 +08:00
|
|
|
* @Description:
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
|
|
|
|
<div class="aui-navbar__header">
|
|
|
|
<h1 class="aui-navbar__brand" @click="$router.push({ name: 'home' })">
|
2023-05-12 13:43:45 +08:00
|
|
|
<a class="aui-navbar__brand-lg" href="javascript:;">{{ $t("brand.lg") }}</a>
|
|
|
|
<a class="aui-navbar__brand-mini" href="javascript:;">{{ $t("brand.mini") }}</a>
|
2023-01-06 10:03:31 +08:00
|
|
|
</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">
|
2023-05-12 13:43:45 +08:00
|
|
|
<svg
|
|
|
|
class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<use xlink:href="#icon-outdent"></use>
|
|
|
|
</svg>
|
2023-01-06 10:03:31 +08:00
|
|
|
</el-menu-item>
|
|
|
|
<el-menu-item index="2" @click="refresh()">
|
2023-05-12 13:43:45 +08:00
|
|
|
<svg
|
|
|
|
class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<use xlink:href="#icon-sync"></use>
|
|
|
|
</svg>
|
2023-01-06 10:03:31 +08:00
|
|
|
</el-menu-item>
|
|
|
|
</el-menu>
|
|
|
|
<el-menu class="aui-navbar__menu" mode="horizontal">
|
2023-05-12 13:43:45 +08:00
|
|
|
|
|
|
|
<el-menu-item index="6" @click="$router.push({ name: 'home' })">
|
|
|
|
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
|
|
|
|
<use xlink:href="#icon-home"></use>
|
|
|
|
</svg>
|
|
|
|
</el-menu-item>
|
|
|
|
<el-menu-item index="7">
|
|
|
|
<el-dropdown trigger="click" class="international" @command="handleSetLanguage">
|
|
|
|
<div>
|
|
|
|
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
|
|
|
|
<use xlink:href="#中英"></use>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
<el-dropdown-item :disabled="language === 'zh-CN'" command="zh-CN">
|
|
|
|
中文
|
|
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item :disabled="language === 'en'" command="en">
|
|
|
|
English
|
|
|
|
</el-dropdown-item>
|
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
2023-01-06 10:03:31 +08:00
|
|
|
</el-menu-item>
|
|
|
|
<el-menu-item index="4" @click="fullscreenHandle()">
|
2023-05-12 13:43:45 +08:00
|
|
|
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
|
|
|
|
<use xlink:href="#icon-fullscreen"></use>
|
|
|
|
</svg>
|
2023-01-06 10:03:31 +08:00
|
|
|
</el-menu-item>
|
|
|
|
<el-menu-item index="5" class="aui-navbar__avatar">
|
|
|
|
<el-dropdown placement="bottom" :show-timeout="0">
|
|
|
|
<span class="el-dropdown-link">
|
2023-05-12 13:43:45 +08:00
|
|
|
<img src="~@/assets/img/avatar.png" />
|
2023-01-06 10:03:31 +08:00
|
|
|
<span>{{ $store.state.user.name }}</span>
|
|
|
|
<i class="el-icon-arrow-down"></i>
|
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
<el-dropdown-item @click.native="updatePasswordHandle()">
|
2023-05-12 13:43:45 +08:00
|
|
|
<svg class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true">
|
|
|
|
<use xlink:href="#修改密码"></use>
|
|
|
|
</svg>
|
|
|
|
{{ $t("updatePassword.title") }}</el-dropdown-item
|
|
|
|
>
|
2023-01-06 10:03:31 +08:00
|
|
|
<el-dropdown-item @click.native="logoutHandle()">
|
2023-05-12 13:43:45 +08:00
|
|
|
<svg class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true">
|
|
|
|
<use xlink:href="#tuichu"></use>
|
|
|
|
</svg>
|
|
|
|
{{ $t("logout") }}</el-dropdown-item
|
|
|
|
>
|
2023-01-06 10:03:31 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</el-menu-item>
|
|
|
|
</el-menu>
|
|
|
|
</div>
|
|
|
|
<!-- 弹窗, 修改密码 -->
|
|
|
|
<update-password v-if="updatePasswordVisible" ref="updatePassword"></update-password>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
<script>
|
2023-05-12 13:43:45 +08:00
|
|
|
import screenfull from "screenfull";
|
|
|
|
import UpdatePassword from "./main-navbar-update-password";
|
|
|
|
import { clearLoginInfo } from "@/utils";
|
|
|
|
import { messages } from '@/i18n'
|
|
|
|
import Cookies from "js-cookie";
|
2023-01-06 10:03:31 +08:00
|
|
|
export default {
|
2023-05-12 13:43:45 +08:00
|
|
|
inject: ["refresh"],
|
|
|
|
data() {
|
2023-01-06 10:03:31 +08:00
|
|
|
return {
|
|
|
|
updatePasswordVisible: false,
|
2023-05-12 13:43:45 +08:00
|
|
|
messageTip: false,
|
|
|
|
};
|
2023-01-06 10:03:31 +08:00
|
|
|
},
|
|
|
|
components: {
|
2023-05-12 13:43:45 +08:00
|
|
|
UpdatePassword,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
language() {
|
|
|
|
return Cookies.get("language");
|
|
|
|
},
|
2023-01-06 10:03:31 +08:00
|
|
|
},
|
2023-05-12 13:43:45 +08:00
|
|
|
methods: {
|
|
|
|
handleSetLanguage(val) {
|
|
|
|
Cookies.set("language", val);
|
|
|
|
document.querySelector("html").setAttribute("lang", val);
|
|
|
|
document.title = messages[val].brand.lg;
|
|
|
|
window.location.reload();
|
|
|
|
},
|
2023-01-06 10:03:31 +08:00
|
|
|
// 全屏
|
2023-05-12 13:43:45 +08:00
|
|
|
fullscreenHandle() {
|
2023-01-06 10:03:31 +08:00
|
|
|
if (!screenfull.enabled) {
|
|
|
|
return this.$message({
|
2023-05-12 13:43:45 +08:00
|
|
|
message: this.$t("fullscreen.prompt"),
|
|
|
|
type: "warning",
|
|
|
|
duration: 500,
|
|
|
|
});
|
2023-01-06 10:03:31 +08:00
|
|
|
}
|
2023-05-12 13:43:45 +08:00
|
|
|
screenfull.toggle();
|
2023-01-06 10:03:31 +08:00
|
|
|
},
|
|
|
|
// 修改密码
|
2023-05-12 13:43:45 +08:00
|
|
|
updatePasswordHandle() {
|
|
|
|
this.updatePasswordVisible = true;
|
2023-01-06 10:03:31 +08:00
|
|
|
this.$nextTick(() => {
|
2023-05-12 13:43:45 +08:00
|
|
|
this.$refs.updatePassword.init();
|
|
|
|
});
|
2023-01-06 10:03:31 +08:00
|
|
|
},
|
|
|
|
// 退出
|
2023-05-12 13:43:45 +08:00
|
|
|
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(() => {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2023-01-06 10:03:31 +08:00
|
|
|
</script>
|