123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <template>
- <div class="top-bar-container">
- <div class="vab-main">
- <el-row>
- <el-col :xl="7" :lg="7" :md="7" :sm="7" :xs="7">
- <logo />
- </el-col>
- <el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="12">
- <el-menu
- :background-color="variables['menu-background']"
- :text-color="variables['menu-color']"
- :active-text-color="variables['menu-color-active']"
- :default-active="activeMenu"
- mode="horizontal"
- menu-trigger="hover"
- >
- <template v-for="route in routes">
- <side-bar-item
- v-if="!route.hidden"
- :key="route.path"
- :full-path="route.path"
- :item="route"
- ></side-bar-item>
- </template>
- </el-menu>
- </el-col>
- <el-col :xl="5" :lg="5" :md="5" :sm="5" :xs="5">
- <div class="right-panel">
- <error-log />
- <full-screen-bar @refresh="refreshRoute"></full-screen-bar>
- <theme-bar class="hidden-md-and-down"></theme-bar>
- <vab-icon
- title="重载路由"
- :pulse="pulse"
- :icon="['fas', 'redo']"
- @click="refreshRoute"
- />
- <avatar></avatar>
- </div>
- </el-col>
- </el-row>
- </div>
- </div>
- </template>
- <script>
- import SideBarItem from "../SideBar/components/SideBarItem";
- import variables from "@/styles/variables.scss";
- import { mapGetters } from "vuex";
- import {
- Avatar,
- ErrorLog,
- FullScreenBar,
- Logo,
- ThemeBar,
- } from "@/layouts/components";
- export default {
- components: {
- Avatar,
- ErrorLog,
- FullScreenBar,
- ThemeBar,
- SideBarItem,
- Logo,
- },
- data() {
- return {
- pulse: false,
- menuTrigger: "hover",
- };
- },
- computed: {
- ...mapGetters({
- routes: "routes/routes",
- visitedRoutes: "tagsBar/visitedRoutes",
- }),
- activeMenu() {
- const route = this.$route;
- const { meta, path } = route;
- if (meta.activeMenu) {
- return meta.activeMenu;
- }
- return path;
- },
- variables() {
- return variables;
- },
- },
- methods: {
- async refreshRoute() {
- this.$baseEventBus.$emit("reloadRouterView");
- this.pulse = true;
- setTimeout(() => {
- this.pulse = false;
- }, 1000);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .top-bar-container {
- display: flex;
- align-items: center;
- justify-items: flex-end;
- height: $base-top-bar-height;
- background: $base-menu-background;
- .vab-main {
- background: $base-menu-background;
- ::v-deep {
- .el-menu {
- &.el-menu--horizontal {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- height: $base-top-bar-height;
- border-bottom: 0 solid transparent !important;
- .el-menu-item,
- .el-submenu__title {
- padding: 0 15px;
- }
- @media only screen and (max-width: 767px) {
- .el-menu-item,
- .el-submenu__title {
- padding: 0 8px;
- }
- li:nth-child(4),
- li:nth-child(5) {
- display: none !important;
- }
- }
- > .el-menu-item {
- height: $base-top-bar-height;
- line-height: $base-top-bar-height;
- }
- > .el-submenu {
- .el-submenu__title {
- height: $base-top-bar-height;
- line-height: $base-top-bar-height;
- }
- }
- }
- svg {
- width: 1rem;
- margin-right: 3px;
- }
- &--horizontal {
- .el-menu {
- .el-menu-item,
- .el-submenu__title {
- height: $base-menu-item-height;
- line-height: $base-menu-item-height;
- }
- }
- .el-submenu,
- .el-menu-item {
- &.is-active {
- background-color: $base-color-blue !important;
- border-bottom: 0 solid transparent !important;
- .el-submenu__title {
- border-bottom: 0 solid transparent !important;
- }
- }
- }
- > .el-menu-item {
- .el-tag {
- margin-top: calc(#{$base-top-bar-height} / 2 - 7.5px);
- margin-left: 5px;
- }
- @media only screen and (max-width: 1199px) {
- .el-tag {
- display: none;
- }
- }
- &.is-active {
- background-color: transparent !important;
- border-bottom: 3px solid $base-color-blue !important;
- }
- }
- }
- }
- }
- }
- .right-panel {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- height: $base-top-bar-height;
- ::v-deep {
- .user-name {
- color: rgba($base-color-white, 0.9);
- }
- .user-name + i {
- color: rgba($base-color-white, 0.9);
- }
- svg {
- width: 1em;
- height: 1em;
- margin-right: 15px;
- font-size: $base-font-size-big;
- color: rgba($base-color-white, 0.9);
- cursor: pointer;
- fill: rgba($base-color-white, 0.9);
- }
- button {
- svg {
- margin-right: 0;
- color: rgba($base-color-white, 0.9);
- cursor: pointer;
- fill: rgba($base-color-white, 0.9);
- }
- }
- .el-badge {
- margin-right: 15px;
- }
- }
- }
- }
- </style>
|