Loading.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="form-loading" v-if="loadingAnimate">
  3. <div class="form-loading-container">
  4. <div class="loading3">
  5. <div class="circle circle1">
  6. <span></span>
  7. <span></span>
  8. <span></span>
  9. <span></span>
  10. </div>
  11. <div class="circle circle2">
  12. <span></span>
  13. <span></span>
  14. <span></span>
  15. <span></span>
  16. </div>
  17. <div class="circle circle3">
  18. <span></span>
  19. <span></span>
  20. <span></span>
  21. <span></span>
  22. </div>
  23. </div>
  24. <div class="form-loading-text">
  25. <p>正在为您匹配人才...</p>
  26. <p>倒计时{{times}}秒</p>
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. let timer
  33. export default {
  34. data() {
  35. return {
  36. times: 5,
  37. loadingAnimate: false
  38. }
  39. },
  40. destroy() {
  41. clearInterval(timer)
  42. timer = null
  43. },
  44. methods: {
  45. start() {
  46. return new Promise((resolve, reject) => {
  47. this.loadingAnimate = true;
  48. timer = setInterval(() => {
  49. this.times--
  50. if (this.times == 0) {
  51. clearInterval(timer)
  52. timer = null
  53. this.times = 5
  54. this.loadingAnimate = false
  55. resolve()
  56. }
  57. }, 1000)
  58. })
  59. },
  60. stop() {
  61. clearInterval(timer)
  62. timer = null
  63. this.times = 5
  64. this.loadingAnimate = false
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .form-loading {
  71. position: fixed;
  72. z-index: 100;
  73. left: 0;
  74. top: 0;
  75. right: 0;
  76. bottom: 0;
  77. background-color: rgba(0, 0, 0, 0.7);
  78. }
  79. .form-loading-container {
  80. position: absolute;
  81. left: 50%;
  82. top: 45%;
  83. transform: translate(-50%, -50%);
  84. }
  85. .form-loading-text {
  86. text-align: center;
  87. p {
  88. line-height: 2em;
  89. color: #409EFF;
  90. }
  91. }
  92. .loading3 {
  93. width: 70px;
  94. height: 70px;
  95. margin: 50px auto;
  96. position: relative;
  97. }
  98. .circle {
  99. position: absolute;
  100. top: 0;
  101. left: 0;
  102. width: 100%;
  103. height: 100%;
  104. }
  105. .circle span {
  106. width: 8px;
  107. height: 8px;
  108. display: inline-block;
  109. background: #409EFF;
  110. border-radius: 100%;
  111. position: absolute;
  112. -webkit-animation: mycircle 1.2s infinite ease-in-out;
  113. animation: mycircle 1.2s infinite ease-in-out;
  114. -webkit-animation-fill-mode: both;
  115. animation-fill-mode: both;
  116. }
  117. .circle2 {
  118. -webkit-transform: rotateZ(45deg);
  119. transform: rotateZ(45deg);
  120. }
  121. .circle3 {
  122. -webkit-transform: rotateZ(90deg);
  123. transform: rotateZ(90deg);
  124. }
  125. .circle>span:nth-child(1) {
  126. top: 0;
  127. left: 0;
  128. }
  129. .circle>span:nth-child(2) {
  130. top: 0;
  131. right: 0;
  132. }
  133. .circle>span:nth-child(3) {
  134. right: 0;
  135. bottom: 0;
  136. }
  137. .circle>span:nth-child(4) {
  138. left: 0;
  139. bottom: 0;
  140. }
  141. .circle2>span:nth-child(1) {
  142. -webkit-animation-delay: -1.1s;
  143. animation-delay: -1.1s;
  144. }
  145. .circle3>span:nth-child(1) {
  146. -webkit-animation-delay: -1.0s;
  147. animation-delay: -1.0s;
  148. }
  149. .circle1>span:nth-child(2) {
  150. -webkit-animation-delay: -0.9s;
  151. animation-delay: -0.9s;
  152. }
  153. .circle2>span:nth-child(2) {
  154. -webkit-animation-delay: -0.8s;
  155. animation-delay: -0.8s;
  156. }
  157. .circle3>span:nth-child(2) {
  158. -webkit-animation-delay: -0.7s;
  159. animation-delay: -0.7s;
  160. }
  161. .circle1>span:nth-child(3) {
  162. -webkit-animation-delay: -0.6s;
  163. animation-delay: -0.6s;
  164. }
  165. .circle2>span:nth-child(3) {
  166. -webkit-animation-delay: -0.7s;
  167. animation-delay: -0.7s;
  168. }
  169. .circle3>span:nth-child(3) {
  170. -webkit-animation-delay: -0.4s;
  171. animation-delay: -0.4s;
  172. }
  173. .circle1>span:nth-child(4) {
  174. -webkit-animation-delay: -0.3s;
  175. animation-delay: -0.3s;
  176. }
  177. .circle2>span:nth-child(4) {
  178. -webkit-animation-delay: -0.2s;
  179. animation-delay: -0.2s;
  180. }
  181. .circle3>span:nth-child(4) {
  182. -webkit-animation-delay: -0.1s;
  183. animation-delay: -0.1s;
  184. }
  185. @-webkit-keyframes mycircle {
  186. 0% {
  187. transform: scale(0.0);
  188. }
  189. 40% {
  190. transform: scale(1.0);
  191. }
  192. 80% {
  193. transform: scale(0.0);
  194. }
  195. 100% {
  196. transform: scale(0.0);
  197. }
  198. }
  199. @keyframes mycircle {
  200. 0% {
  201. transform: scale(0.0);
  202. }
  203. 40% {
  204. transform: scale(1.0);
  205. }
  206. 80% {
  207. transform: scale(0.0);
  208. }
  209. 100% {
  210. transform: scale(0.0);
  211. }
  212. }
  213. </style>