import { Component } from 'vue-property-decorator'; import './app-style2-indexview-layout.less'; import { AppServiceBase, Util } from '@ibizstudio/runtime'; import { AppLoadingService, AppNavHistory } from "../../../../app-service"; import { AppStyle2DefaultLayout } from "../app-style2-default-layout/app-style2-default-layout"; import { IPSAppMenu } from '@ibizstudio/runtime'; @Component({}) export class AppStyle2IndexViewLayout extends AppStyle2DefaultLayout { /** * 应用loading服务 * * @memberof AppLayout */ appLoadingService = AppLoadingService.getInstance(); /** * 菜单实例 * * @memberof AppStyle2IndexViewLayout */ menuInstance!: IPSAppMenu; /** * 抽屉状态 * * @type {boolean} * @memberof AppStyle2IndexViewLayout */ contextMenuDragVisiable: boolean = false; /** * 导航服务 * * @memberof TabPageExpStyle2 */ protected navHistory: AppNavHistory = AppServiceBase.getInstance().getAppNavDataService(); /** * 是否显示标题栏 * * @readonly * @memberof AppDefaultViewLayout */ get showCaption(){ if(this.viewInstance && this.$parent && Util.isExist(this.viewInstance.showCaptionBar)){ return this.viewInstance.showCaptionBar && !(this.$parent as any).noViewCaption }else{ return true; } } /** * 路由列表 * * @memberof AppStyle2IndexViewLayout */ get routerList() { if(this.navHistory?.historyList?.length > 0){ let temp: any = []; this.navHistory?.historyList.forEach((item: any)=>{ temp.push(item.to.fullPath); }) return temp; }else{ return []; } } /** * 当前主题 * * @memberof AppStyle2IndexViewLayout */ selectTheme() { let _this: any = this; if (_this.$router.app.$store.state.selectTheme) { return _this.$router.app.$store.state.selectTheme; } else if (localStorage.getItem('theme-class')) { return localStorage.getItem('theme-class'); } else { return 'app-theme-studio-dark'; } } /** * 路由键值 * * @memberof AppStyle2IndexViewLayout */ get routerViewKey() { let _this: any = this; return _this.$route.fullPath; } /** * 初始化 * * @memberof AppStyle2IndexViewLayout */ created() { document.getElementsByTagName('html')[0].className = this.selectTheme(); this.$uiState.changeLayoutState({ styleMode: 'DEFAULT' }); } /** * 初始化完毕 * * @memberof AppStyle2IndexViewLayout */ mounted() { setTimeout(() => { const el = document.getElementById('app-loading-x'); if (el) { el.style.display = 'none'; } }, 300); } /** * 绘制内容 * * @memberof AppStyle2IndexViewLayout */ render(h: any): any { const viewClassNames = this.initRenderClassNames(); if (this.viewInstance && this.viewInstance.mainMenuAlign && Object.is(this.viewInstance.mainMenuAlign, "CENTER")) { const { codeName } = this.viewInstance; return ( {this.$slots.default} ) } else { const styleMode: any = this.$uiState.layoutState.styleMode; let leftContent: any; switch (styleMode) { case 'DEFAULT': leftContent = this.$slots.leftExp; break; case 'STYLE2': leftContent = this.$slots.leftNavMenu; } return ( {this.viewInstance.enableAppSwitch ? this.contextMenuDragVisiable = !this.contextMenuDragVisiable}> : null} {this.showCaption ? this.model.srfCaption : null} {this.$slots.headerMenus} {this.$topRenderService.rightItemsRenders.map((fun: any) => fun(h))} {} {} {/* {} */} {this.$slots.default} {this.viewInstance.enableAppSwitch ? : null} {leftContent ? {leftContent} : null} {styleMode === 'DEFAULT' ? this.$slots.tabPageExp : null} this.contextMenuDragVisiable = false}> {this.$slots.bootomExp ? {this.$slots.bootomExp} : null} { this.viewInstance.defaultPage ? : } ); } } }