index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div :class="[prefixCls, getLayoutContentMode, { 'layout-content-full': getShowFullHeader }]" v-loading="getOpenPageLoading && getPageLoading">
  3. <PageLayout class="page-box"/>
  4. <!-- update-begin-author:zyf date:20211129 for:qiankun 挂载子应用盒子 -->
  5. <div v-if="getShowFullHeader && loading" class="app-loading">
  6. <div id="loader-wrapper" class="app-loading">
  7. <div class="app-loading-wrap">
  8. <div class="app-loading-dots">
  9. <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
  10. </div>
  11. </div>
  12. </div>
  13. </div>
  14. <div id="content" class="app-view-box" v-show="openQianKun == 'true' && currentRoute.path.startsWith('/micro-')" :style="{top: getShowFullHeader ? 0 : '48px'}"> </div>
  15. <!-- update-end-author:zyf date:20211129 for: qiankun 挂载子应用盒子-->
  16. </div>
  17. </template>
  18. <script lang="ts">
  19. import { defineComponent, onMounted, unref, computed, ref, onBeforeMount } from 'vue';
  20. import PageLayout from '/@/layouts/page/index.vue';
  21. import { useDesign } from '/@/hooks/web/useDesign';
  22. import { useRootSetting } from '/@/hooks/setting/useRootSetting';
  23. import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
  24. import { useContentViewHeight } from './useContentViewHeight';
  25. import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
  26. import { useRouter } from 'vue-router';
  27. import { registerApps } from '/@/qiankun';
  28. import { useGlobSetting } from '/@/hooks/setting';
  29. import { getActions } from '/@/qiankun/state';
  30. export default defineComponent({
  31. name: 'LayoutContent',
  32. components: { PageLayout },
  33. setup() {
  34. const { prefixCls } = useDesign('layout-content');
  35. const { getOpenPageLoading } = useTransitionSetting();
  36. const { getLayoutContentMode, getPageLoading } = useRootSetting();
  37. const { getShowFullHeaderRef } = useHeaderSetting();
  38. const router = useRouter();
  39. const { currentRoute } = router;
  40. const globSetting = useGlobSetting();
  41. const openQianKun = globSetting.openQianKun;
  42. const loading = ref(true);
  43. let actions;
  44. if (openQianKun == 'true') {
  45. actions = getActions();
  46. actions.setGlobalState({ isMounted: false });
  47. actions.onGlobalStateChange((newState, prev) => {
  48. for (const key in newState) {
  49. if (key === 'isMounted') {
  50. if (newState[key] !== prev[key] && newState[key] === true) {
  51. loading.value = false;
  52. console.log('首页已经渲染完毕');
  53. }
  54. }
  55. }
  56. // const route = unref(currentRoute);
  57. // if (route.path.startsWith('/micro-vent-3dModal/modelchannel/safety/VentanalyModel3D') && document.body.getAttribute('class')?.includes('style-styleTwo')) {
  58. // document.body.removeAttribute('class', 'style-styleTwo');
  59. // }
  60. });
  61. }
  62. useContentViewHeight();
  63. const getShowFullHeader = computed(() => {
  64. const route = unref(currentRoute);
  65. // if (!route.path.startsWith('/micro-vent-3dModal') || route.path.startsWith('/micro-vent-3dModal/modelchannel/safety/VentanalyModel3D')) {
  66. // if (document.body.getAttribute('class')?.includes('style-styleTwo')) document.body.removeAttribute('class', 'style-styleTwo');
  67. // } else {
  68. // document.body.setAttribute('class', 'style-styleTwo');
  69. // }
  70. return getShowFullHeaderRef.value && ((route.path.startsWith('/micro-')));
  71. });
  72. onBeforeMount(() => {});
  73. onMounted(() => {
  74. //注册openQianKun
  75. // console.log('window.qiankunStarted------>', window.qiankunStarted);
  76. if (openQianKun == 'true') {
  77. if (!window.qiankunStarted) {
  78. window.qiankunStarted = true;
  79. registerApps();
  80. }
  81. }
  82. });
  83. return {
  84. prefixCls,
  85. openQianKun,
  86. getOpenPageLoading,
  87. getLayoutContentMode,
  88. getPageLoading,
  89. getShowFullHeader,
  90. loading,
  91. currentRoute
  92. };
  93. },
  94. });
  95. </script>
  96. <style lang="less" scoped>
  97. @prefix-cls: ~'@{namespace}-layout-content';
  98. @ventSpace: zxm;
  99. .@{prefix-cls} {
  100. position: relative;
  101. flex: 1 1 auto;
  102. min-height: 0;
  103. &.fixed {
  104. width: 1200px;
  105. margin: 0 auto;
  106. }
  107. &-loading {
  108. position: absolute;
  109. top: 200px;
  110. z-index: @page-loading-z-index;
  111. }
  112. }
  113. .app-view-box{
  114. position: fixed;
  115. width: 100%;
  116. height: 100%;
  117. top: 0;
  118. left:0;
  119. background: transparent;
  120. }
  121. .layout-content-full {
  122. // height: calc(100vh - 48px);
  123. // margin-top: 48px;
  124. // overflow-y: auto;
  125. height: 100%
  126. }
  127. .app-loading {
  128. display: flex;
  129. width: 100%;
  130. height: 100%;
  131. justify-content: center;
  132. align-items: center;
  133. flex-direction: column;
  134. // background-color: #f4f7f900;
  135. background-image: url('/@/assets/images/vent/loading-bg.png');
  136. background-size: cover;
  137. background-repeat: no-repeat;
  138. background-color: #09172C;
  139. }
  140. .app-loading .app-loading-wrap {
  141. position: absolute;
  142. top: 50%;
  143. left: 50%;
  144. display: flex;
  145. -webkit-transform: translate3d(-50%, -50%, 0);
  146. transform: translate3d(-50%, -50%, 0);
  147. justify-content: center;
  148. align-items: center;
  149. flex-direction: column;
  150. }
  151. .app-loading .dots {
  152. display: flex;
  153. padding: 98px;
  154. justify-content: center;
  155. align-items: center;
  156. }
  157. .app-loading .app-loading-title {
  158. display: flex;
  159. margin-top: 30px;
  160. font-size: 30px;
  161. color: rgba(0, 0, 0, 0.85);
  162. justify-content: center;
  163. align-items: center;
  164. }
  165. .dot {
  166. position: relative;
  167. display: inline-block;
  168. width: 32px;
  169. height: 32px;
  170. margin-top: 30px;
  171. font-size: 32px;
  172. transform: rotate(45deg);
  173. box-sizing: border-box;
  174. animation: antRotate 1.2s infinite linear;
  175. }
  176. .dot i {
  177. position: absolute;
  178. display: block;
  179. width: 14px;
  180. height: 14px;
  181. background-color: #0065cc;
  182. // background-color: #d1d1d1;
  183. border-radius: 100%;
  184. opacity: 0.3;
  185. transform: scale(0.75);
  186. animation: antSpinMove 1s infinite linear alternate;
  187. transform-origin: 50% 50%;
  188. }
  189. .dot i:nth-child(1) {
  190. top: 0;
  191. left: 0;
  192. }
  193. .dot i:nth-child(2) {
  194. top: 0;
  195. right: 0;
  196. -webkit-animation-delay: 0.4s;
  197. animation-delay: 0.4s;
  198. }
  199. .dot i:nth-child(3) {
  200. right: 0;
  201. bottom: 0;
  202. -webkit-animation-delay: 0.8s;
  203. animation-delay: 0.8s;
  204. }
  205. .dot i:nth-child(4) {
  206. bottom: 0;
  207. left: 0;
  208. -webkit-animation-delay: 1.2s;
  209. animation-delay: 1.2s;
  210. }
  211. @keyframes antRotate {
  212. to {
  213. -webkit-transform: rotate(405deg);
  214. transform: rotate(405deg);
  215. }
  216. }
  217. @-webkit-keyframes antRotate {
  218. to {
  219. -webkit-transform: rotate(405deg);
  220. transform: rotate(405deg);
  221. }
  222. }
  223. @keyframes antSpinMove {
  224. to {
  225. opacity: 1;
  226. }
  227. }
  228. @-webkit-keyframes antSpinMove {
  229. to {
  230. opacity: 1;
  231. }
  232. }
  233. :deep(.@{ventSpace}-layout){
  234. background: transparent !important;
  235. }
  236. </style>