index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="home-container h-100vh d-flex flex-col bg-base page-user-index">
  3. <image
  4. class="w-100 position-absolute"
  5. src="/static/images/mine/Banner.png"
  6. mode="widthFix"
  7. />
  8. <image
  9. class="position-absolute title"
  10. src="/static/images/mine/Title.png"
  11. mode="widthFix"
  12. />
  13. <view class="content h-100 d-flex flex-col wing-l">
  14. <view v-if="userInfo" class="user-info">
  15. <image :src="userInfo.avatar" mode="aspectFill" class="avatar"></image>
  16. <view class="info">
  17. <text class="nickname">{{ userInfo.nickname }}</text>
  18. <text class="extra"><text class="label">守护编号</text><text>{{ userInfo.id }}</text><text class="label point-label">积分</text><text>{{ userInfo.totalCheckins }}</text></text>
  19. </view>
  20. <text class="iconfont icon-arrow-right"></text>
  21. </view>
  22. <view v-else class="user-info" @click="navTo('login')">
  23. <image :src="UserHead" mode="aspectFill" class="avatar"></image>
  24. <view class="info">
  25. <text class="nickname">点击登录</text>
  26. <text class="extra"> 登录后您将获得更多权益</text>
  27. </view>
  28. <text class="iconfont icon-arrow-right"></text>
  29. </view>
  30. <view class="d-flex bg-base flex-col shadow-l radius-l">
  31. <view class="list">
  32. <view class="entry">
  33. <image src="https://mn.wenlvti.net/uploads/20250313/042236758da5aaed21c1010e5b9440ce.png" mode="aspectFill"></image><text class="label">我的好友</text><text class="iconfont icon-arrow-right"></text>
  34. </view>
  35. <view class="entry">
  36. <image src="https://mn.wenlvti.net/uploads/20250313/9fb29e8bdb66490034145c90f892773a.png" mode="aspectFill"></image><text class="label">邀请好友</text><text class="iconfont icon-arrow-right"></text>
  37. </view>
  38. <view class="entry">
  39. <image src="https://mn.wenlvti.net/uploads/20250313/1366973c061bf98594036e42c0344593.png" mode="aspectFill"></image><text class="label">积分日志</text><text class="iconfont icon-arrow-right"></text>
  40. </view>
  41. <view class="entry">
  42. <image src="https://mn.wenlvti.net/uploads/20250313/042236758da5aaed21c1010e5b9440ce.png" mode="aspectFill"></image><text class="label">我的收藏</text><text class="iconfont icon-arrow-right"></text>
  43. </view>
  44. <view class="entry">
  45. <image src="https://mn.wenlvti.net/uploads/20250313/07f750b4cf4959654c40171fdae91c3a.png" mode="aspectFill"></image><text class="label">投稿</text><view class="btn">去投稿</view><text class="iconfont icon-arrow-right"></text>
  46. </view>
  47. <view class="entry">
  48. <image src="https://mn.wenlvti.net/uploads/20250313/66d4665b1da5075e60148312469b2630.png" mode="aspectFill"></image><text class="label">我的投稿</text><text class="iconfont icon-arrow-right"></text>
  49. </view>
  50. <view class="entry">
  51. <image src="https://mn.wenlvti.net/uploads/20250313/acd97ca7b3f7736942495c7aec1dd65b.png" mode="aspectFill"></image><text class="label">加入我们</text><text class="iconfont icon-arrow-right"></text>
  52. </view>
  53. <view class="entry">
  54. <image src="https://mn.wenlvti.net/uploads/20250313/d2e9010323d098aa51e268fc32f14d3d.png" mode="aspectFill"></image><text class="label">我的预约</text><text class="iconfont icon-arrow-right"></text>
  55. </view>
  56. <view v-if="userInfo" class="entry" @click="doLogout">
  57. <image src="https://mn.wenlvti.net/uploads/20250313/cbc47d0b9cad7891e6154359952858c6.png" mode="aspectFill"></image><text class="label">退出登录</text><text class="iconfont icon-arrow-right"></text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <tabbar :current="4"></tabbar>
  63. </view>
  64. </template>
  65. <script setup lang="ts">
  66. import Tabbar from '@/common/components/tabs/tabbar.vue';
  67. import UserHead from '@/static/images/home/UserHead.png';
  68. import { confirm } from '@/common/utils/DialogAction';
  69. import { navTo } from '@/common/utils/PageAction';
  70. import { useAuthStore } from '@/store/auth';
  71. import { computed } from 'vue';
  72. const authStore = useAuthStore();
  73. const userInfo = computed(() => authStore.userInfo);
  74. function doLogout() {
  75. confirm({
  76. content: '您确定要退出登录吗?',
  77. }).then((res) => {
  78. if (res)
  79. authStore.logout();
  80. });
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .page-user-index {
  85. > .content {
  86. margin-top: 10vh;
  87. }
  88. > .title {
  89. width: 100rpx;
  90. }
  91. }
  92. .list{
  93. margin-bottom: 34rpx;
  94. .entry{
  95. border-bottom: 1rpx solid #dddddd;
  96. font-size: 28rpx;
  97. color: #333333;
  98. display: flex;
  99. align-items: center;
  100. padding: 30rpx 0;
  101. margin: 0 30rpx;
  102. image{
  103. width: 32rpx;
  104. height: 32rpx;
  105. }
  106. text.label{
  107. flex:1;
  108. margin-left: 12rpx;
  109. }
  110. &:last-child{
  111. border-bottom: none;
  112. }
  113. text.iconfont{
  114. color:#AAAAAA;
  115. font-size: 20rpx;
  116. }
  117. }
  118. }
  119. .user-info{
  120. display: flex;
  121. align-items: center;
  122. padding: 24rpx 8rpx 60rpx 8rpx;
  123. image.avatar{
  124. width: 127rpx;
  125. height: 127rpx;
  126. border-radius: 50%;
  127. margin-right: 24rpx;
  128. }
  129. .info{
  130. color:#111111;
  131. flex:1;
  132. .nickname{
  133. font-weight: bold;
  134. display: block;
  135. font-size: 36rpx;
  136. color: #333333;
  137. margin-bottom: 20rpx;
  138. }
  139. .extra{
  140. font-size: 24rpx;
  141. text{
  142. color: #333333;
  143. font-weight: 600;
  144. }
  145. text.label{
  146. display: inline-block;
  147. margin-right: 10rpx;
  148. color:#666666;
  149. &.point-label{
  150. margin-left: 24rpx;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. .btn{
  157. width: 148rpx;
  158. height: 54rpx;
  159. background: linear-gradient(0deg, #299365, rgba(41, 147, 101, 0.8));
  160. border-radius: 27rpx;
  161. font-weight: 400;
  162. font-size: 24rpx;
  163. color: #FFFFFF;
  164. line-height: 54rpx;
  165. text-align: center;
  166. margin-right: 27rpx;
  167. }
  168. </style>