123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- <template>
- <div class="combarr">
- <div class="combar">
- <div class="bar"></div>
- <el-row>
- <el-col :span="12">
- <div class="logo-title">
- <img v-if="logo" :src="logo" alt="" class="imgg" />
- <!-- <img v-else src="../assets/images/mes412.svg" alt="" class="imgg" /> -->
- <span class="title">{{ title || "工业应用引擎" }}</span>
- </div>
- </el-col>
- <el-col :span="4" :offset="8">
- <el-dropdown
- class="avatar-container right-menu-item hover-effect"
- trigger="click"
- >
- <div class="avatar-wrapper">
- <span style="">
- <span class="jianbiase">{{ username || "默认用户" }}</span>
- </span>
- <img :src="avatar" class="user-avatar" />
- <!-- <i class="el-icon-caret-bottom" /> -->
- </div>
- <el-dropdown-menu slot="dropdown" style="margin-top: -20px">
- <router-link to="/user/profile">
- <el-dropdown-item>个人中心</el-dropdown-item>
- </router-link>
- <!-- <el-dropdown-item @click.native="setting = true">
- <span>布局设置</span>
- </el-dropdown-item> -->
- <el-dropdown-item divided @click.native="logout">
- <span>退出登录</span>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </el-col>
- </el-row>
- </div>
- <div style="height: 100px"></div>
- <div
- :class="classObj"
- class="app-wrapper"
- :style="{ '--current-color': theme }"
- >
- <div
- v-if="device === 'mobile' && sidebar.opened"
- class="drawer-bg"
- @click="handleClickOutside"
- />
- <sidebar
- v-if="!sidebar.hide"
- class="sidebar-container"
- :style="sidebar.opened ? '' : 'width:50px !important'"
- />
- <div
- :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
- class="main-container"
- :style="sidebar.opened ? '' : 'margin-left: 50px !important'"
- >
- <div :class="{ 'fixed-header': fixedHeader }">
- <!-- <navbar /> -->
- <tags-view v-if="needTagsView" />
- </div>
- <app-main />
- <right-panel>
- <settings />
- </right-panel>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import RightPanel from "@/components/RightPanel";
- import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
- import ResizeMixin from "./mixin/ResizeHandler";
- import { mapState } from "vuex";
- import variables from "@/assets/styles/variables.scss";
- import meclogo1 from "@/assets/images/mec-logo1.svg";
- import mecLogoLogin from "@/assets/images/mec-logo-login.svg";
- import mecosLogo1 from "@/assets/images/mecosLogo1.svg";
- import comp from "@/assets/images/comp.svg";
- import mes412 from "@/assets/images/mes412.svg";
- export default {
- name: "Layout",
- components: {
- AppMain,
- Navbar,
- RightPanel,
- Settings,
- Sidebar,
- TagsView,
- },
- data() {
- return {
- userName: "默认用户",
- logo: "",
- title: "",
- };
- },
- mixins: [ResizeMixin],
- computed: {
- ...mapState({
- theme: (state) => state.settings.theme,
- sideTheme: (state) => state.settings.sideTheme,
- sidebar: (state) => state.app.sidebar,
- device: (state) => state.app.device,
- needTagsView: (state) => state.settings.tagsView,
- fixedHeader: (state) => state.settings.fixedHeader,
- username: (state) => state.user.name,
- tenantInfo: (state) => state.user.tenant,
- ...mapGetters(["avatar"]),
- }),
- classObj() {
- return {
- // hideSidebar: !this.sidebar.opened,
- openSidebar: this.sidebar.opened,
- withoutAnimation: this.sidebar.withoutAnimation,
- mobile: this.device === "mobile",
- };
- },
- variables() {
- return variables;
- },
- setting: {
- get() {
- return this.$store.state.settings.showSettings;
- },
- set(val) {
- this.$store.dispatch("settings/changeSetting", {
- key: "showSettings",
- value: val,
- });
- },
- },
- },
- methods: {
- async logout() {
- this.$confirm("确定注销并退出系统吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- // let tenantCode = this.tenantInfo.tenantCode;
- this.$store.dispatch("LogOut");
- // .then(() => {
- // this.$router.push({path: "/login", query: {tenantCode: tenantCode}});
- // });
- })
- .catch(() => {});
- },
- handleClickOutside() {
- this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
- },
- getlogo() {
- let logo = sessionStorage.getItem("logo");
- // this.title = sessionStorage.getItem("title") || "智能制造平台"; //工联院
- this.title = sessionStorage.getItem("title") || "工业应用引擎";
- if (logo) {
- this.logo = process.env.VUE_APP_BASE_API + logo;
- } else {
- // this.logo = mes412;
- // this.logo = mecLogoLogin;
- this.logo = mecosLogo1;
- // this.logo = comp;
- }
- },
- },
- mounted() {
- var user = sessionStorage.getItem("sessionObj");
- var user = JSON.parse(user);
- this.userName = JSON.parse(user.data).username;
- },
- created() {
- this.getlogo();
- },
- };
- </script>
- <style lang="scss" scoped>
- @import "~@/assets/styles/mixin.scss";
- @import "~@/assets/styles/variables.scss";
- .combarr {
- /* height: 100vh !important; */
- /* overflow: scroll; */
- }
- .avatar-wrapper {
- white-space: nowrap;
- }
- .el-dropdown-menu {
- z-index: 10000 !important;
- }
- .sidebar-container {
- background-color: #222653 !important;
- }
- /* .main-container{
- position: relative;
- }
- .navbar{
- position:sticky !important;
- } */
- .combar {
- position: fixed;
- display: block;
- width: 100%;
- z-index: 1000;
- background: #fff;
- /* border-bottom: 1px solid #6f7af3; */
- border-bottom: 1px solid #fff;
- box-shadow: 0px 0px 2px 0px #222653;
- }
- .jianbiase {
- /* width: 120px; */
- height: 37px;
- /* height: 25px; */
- /* background: linear-gradient(
- 128.13deg,
- rgba(82, 79, 255, 1) 0%,
- rgba(255, 74, 74, 1) 100%
- ); */
- /* box-shadow: 0px 4px 16px rgba(179, 192, 231, 1); */
- /* border-radius: 27px; */
- margin-top: 15px;
- font-size: 16px;
- font-weight: 500;
- letter-spacing: 0px;
- line-height: 20.27px;
- /* color: rgba(255, 255, 255, 1); */
- color: black;
- padding: 0px 20px 0px 25px;
- box-sizing: border-box;
- }
- .user-avatar {
- cursor: pointer;
- width: 50px;
- height: 50px;
- border-radius: 50px;
- z-index: 2;
- vertical-align: middle;
- margin-right: -18px;
- position: relative;
- }
- .right-menu-item {
- display: inline-block;
- padding: 0 8px;
- height: 100%;
- font-size: 18px;
- color: #7c008a;
- vertical-align: text-bottom;
- float: right;
- margin-right: 50px;
- margin-top: 18px;
- }
- #dropdown-menu-1780 {
- z-index: 1000000;
- }
- .imgg {
- /* width: 553px; */
- width: 270px;
- /* width: 330px; */
- height: 80px;
- float: left;
- margin-top: 7px;
- margin-bottom: 8px;
- /* margin-left: 50px; */
- }
- .logo-title {
- width: 100%;
- display: flex;
- align-items: center;
- .title {
- flex: 1;
- /* margin-left: -35px; */
- margin-top: 10px;
- display: block;
- font-size: 26px;
- font-weight: 520;
- letter-spacing: 2px;
- line-height: 38.4px;
- /* color: rgba(7, 68, 138, 1); */
- color: black;
- text-align: left;
- vertical-align: top;
- float: left;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- /* // max-width: ; */
- }
- }
- .spann {
- text-align: center;
- line-height: 100px;
- font-size: 30px;
- color: #003e8a;
- font-weight: bolder;
- margin-left: -335px;
- }
- .app-wrapper {
- @include clearfix;
- position: relative;
- height: 100%;
- width: 100%;
- &.mobile.openSidebar {
- position: fixed;
- top: 0;
- }
- }
- .drawer-bg {
- background: #000;
- opacity: 0.3;
- width: 100%;
- top: 0;
- height: 100%;
- position: absolute;
- z-index: 999;
- }
- .fixed-header {
- position: fixed;
- top: 100px;
- right: 0;
- z-index: 9;
- width: calc(100% - #{$base-sidebar-width});
- transition: width 0.28s;
- }
- .hideSidebar .fixed-header {
- width: calc(100% - 54px);
- }
- .sidebarHide .fixed-header {
- width: 100%;
- }
- .mobile .fixed-header {
- width: 100%;
- }
- </style>
|