loading.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="content">
  3. <!-- 个人信息 -->
  4. <view class="blur-bg-2"></view>
  5. <view class="userBox y-c">
  6. <view class="loadBox">
  7. <image src='/static/image/new/logo2.svg'></image>
  8. <view class="progress">
  9. <u-line-progress :percentage="progressPercent" :showText="false" height="18" inactiveColor="#fff" activeColor="#3CD3AD"></u-line-progress>
  10. </view>
  11. <view class="text">AI大脑正在为您综合分析数据...</view>
  12. </view>
  13. <!-- <view class="btnBox">
  14. <view class="btn" @click="goIndex">返回首页</view>
  15. </view> -->
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. getUserInfoByUserId,
  22. getUserInfo
  23. } from '@/api/user.js';
  24. export default {
  25. data() {
  26. return {
  27. progressPercent: 0, // 进度条百分比
  28. progressTimer: null // 定时器
  29. }
  30. },
  31. onLoad(option) {
  32. this.startProgress();
  33. },
  34. onShow() {
  35. },
  36. onUnload() {
  37. // 清除定时器,防止内存泄漏
  38. clearInterval(this.progressTimer);
  39. this.progressTimer = null;
  40. },
  41. methods: {
  42. //首页
  43. goIndex(){
  44. uni.reLaunch({
  45. url: '/pages/index/index',
  46. animationType: 'none',
  47. animationDuration: 2000
  48. })
  49. },
  50. startProgress() {
  51. const step = 2; // 每次增加的进度
  52. const target = 100; // 目标进度
  53. this.progressTimer = setInterval(() => {
  54. if (this.progressPercent >= target) {
  55. clearInterval(this.progressTimer);
  56. this.progressTimer = null;
  57. // 加载完成后跳转到目标页面(示例:首页)
  58. //this.goIndex();
  59. return;
  60. }
  61. this.progressPercent += step;
  62. }, 100);
  63. },
  64. }
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. page {
  69. background: #fff;
  70. font-size: 16px
  71. }
  72. .content {
  73. width: 100%;
  74. height: 100vh;
  75. background: #D8F6EF;
  76. padding: 28px;
  77. display: flex;
  78. flex-direction: column;
  79. background:#D8F6EF;
  80. background-image:url(/static/image/new/bg_mountain.svg);
  81. background-repeat: no-repeat;
  82. position: relative;
  83. background-size: 100% 100%;
  84. }
  85. .userBox {
  86. flex: 1;
  87. // background: rgba(255, 255, 255, 0.7);
  88. // border-radius: 24px 24px 24px 24px;
  89. padding: 27px 40px;
  90. z-index: 9;
  91. .loadBox{
  92. display: flex;
  93. align-items: center;
  94. flex-direction: column;
  95. image{
  96. width: 197px;
  97. height: 197px;
  98. }
  99. .text{
  100. margin-top: 11px;
  101. font-family: PingFang SC, PingFang SC;
  102. font-weight: 400;
  103. font-size: 28px;
  104. color: #333333;
  105. }
  106. .progress{
  107. width: 100%;
  108. margin-top:200px ;
  109. margin-bottom: 33px;
  110. }
  111. }
  112. .btnBox{
  113. display: flex;
  114. align-items: center;
  115. flex-direction: column;
  116. .btn {
  117. margin-top: 97px;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. width: 360px;
  122. height: 68px;
  123. background: #37C3A0;
  124. border-radius: 121px 121px 121px 121px;
  125. font-family: PingFang SC, PingFang SC;
  126. font-weight: 600;
  127. font-size: 28px;
  128. color: #FFFFFF;
  129. }
  130. }
  131. }
  132. @keyframes pulse {
  133. from { opacity: 0.8; }
  134. to { opacity: 1; }
  135. }
  136. </style>