index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="main" style="padding-bottom:50rpx;">
  3. <view v-if="userInfo" class="user-info" @click="navTo('/pages/user/update/profile')">
  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('/pages/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" @click="navTo('/pages/dig/index')">
  32. <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>
  33. </view>
  34. </view> -->
  35. <!-- <view class="list">
  36. <view class="entry">
  37. <image src="https://mn.wenlvti.net/uploads/20250313/66d4665b1da5075e60148312469b2630.png" mode="aspectFill"></image><text class="label">我的投稿</text><text class="iconfont icon-arrow-right"></text>
  38. </view>
  39. <view class="entry">
  40. <image src="https://mn.wenlvti.net/uploads/20250313/acd97ca7b3f7736942495c7aec1dd65b.png" mode="aspectFill"></image><text class="label">加入我们</text><text class="iconfont icon-arrow-right"></text>
  41. </view>
  42. </view> -->
  43. <view v-if="userInfo" class="list">
  44. <view class="entry" @click="doLogout">
  45. <image src="https://mn.wenlvti.net/uploads/20250313/cbc47d0b9cad7891e6154359952858c6.png" mode="aspectFill"></image><text class="label">退出登录</text><text class="iconfont icon-arrow-right"></text>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script setup lang="ts">
  51. import { confirm } from '@imengyu/imengyu-utils/dist/uniapp/DialogAction';
  52. import { navTo } from '@imengyu/imengyu-utils/dist/uniapp/PageAction';
  53. import { useAuthStore } from '@/store/auth';
  54. import { computed } from 'vue';
  55. import UserHead from '@/static/images/home/UserHead.png';
  56. const authStore = useAuthStore();
  57. const userInfo = computed(() => authStore.userInfo);
  58. function doLogout() {
  59. confirm({
  60. content: '您确定要退出登录吗?',
  61. }).then((res) => {
  62. if (res)
  63. authStore.logout();
  64. });
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .list{
  69. background: #FFFFFF;
  70. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(125,125,125,0.21);
  71. border-radius: 20rpx;
  72. margin-bottom: 34rpx;
  73. .entry{
  74. border-bottom: 1rpx solid #dddddd;
  75. font-size: 28rpx;
  76. color: #333333;
  77. display: flex;
  78. align-items: center;
  79. padding: 30rpx 0;
  80. margin: 0 30rpx;
  81. image{
  82. width: 32rpx;
  83. height: 32rpx;
  84. }
  85. text.label{
  86. flex:1;
  87. margin-left: 12rpx;
  88. }
  89. &:last-child{
  90. border-bottom: none;
  91. }
  92. text.iconfont{
  93. color:#AAAAAA;
  94. font-size: 20rpx;
  95. }
  96. }
  97. }
  98. .user-info{
  99. display: flex;
  100. align-items: center;
  101. padding: 24rpx 8rpx 60rpx 8rpx;
  102. image.avatar{
  103. width: 127rpx;
  104. height: 127rpx;
  105. border-radius: 50%;
  106. margin-right: 24rpx;
  107. }
  108. .info{
  109. color:#111111;
  110. flex:1;
  111. .nickname{
  112. font-weight: bold;
  113. display: block;
  114. font-size: 36rpx;
  115. color: #333333;
  116. margin-bottom: 20rpx;
  117. }
  118. .extra{
  119. font-size: 24rpx;
  120. text{
  121. color: #333333;
  122. font-weight: 600;
  123. }
  124. text.label{
  125. display: inline-block;
  126. margin-right: 10rpx;
  127. color:#666666;
  128. &.point-label{
  129. margin-left: 24rpx;
  130. }
  131. }
  132. }
  133. }
  134. }
  135. .btn{
  136. width: 148rpx;
  137. height: 54rpx;
  138. background: linear-gradient(0deg, #299365, rgba(41, 147, 101, 0.8));
  139. border-radius: 27rpx;
  140. font-weight: 400;
  141. font-size: 24rpx;
  142. color: #FFFFFF;
  143. line-height: 54rpx;
  144. text-align: center;
  145. margin-right: 27rpx;
  146. }
  147. </style>