loading.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div id="loading">
  3. <el-row>
  4. <el-col :span="24" class="info">
  5. <div class="page">
  6. <div class="circle-loader">
  7. <div class="circle-line">
  8. <div class="circle circle-blue"></div>
  9. <div class="circle circle-blue"></div>
  10. <div class="circle circle-blue"></div>
  11. </div>
  12. <div class="circle-line">
  13. <div class="circle circle-yellow"></div>
  14. <div class="circle circle-yellow"></div>
  15. <div class="circle circle-yellow"></div>
  16. </div>
  17. <div class="circle-line">
  18. <div class="circle circle-red"></div>
  19. <div class="circle circle-red"></div>
  20. <div class="circle circle-red"></div>
  21. </div>
  22. <div class="circle-line">
  23. <div class="circle circle-green"></div>
  24. <div class="circle circle-green"></div>
  25. <div class="circle circle-green"></div>
  26. </div>
  27. </div>
  28. <div class="title">
  29. 站点信息加载中,请稍等!
  30. </div>
  31. </div>
  32. </el-col>
  33. </el-row>
  34. </div>
  35. </template>
  36. <script>
  37. import { mapActions, mapState } from 'vuex';
  38. import _ from 'lodash';
  39. export default {
  40. metaInfo() {
  41. return {
  42. title: this.siteTitle ? this.siteTitle : '加载中',
  43. };
  44. },
  45. name: 'loading',
  46. props: {},
  47. components: {},
  48. data: () => ({}),
  49. async created() {
  50. await this.toGetSite(); //获取主站信息
  51. },
  52. computed: {},
  53. methods: {
  54. ...mapActions(['getSite']),
  55. //站点信息
  56. async toGetSite() {
  57. let site = sessionStorage.getItem('site');
  58. if (!site) {
  59. let result = await this.getSite({ type: 'search' });
  60. if (!_.isObject(result.data)) {
  61. this.$router.push('/fail');
  62. } else {
  63. sessionStorage.setItem('site', JSON.stringify(result.data));
  64. this.$router.push('/index');
  65. }
  66. } else {
  67. this.$router.push('/index');
  68. }
  69. },
  70. },
  71. };
  72. </script>
  73. <style lang="less" scoped>
  74. .info {
  75. width: 100%;
  76. height: 100vh;
  77. }
  78. .title {
  79. position: absolute;
  80. top: 50%;
  81. text-align: center;
  82. font-size: 20px;
  83. width: 100%;
  84. }
  85. .circle-loader {
  86. display: block;
  87. width: 64px;
  88. height: 64px;
  89. margin-left: -32px;
  90. margin-top: -32px;
  91. position: absolute;
  92. left: 50%;
  93. top: 40%;
  94. -webkit-transform-origin: 16px 16px;
  95. transform-origin: 16px 16px;
  96. -webkit-animation: rotate-animation 5s infinite;
  97. animation: rotate-animation 5s infinite;
  98. -webkit-animation-timing-function: linear;
  99. animation-timing-function: linear;
  100. }
  101. .circle-loader .circle {
  102. -webkit-animation: move-animation 2.5s infinite;
  103. animation: move-animation 2.5s infinite;
  104. -webkit-animation-timing-function: linear;
  105. animation-timing-function: linear;
  106. position: absolute;
  107. left: 50%;
  108. top: 50%;
  109. }
  110. .circle-loader .circle-line {
  111. width: 64px;
  112. height: 24px;
  113. position: absolute;
  114. top: 4px;
  115. left: 0;
  116. -webkit-transform-origin: 4px 4px;
  117. transform-origin: 4px 4px;
  118. }
  119. .circle-loader .circle-line:nth-child(0) {
  120. -webkit-transform: rotate(0deg);
  121. transform: rotate(0deg);
  122. }
  123. .circle-loader .circle-line:nth-child(1) {
  124. -webkit-transform: rotate(90deg);
  125. transform: rotate(90deg);
  126. }
  127. .circle-loader .circle-line:nth-child(2) {
  128. -webkit-transform: rotate(180deg);
  129. transform: rotate(180deg);
  130. }
  131. .circle-loader .circle-line:nth-child(3) {
  132. -webkit-transform: rotate(270deg);
  133. transform: rotate(270deg);
  134. }
  135. .circle-loader .circle-line .circle:nth-child(1) {
  136. width: 8px;
  137. height: 8px;
  138. top: 50%;
  139. left: 50%;
  140. margin-top: -4px;
  141. margin-left: -4px;
  142. border-radius: 4px;
  143. -webkit-animation-delay: -0.3s;
  144. animation-delay: -0.3s;
  145. }
  146. .circle-loader .circle-line .circle:nth-child(2) {
  147. width: 16px;
  148. height: 16px;
  149. top: 50%;
  150. left: 50%;
  151. margin-top: -8px;
  152. margin-left: -8px;
  153. border-radius: 8px;
  154. -webkit-animation-delay: -0.6s;
  155. animation-delay: -0.6s;
  156. }
  157. .circle-loader .circle-line .circle:nth-child(3) {
  158. width: 24px;
  159. height: 24px;
  160. top: 50%;
  161. left: 50%;
  162. margin-top: -12px;
  163. margin-left: -12px;
  164. border-radius: 12px;
  165. -webkit-animation-delay: -0.9s;
  166. animation-delay: -0.9s;
  167. }
  168. .circle-loader .circle-blue {
  169. background-color: #1f4e5a;
  170. }
  171. .circle-loader .circle-red {
  172. background-color: #ff5955;
  173. }
  174. .circle-loader .circle-yellow {
  175. background-color: #ffb265;
  176. }
  177. .circle-loader .circle-green {
  178. background-color: #00a691;
  179. }
  180. @-webkit-keyframes rotate-animation {
  181. 0% {
  182. -webkit-transform: rotate(0deg);
  183. transform: rotate(0deg);
  184. }
  185. 100% {
  186. -webkit-transform: rotate(360deg);
  187. transform: rotate(360deg);
  188. }
  189. }
  190. @keyframes rotate-animation {
  191. 0% {
  192. -webkit-transform: rotate(0deg);
  193. transform: rotate(0deg);
  194. }
  195. 100% {
  196. -webkit-transform: rotate(360deg);
  197. transform: rotate(360deg);
  198. }
  199. }
  200. @-webkit-keyframes move-animation {
  201. 0% {
  202. -webkit-transform: translate(0, 0);
  203. transform: translate(0, 0);
  204. }
  205. 25% {
  206. -webkit-transform: translate(-64px, 0);
  207. transform: translate(-64px, 0);
  208. }
  209. 75% {
  210. -webkit-transform: translate(32px, 0);
  211. transform: translate(32px, 0);
  212. }
  213. 100% {
  214. -webkit-transform: translate(0, 0);
  215. transform: translate(0, 0);
  216. }
  217. }
  218. @-webkit-keyframes move-animation {
  219. 0% {
  220. -webkit-transform: translate(0, 0);
  221. }
  222. }
  223. @keyframes move-animation {
  224. 0% {
  225. -webkit-transform: translate(0, 0);
  226. transform: translate(0, 0);
  227. }
  228. 25% {
  229. -webkit-transform: translate(-64px, 0);
  230. transform: translate(-64px, 0);
  231. }
  232. 75% {
  233. -webkit-transform: translate(32px, 0);
  234. transform: translate(32px, 0);
  235. }
  236. 100% {
  237. -webkit-transform: translate(0, 0);
  238. transform: translate(0, 0);
  239. }
  240. }
  241. </style>