load-card.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="load-container">
  3. <view class="loading-card">
  4. <view class="loading-animation">
  5. <view class="ring ring-1"></view>
  6. <view class="ring ring-2"></view>
  7. <view class="ring ring-3"></view>
  8. <view class="center-ball">
  9. <view class="highlight"></view>
  10. <!-- 核心:绑定计算出的弦长宽度 -->
  11. <view class="horizontal-highlight"
  12. :style="{ top: 100 - progress + '%', width: chordWidth + '%', height: chordHeight + '%' }"></view>
  13. </view>
  14. <view class="floating-dots">
  15. <view class="dot dot-green"></view>
  16. <view class="dot dot-yellow"></view>
  17. <view class="dot dot-blue"></view>
  18. </view>
  19. </view>
  20. <view class="progress-text">{{ progress }}%</view>
  21. <view class="status-text">{{ statusText }}</view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. progress: {
  29. type: Number,
  30. default: 50
  31. },
  32. statusText: {
  33. type: String,
  34. default: '正在分析您的简历...'
  35. }
  36. },
  37. data() {
  38. return {
  39. show: true
  40. }
  41. },
  42. computed: {
  43. // 核心修正:用圆的弦长公式计算宽度
  44. chordWidth() {
  45. const ballRadius = 130; // 光球半径(260rpx / 2)
  46. const ballDiameter = 260; // 光球直径
  47. // 计算高光带的y坐标(rpx)
  48. const highlightY = ((100 - this.progress) / 100) * ballDiameter;
  49. // 计算圆心到高光带的垂直距离d
  50. const d = Math.abs(highlightY - ballRadius);
  51. // 当d >= 半径时,弦长为0(高光带在圆外)
  52. if (d >= ballRadius) return 0;
  53. // 计算弦长(rpx)
  54. const chordLength = 2 * Math.sqrt(Math.pow(ballRadius, 2) - Math.pow(d, 2));
  55. // 转化为百分比
  56. return (chordLength / ballDiameter) * 100;
  57. },
  58. chordHeight() {
  59. if (this.progress < 20 || this.progress > 80) {
  60. let height = 0
  61. if (this.progress < 25) {
  62. height = this.progress
  63. } else {
  64. height = 100 - this.progress
  65. }
  66. return height
  67. } else {
  68. return 20
  69. }
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .load-container {
  76. position: fixed;
  77. left: 0;
  78. top: 0;
  79. width: 100%;
  80. height: 100%;
  81. display: flex;
  82. align-items: center;
  83. justify-content: center;
  84. background: rgba(0, 0, 0, 0.5);
  85. }
  86. /* 原有样式不变,仅保证horizontal-highlight的定位正确 */
  87. .horizontal-highlight {
  88. position: absolute;
  89. top: 0%;
  90. left: 50%;
  91. transform: translate(-50%, -50%);
  92. width: 0%;
  93. height: 0%;
  94. border-radius: 50%;
  95. background: radial-gradient(ellipse at center,
  96. rgba(255, 255, 255, 0.7) 0%,
  97. rgba(255, 255, 255, 0.3) 50%,
  98. transparent 100%);
  99. pointer-events: none;
  100. z-index: 100;
  101. transition: width 0.8s ease, top 0.8s ease;
  102. }
  103. /* 其他样式保持不变 */
  104. .loading-card {
  105. width: 560rpx;
  106. padding: 60rpx 40rpx;
  107. background: #fff;
  108. border-radius: 24rpx;
  109. display: flex;
  110. flex-direction: column;
  111. align-items: center;
  112. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
  113. }
  114. .loading-animation {
  115. position: relative;
  116. width: 320rpx;
  117. height: 320rpx;
  118. margin-bottom: 30rpx;
  119. }
  120. .ring {
  121. position: absolute;
  122. top: 50%;
  123. left: 50%;
  124. transform: translate(-50%, -50%);
  125. border-radius: 50%;
  126. background: rgba(255, 215, 186, 0.3);
  127. }
  128. .ring-1 {
  129. width: 100%;
  130. height: 100%;
  131. opacity: 0.8;
  132. }
  133. .ring-2 {
  134. width: 120%;
  135. height: 120%;
  136. opacity: 0.5;
  137. }
  138. .ring-3 {
  139. width: 140%;
  140. height: 140%;
  141. opacity: 0.3;
  142. }
  143. .center-ball {
  144. position: absolute;
  145. top: 50%;
  146. left: 50%;
  147. transform: translate(-50%, -50%);
  148. width: 260rpx;
  149. height: 260rpx;
  150. border-radius: 50%;
  151. box-shadow: 0px 7px 37px 0px rgba(239, 181, 157, 0.62);
  152. background: linear-gradient(159.89deg, rgba(236, 241, 252, 1) -2.225%, rgba(255, 249.54, 246.5, 1) 17.355%, rgba(255, 166, 130, 1) 69.089%, rgba(253.94, 184.19, 155.54, 1) 90.285%);
  153. overflow: hidden;
  154. }
  155. .highlight {
  156. position: absolute;
  157. top: 10%;
  158. left: 20%;
  159. width: 60%;
  160. height: 60%;
  161. border-radius: 50%;
  162. background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
  163. pointer-events: none;
  164. }
  165. .floating-dots {
  166. position: absolute;
  167. top: 0;
  168. left: 0;
  169. width: 100%;
  170. height: 100%;
  171. pointer-events: none;
  172. }
  173. .dot {
  174. position: absolute;
  175. width: 12rpx;
  176. height: 12rpx;
  177. border-radius: 50%;
  178. opacity: 0.8;
  179. }
  180. .dot-green {
  181. background: #4ade80;
  182. animation: floatGreen 12s ease-in-out infinite;
  183. }
  184. .dot-yellow {
  185. background: #fbbf24;
  186. animation: floatYellow 15s ease-in-out infinite;
  187. }
  188. .dot-blue {
  189. background: #60a5fa;
  190. animation: floatBlue 10s ease-in-out infinite;
  191. }
  192. @keyframes floatGreen {
  193. 0% {
  194. transform: translate(40rpx, 60rpx);
  195. }
  196. 50% {
  197. transform: translate(60rpx, 40rpx);
  198. }
  199. 100% {
  200. transform: translate(40rpx, 60rpx);
  201. }
  202. }
  203. @keyframes floatYellow {
  204. 0% {
  205. transform: translate(300rpx, 140rpx);
  206. }
  207. 50% {
  208. transform: translate(280rpx, 80rpx);
  209. }
  210. 100% {
  211. transform: translate(300rpx, 140rpx);
  212. }
  213. }
  214. @keyframes floatBlue {
  215. 0% {
  216. transform: translate(280rpx, 240rpx);
  217. }
  218. 50% {
  219. transform: translate(240rpx, 280rpx);
  220. }
  221. 100% {
  222. transform: translate(280rpx, 240rpx);
  223. }
  224. }
  225. .progress-text {
  226. width: 100%;
  227. font-size: 48rpx;
  228. font-weight: bold;
  229. text-align: center;
  230. color: #ff7d45;
  231. margin-bottom: 12rpx;
  232. }
  233. .status-text {
  234. font-size: 28rpx;
  235. color: #666;
  236. text-align: center;
  237. line-height: 1.5;
  238. }
  239. </style>