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.

186 lines
3.4 KiB

4 weeks ago
  1. <template>
  2. <view class="userinfo-container">
  3. <view class="top-bar">
  4. <view class="title">个人信息</view>
  5. </view>
  6. <view class="avatar-all">
  7. <view class="avatar" />
  8. <view class="name">李慧琳</view>
  9. <view class="room">706宿舍</view>
  10. </view>
  11. <view class="info-list">
  12. <view class="info-item">
  13. <view class="info-label">学号</view>
  14. <view class="info-value">20030229</view>
  15. </view>
  16. <view class="info-item">
  17. <view class="info-label">性别</view>
  18. <view class="info-value"></view>
  19. </view>
  20. <view class="info-item">
  21. <view class="info-label">联系电话</view>
  22. <view class="info-value">159****5202</view>
  23. </view>
  24. <view class="info-item">
  25. <view class="info-label">入住日期</view>
  26. <view class="info-value">2025-07-06</view>
  27. </view>
  28. <view class="info-item">
  29. <view class="info-label">住宿状态</view>
  30. <view class="info-value">
  31. <text class="status-in">在宿</text>
  32. </view>
  33. </view>
  34. <view class="info-item">
  35. <view class="info-label">宿舍地址</view>
  36. <view class="info-value">706</view>
  37. </view>
  38. <view class="info-item">
  39. <view class="info-label">宿舍人数</view>
  40. <view class="info-value">5&nbsp;/&nbsp;12</view>
  41. </view>
  42. </view>
  43. <button class="logout-btn" @click="handleLogout">
  44. <text>退出登录</text>
  45. </button>
  46. </view>
  47. </template>
  48. <script setup>
  49. import { onShow } from '@dcloudio/uni-app'
  50. const handleLogout = () => {
  51. uni.showModal({
  52. title: '提示',
  53. content: '确定要退出登录吗?',
  54. success: (res) => {
  55. if (res.confirm) {
  56. uni.removeStorageSync('isLogin')
  57. uni.redirectTo({
  58. url: '/pages/login/login'
  59. })
  60. }
  61. }
  62. })
  63. }
  64. onShow(() => {
  65. const isLogin = uni.getStorageSync('isLogin')
  66. console.log(isLogin)
  67. if (!isLogin) {
  68. uni.redirectTo({
  69. url: '/pages/login/login'
  70. })
  71. }
  72. })
  73. </script>
  74. <style scoped>
  75. .userinfo-container {
  76. background-color: #f5f5f5;
  77. height: 100vh;
  78. }
  79. .top-bar {
  80. display: flex;
  81. align-items: center;
  82. padding: 30rpx 20rpx;
  83. background-color: #fff;
  84. border-bottom: 1px solid #eee;
  85. }
  86. .title {
  87. width: 100vw;
  88. text-align: center;
  89. font-size: 34rpx;
  90. font-weight: bold;
  91. }
  92. .avatar-all {
  93. display: flex;
  94. flex-direction: column;
  95. align-items: center;
  96. padding: 60rpx 0;
  97. background-color: #fff;
  98. margin-bottom: 20rpx;
  99. }
  100. .avatar {
  101. width: 180rpx;
  102. height: 180rpx;
  103. border-radius: 50%;
  104. background-color: #e6f7ff;
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. margin-bottom: 30rpx;
  109. }
  110. .name {
  111. font-size: 36rpx;
  112. font-weight: bold;
  113. color: #333;
  114. margin-bottom: 15rpx;
  115. }
  116. .room {
  117. font-size: 28rpx;
  118. color: #666;
  119. background-color: #f0f9ff;
  120. padding: 8rpx 20rpx;
  121. border-radius: 20rpx;
  122. }
  123. .info-list {
  124. background-color: #fff;
  125. padding: 0 20rpx;
  126. }
  127. .info-item {
  128. display: flex;
  129. align-items: center;
  130. padding: 30rpx;
  131. border-bottom: 1px solid #eee;
  132. }
  133. .info-label {
  134. font-size: 30rpx;
  135. color: #666;
  136. }
  137. .info-value {
  138. flex: 1;
  139. font-size: 30rpx;
  140. text-align: right;
  141. }
  142. .status-in {
  143. padding: 5rpx 20rpx;
  144. border-radius: 20rpx;
  145. font-size: 26rpx;
  146. background-color: #e6fffb;
  147. color: #00b42a;
  148. }
  149. .logout-btn {
  150. display: flex;
  151. align-items: center;
  152. justify-content: center;
  153. width: 40vw;
  154. height: 4vh;
  155. background-color: #36bffa;
  156. color: #fff;
  157. border-radius: 40rpx;
  158. font-size: 30rpx;
  159. margin-top:5vh;
  160. }
  161. </style>