splash.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="splash-container">
  3. <!-- 跳过按钮 -->
  4. <view class="skip-btn" @click="skipToLogin">
  5. <text class="skip-text">{{ countdown > 0 ? countdown + 's后跳过' : '跳过' }}</text>
  6. </view>
  7. <!-- 应用图标和名称 -->
  8. <view class="app-info">
  9. <view class="app-icon">
  10. <view class="icon-square">
  11. <view class="book-icon">
  12. <view class="book-left"></view>
  13. <view class="book-right"></view>
  14. <view class="book-line"></view>
  15. </view>
  16. </view>
  17. </view>
  18. <text class="app-name">云阅读</text>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. countdown: 3,
  27. timer: null
  28. }
  29. },
  30. onLoad() {
  31. this.startCountdown()
  32. },
  33. onUnload() {
  34. if (this.timer) {
  35. clearInterval(this.timer)
  36. }
  37. },
  38. methods: {
  39. startCountdown() {
  40. this.timer = setInterval(() => {
  41. this.countdown--
  42. if (this.countdown <= 0) {
  43. clearInterval(this.timer)
  44. this.skipToLogin()
  45. }
  46. }, 1000)
  47. },
  48. skipToLogin() {
  49. if (this.timer) {
  50. clearInterval(this.timer)
  51. }
  52. uni.reLaunch({
  53. url: '/pages/login/login'
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style scoped>
  60. .splash-container {
  61. width: 100%;
  62. height: 100vh;
  63. background-color: #FFFFFF;
  64. display: flex;
  65. flex-direction: column;
  66. align-items: center;
  67. justify-content: center;
  68. position: relative;
  69. box-sizing: border-box;
  70. overflow: hidden;
  71. padding-top: 30px;
  72. }
  73. .skip-btn {
  74. position: absolute;
  75. top: calc(env(safe-area-inset-top) + 40rpx);
  76. right: 40rpx;
  77. padding: 12rpx 24rpx;
  78. border: 2rpx solid #4FC3F7;
  79. border-radius: 40rpx;
  80. background-color: #E0F7FA;
  81. z-index: 10;
  82. }
  83. .skip-text {
  84. font-size: 28rpx;
  85. color: #00838F;
  86. }
  87. .app-info {
  88. display: flex;
  89. flex-direction: column;
  90. align-items: center;
  91. position: absolute;
  92. bottom: calc(env(safe-area-inset-bottom) + 160rpx);
  93. left: 50%;
  94. transform: translateX(-50%);
  95. }
  96. .app-icon {
  97. margin-bottom: 35rpx;
  98. }
  99. .icon-square {
  100. width: 140rpx;
  101. height: 140rpx;
  102. background-color: #4FC3F7;
  103. border-radius: 20rpx;
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. }
  108. .book-icon {
  109. position: relative;
  110. width: 90rpx;
  111. height: 70rpx;
  112. }
  113. .book-left,
  114. .book-right {
  115. position: absolute;
  116. width: 45rpx;
  117. height: 70rpx;
  118. background-color: #FFFFFF;
  119. border-radius: 3rpx 0 0 3rpx;
  120. }
  121. .book-right {
  122. right: 0;
  123. border-radius: 0 3rpx 3rpx 0;
  124. }
  125. .book-line {
  126. position: absolute;
  127. left: 45rpx;
  128. top: 8rpx;
  129. width: 2rpx;
  130. height: 54rpx;
  131. background-color: #4FC3F7;
  132. }
  133. .app-name {
  134. font-size: 44rpx;
  135. color: #000000;
  136. font-weight: 600;
  137. }
  138. </style>