index.vue 5.4 KB

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