ventModal.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div v-if="loading" class="app-loading">
  3. <div id="loader-wrapper" class="app-loading">
  4. <div class="app-loading-wrap">
  5. <div class="app-loading-dots">
  6. <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
  7. </div>
  8. </div>
  9. </div>
  10. </div>
  11. <div id="micro-vent-3dModal"></div>
  12. </template>
  13. <script lang="ts">
  14. import { ref, onMounted, onBeforeUnmount, defineComponent } from 'vue';
  15. import { unmountMicroApps, mountMicroApp } from '/@/qiankun';
  16. import { resetMicroContentWH } from '/@/utils/domUtils';
  17. import { getActions } from '/@/qiankun/state';
  18. export default defineComponent({
  19. name: 'VentModel',
  20. setup() {
  21. let actions: any;
  22. const loading = ref(true);
  23. onMounted(() => {
  24. mountMicroApp('/micro-vent-3dModal');
  25. resetMicroContentWH('micro-vent-3dModal');
  26. actions = getActions();
  27. actions.onGlobalStateChange((newState, prev) => {
  28. debugger;
  29. for (const key in newState) {
  30. if (key === 'isMounted') {
  31. if (newState[key] !== prev[key] && newState[key] === true) {
  32. loading.value = false;
  33. console.log('首页已经渲染完毕');
  34. }
  35. }
  36. }
  37. });
  38. });
  39. onBeforeUnmount(async () => {
  40. unmountMicroApps(['/micro-vent-3dModal']);
  41. });
  42. return { loading };
  43. },
  44. });
  45. </script>
  46. <style lang="less" scoped>
  47. @import '/@/design/vent/color.less';
  48. .app-loading {
  49. position: absolute;
  50. display: flex;
  51. width: 100%;
  52. height: 100%;
  53. justify-content: center;
  54. align-items: center;
  55. flex-direction: column;
  56. // background-color: #f4f7f900;
  57. background-image: url('/@/assets/images/vent/loading-bg.png');
  58. background-size: cover;
  59. background-repeat: no-repeat;
  60. background-color: var(--vent-base-color);
  61. }
  62. .app-loading .app-loading-wrap {
  63. position: absolute;
  64. top: 50%;
  65. left: 50%;
  66. display: flex;
  67. -webkit-transform: translate3d(-50%, -50%, 0);
  68. transform: translate3d(-50%, -50%, 0);
  69. justify-content: center;
  70. align-items: center;
  71. flex-direction: column;
  72. }
  73. .app-loading .dots {
  74. display: flex;
  75. padding: 98px;
  76. justify-content: center;
  77. align-items: center;
  78. }
  79. .app-loading .app-loading-title {
  80. display: flex;
  81. margin-top: 30px;
  82. font-size: 30px;
  83. color: rgba(0, 0, 0, 0.85);
  84. justify-content: center;
  85. align-items: center;
  86. }
  87. .dot {
  88. position: relative;
  89. display: inline-block;
  90. width: 32px;
  91. height: 32px;
  92. margin-top: 30px;
  93. font-size: 32px;
  94. transform: rotate(45deg);
  95. box-sizing: border-box;
  96. animation: antRotate 1.2s infinite linear;
  97. }
  98. .dot i {
  99. position: absolute;
  100. display: block;
  101. width: 14px;
  102. height: 14px;
  103. background-color: #0065cc;
  104. // background-color: #d1d1d1;
  105. border-radius: 100%;
  106. opacity: 0.3;
  107. transform: scale(0.75);
  108. animation: antSpinMove 1s infinite linear alternate;
  109. transform-origin: 50% 50%;
  110. }
  111. .dot i:nth-child(1) {
  112. top: 0;
  113. left: 0;
  114. }
  115. .dot i:nth-child(2) {
  116. top: 0;
  117. right: 0;
  118. -webkit-animation-delay: 0.4s;
  119. animation-delay: 0.4s;
  120. }
  121. .dot i:nth-child(3) {
  122. right: 0;
  123. bottom: 0;
  124. -webkit-animation-delay: 0.8s;
  125. animation-delay: 0.8s;
  126. }
  127. .dot i:nth-child(4) {
  128. bottom: 0;
  129. left: 0;
  130. -webkit-animation-delay: 1.2s;
  131. animation-delay: 1.2s;
  132. }
  133. @keyframes antRotate {
  134. to {
  135. -webkit-transform: rotate(405deg);
  136. transform: rotate(405deg);
  137. }
  138. }
  139. @-webkit-keyframes antRotate {
  140. to {
  141. -webkit-transform: rotate(405deg);
  142. transform: rotate(405deg);
  143. }
  144. }
  145. @keyframes antSpinMove {
  146. to {
  147. opacity: 1;
  148. }
  149. }
  150. @-webkit-keyframes antSpinMove {
  151. to {
  152. opacity: 1;
  153. }
  154. }
  155. </style>