You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
3.9 KiB

4 weeks ago
  1. <template>
  2. <view class="index-container">
  3. <view class="user-info" @click="jumpTo('/pages/userInfo/userInfo')">
  4. <view class="avatar" />
  5. <view>
  6. <view>李慧琳</view>
  7. <view>706宿舍</view>
  8. </view>
  9. </view>
  10. <view class="swiper1">
  11. <swiper circular autoplay interval="1000" indicator-dots indicator-color="#8f939c"
  12. indicator-active-color="#e43d33">
  13. <swiper-item>
  14. <img src="/static/bar/爱莉1.jpg" />
  15. </swiper-item>
  16. <swiper-item>
  17. <img src="/static/bar/原始黄其振.jpg" />
  18. </swiper-item>
  19. <swiper-item>
  20. <img src="/static/bar/真我光锥.jpg" />
  21. </swiper-item>
  22. </swiper>
  23. </view>
  24. <view class="layout-grid">
  25. <view class="grid-item" @click="jumpTo('/pages/payment/payment')">
  26. <view class="grid-icon icon1" />
  27. <view>缴费记录</view>
  28. </view>
  29. <view class="grid-item" @click="jumpTo('/pages/expense/expense')">
  30. <view class="grid-icon icon2" />
  31. <view>支出记录</view>
  32. </view>
  33. <view class="grid-item" @click="showTip">
  34. <view class="grid-icon icon3" />
  35. <view>宿舍信息</view>
  36. </view>
  37. <view class="grid-item" @click="showTip">
  38. <view class="grid-icon icon4" />
  39. <view>没想好写啥</view>
  40. </view>
  41. </view>
  42. <view class="stats">
  43. <view class="stats-title">费用统计</view>
  44. <view class="stats-cards">
  45. <view class="stat-card">
  46. <view class="stat-value">¥150.00</view>
  47. <view class="stat-label">本月缴费</view>
  48. </view>
  49. <view class="stat-card">
  50. <view class="stat-value">¥50.00</view>
  51. <view class="stat-label">本月支出</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script setup>
  58. import {
  59. onShow
  60. } from '@dcloudio/uni-app'
  61. const jumpTo = (url) => {
  62. uni.switchTab({
  63. url
  64. })
  65. }
  66. const showTip = () => {
  67. uni.showToast({
  68. title: '前面的功能以后再来探索吧',
  69. icon: 'none'
  70. })
  71. }
  72. onShow(() => {
  73. const isLogin = uni.getStorageSync('isLogin')
  74. console.log(isLogin)
  75. if (!isLogin) {
  76. uni.redirectTo({
  77. url: '/pages/login/login'
  78. })
  79. }
  80. })
  81. </script>
  82. <style scoped>
  83. .index-container {
  84. padding: 20rpx;
  85. height: 100vh;
  86. background-color: #f5f5f5;
  87. }
  88. .user-info {
  89. display: flex;
  90. align-items: center;
  91. background-color: #fff;
  92. border-radius: 16rpx;
  93. padding: 30rpx;
  94. margin-bottom: 30rpx;
  95. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  96. }
  97. .avatar {
  98. width: 120rpx;
  99. height: 120rpx;
  100. border-radius: 50%;
  101. background-color: red;
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. margin-right: 30rpx;
  106. }
  107. .swiper1 {
  108. width: 100vw;
  109. height: 20vh;
  110. }
  111. .layout-grid {
  112. display: grid;
  113. grid-template-columns: repeat(2, 1fr);
  114. gap: 20rpx;
  115. margin-bottom: 30rpx;
  116. }
  117. .grid-item {
  118. background-color: #fff;
  119. border-radius: 16rpx;
  120. padding: 3vh;
  121. display: flex;
  122. flex-direction: column;
  123. align-items: center;
  124. justify-content: center;
  125. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.1);
  126. }
  127. .grid-item:active {
  128. transform: scale(0.95);
  129. }
  130. .grid-icon {
  131. width: 22vw;
  132. height: 9vh;
  133. border-radius: 50%;
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. margin-bottom: 20rpx;
  138. }
  139. .icon1 {
  140. background-color: #fff0f0;
  141. }
  142. .icon2 {
  143. background-color: #f0f9ff;
  144. }
  145. .icon3 {
  146. background-color: #fff7e6;
  147. }
  148. .icon4 {
  149. background-color: #f6ffed;
  150. }
  151. .stats {
  152. background-color: #fff;
  153. border-radius: 16rpx;
  154. padding: 30rpx;
  155. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  156. }
  157. .stats-title {
  158. font-size: 30rpx;
  159. font-weight: bold;
  160. margin-bottom: 30rpx;
  161. padding-bottom: 20rpx;
  162. border-bottom: 1px solid #eee;
  163. }
  164. .stats-cards {
  165. display: flex;
  166. justify-content: space-around;
  167. }
  168. .stat-card {
  169. display: flex;
  170. flex-direction: column;
  171. align-items: center;
  172. padding: 20rpx;
  173. }
  174. .stat-value {
  175. font-size: 36rpx;
  176. font-weight: bold;
  177. color: #36bffa;
  178. margin-bottom: 10rpx;
  179. }
  180. .stat-label {
  181. font-size: 26rpx;
  182. color: #666;
  183. }
  184. </style>