123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <div :class="[prefixCls, getLayoutContentMode, { 'layout-content-full': getShowFullHeader }]" v-loading="getOpenPageLoading && getPageLoading">
- <PageLayout class="page-box"/>
- <!-- update-begin-author:zyf date:20211129 for:qiankun 挂载子应用盒子 -->
- <div v-if="getShowFullHeader && loading" class="app-loading">
- <div id="loader-wrapper" class="app-loading">
- <div class="app-loading-wrap">
- <div class="app-loading-dots">
- <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
- </div>
- </div>
- </div>
- </div>
- <div id="content" class="app-view-box" v-show="openQianKun == 'true' && currentRoute.path.startsWith('/micro-')" :style="{top: getShowFullHeader ? 0 : '48px'}"> </div>
- <!-- update-end-author:zyf date:20211129 for: qiankun 挂载子应用盒子-->
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, onMounted, unref, computed, ref, onBeforeMount } from 'vue';
- import PageLayout from '/@/layouts/page/index.vue';
- import { useDesign } from '/@/hooks/web/useDesign';
- import { useRootSetting } from '/@/hooks/setting/useRootSetting';
- import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
- import { useContentViewHeight } from './useContentViewHeight';
- import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
- import { useRouter } from 'vue-router';
- import { registerApps } from '/@/qiankun';
- import { useGlobSetting } from '/@/hooks/setting';
- import { getActions } from '/@/qiankun/state';
- export default defineComponent({
- name: 'LayoutContent',
- components: { PageLayout },
- setup() {
- const { prefixCls } = useDesign('layout-content');
- const { getOpenPageLoading } = useTransitionSetting();
- const { getLayoutContentMode, getPageLoading } = useRootSetting();
- const { getShowFullHeaderRef } = useHeaderSetting();
- const router = useRouter();
- const { currentRoute } = router;
- const globSetting = useGlobSetting();
- const openQianKun = globSetting.openQianKun;
- const loading = ref(true);
- let actions;
- if (openQianKun == 'true') {
- actions = getActions();
- actions.setGlobalState({ isMounted: false });
- actions.onGlobalStateChange((newState, prev) => {
- for (const key in newState) {
- if (key === 'isMounted') {
- if (newState[key] !== prev[key] && newState[key] === true) {
- loading.value = false;
- console.log('首页已经渲染完毕');
- }
- }
- }
- // const route = unref(currentRoute);
- // if (route.path.startsWith('/micro-vent-3dModal/modelchannel/safety/VentanalyModel3D') && document.body.getAttribute('class')?.includes('style-styleTwo')) {
- // document.body.removeAttribute('class', 'style-styleTwo');
- // }
- });
- }
- useContentViewHeight();
- const getShowFullHeader = computed(() => {
- const route = unref(currentRoute);
- // if (!route.path.startsWith('/micro-vent-3dModal') || route.path.startsWith('/micro-vent-3dModal/modelchannel/safety/VentanalyModel3D')) {
- // if (document.body.getAttribute('class')?.includes('style-styleTwo')) document.body.removeAttribute('class', 'style-styleTwo');
- // } else {
- // document.body.setAttribute('class', 'style-styleTwo');
- // }
- return getShowFullHeaderRef.value && ((route.path.startsWith('/micro-')));
- });
- onBeforeMount(() => {});
- onMounted(() => {
- //注册openQianKun
- // console.log('window.qiankunStarted------>', window.qiankunStarted);
- if (openQianKun == 'true') {
- if (!window.qiankunStarted) {
- window.qiankunStarted = true;
- registerApps();
- }
- }
- });
- return {
- prefixCls,
- openQianKun,
- getOpenPageLoading,
- getLayoutContentMode,
- getPageLoading,
- getShowFullHeader,
- loading,
- currentRoute
- };
- },
- });
- </script>
- <style lang="less" scoped>
- @prefix-cls: ~'@{namespace}-layout-content';
- @ventSpace: zxm;
-
- .@{prefix-cls} {
- position: relative;
- flex: 1 1 auto;
- min-height: 0;
- &.fixed {
- width: 1200px;
- margin: 0 auto;
- }
- &-loading {
- position: absolute;
- top: 200px;
- z-index: @page-loading-z-index;
- }
- }
- .app-view-box{
- position: fixed;
- width: 100%;
- height: 100%;
- top: 0;
- left:0;
- background: transparent;
- }
- .layout-content-full {
- // height: calc(100vh - 48px);
- // margin-top: 48px;
- // overflow-y: auto;
- height: 100%
- }
- .app-loading {
- display: flex;
- width: 100%;
- height: 100%;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- // background-color: #f4f7f900;
- background-image: url('/@/assets/images/vent/loading-bg.png');
- background-size: cover;
- background-repeat: no-repeat;
- background-color: #09172C;
- }
- .app-loading .app-loading-wrap {
- position: absolute;
- top: 50%;
- left: 50%;
- display: flex;
- -webkit-transform: translate3d(-50%, -50%, 0);
- transform: translate3d(-50%, -50%, 0);
- justify-content: center;
- align-items: center;
- flex-direction: column;
- }
- .app-loading .dots {
- display: flex;
- padding: 98px;
- justify-content: center;
- align-items: center;
- }
- .app-loading .app-loading-title {
- display: flex;
- margin-top: 30px;
- font-size: 30px;
- color: rgba(0, 0, 0, 0.85);
- justify-content: center;
- align-items: center;
- }
- .dot {
- position: relative;
- display: inline-block;
- width: 32px;
- height: 32px;
- margin-top: 30px;
- font-size: 32px;
- transform: rotate(45deg);
- box-sizing: border-box;
- animation: antRotate 1.2s infinite linear;
- }
- .dot i {
- position: absolute;
- display: block;
- width: 14px;
- height: 14px;
- background-color: #0065cc;
- // background-color: #d1d1d1;
- border-radius: 100%;
- opacity: 0.3;
- transform: scale(0.75);
- animation: antSpinMove 1s infinite linear alternate;
- transform-origin: 50% 50%;
- }
- .dot i:nth-child(1) {
- top: 0;
- left: 0;
- }
- .dot i:nth-child(2) {
- top: 0;
- right: 0;
- -webkit-animation-delay: 0.4s;
- animation-delay: 0.4s;
- }
- .dot i:nth-child(3) {
- right: 0;
- bottom: 0;
- -webkit-animation-delay: 0.8s;
- animation-delay: 0.8s;
- }
- .dot i:nth-child(4) {
- bottom: 0;
- left: 0;
- -webkit-animation-delay: 1.2s;
- animation-delay: 1.2s;
- }
- @keyframes antRotate {
- to {
- -webkit-transform: rotate(405deg);
- transform: rotate(405deg);
- }
- }
- @-webkit-keyframes antRotate {
- to {
- -webkit-transform: rotate(405deg);
- transform: rotate(405deg);
- }
- }
- @keyframes antSpinMove {
- to {
- opacity: 1;
- }
- }
- @-webkit-keyframes antSpinMove {
- to {
- opacity: 1;
- }
- }
- :deep(.@{ventSpace}-layout){
- background: transparent !important;
- }
- </style>
|