index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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="https://mncdn.wenlvti.net/app_static/minnan/images/mine/Banner.png"
  6. mode="widthFix"
  7. />
  8. <image
  9. class="position-absolute title"
  10. src="https://mncdn.wenlvti.net/app_static/minnan/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://mncdn.wenlvti.net/uploads/20250313/042236758da5aaed21c1010e5b9440ce.png" mode="aspectFill"></image>
  34. <text class="label">我的好友</text>
  35. <text class="iconfont icon-arrow-right"></text>
  36. </view>
  37. <view class="entry">
  38. <image src="https://mncdn.wenlvti.net/uploads/20250313/9fb29e8bdb66490034145c90f892773a.png" mode="aspectFill"></image>
  39. <text class="label">邀请好友</text>
  40. <text class="iconfont icon-arrow-right"></text>
  41. </view>
  42. <view class="entry">
  43. <image src="https://mncdn.wenlvti.net/uploads/20250313/1366973c061bf98594036e42c0344593.png" mode="aspectFill"></image>
  44. <text class="label">积分日志</text>
  45. <text class="iconfont icon-arrow-right"></text>
  46. </view>
  47. <view class="entry">
  48. <image src="https://mncdn.wenlvti.net/uploads/20250313/042236758da5aaed21c1010e5b9440ce.png" mode="aspectFill"></image>
  49. <text class="label">我的收藏</text>
  50. <text class="iconfont icon-arrow-right"></text>
  51. </view> -->
  52. <view class="entry" @click="goContribute">
  53. <image src="https://mncdn.wenlvti.net/uploads/20250313/07f750b4cf4959654c40171fdae91c3a.png" mode="aspectFill"></image>
  54. <text class="label">投稿</text>
  55. <view class="btn">去投稿</view><text class="iconfont icon-arrow-right"></text>
  56. </view>
  57. <view class="entry" @click="goContributeList">
  58. <image src="https://mncdn.wenlvti.net/uploads/20250313/66d4665b1da5075e60148312469b2630.png" mode="aspectFill"></image>
  59. <text class="label">我的投稿</text>
  60. <text class="iconfont icon-arrow-right"></text>
  61. </view>
  62. <!-- <view class="entry">
  63. <image src="https://mncdn.wenlvti.net/uploads/20250313/acd97ca7b3f7736942495c7aec1dd65b.png" mode="aspectFill"></image>
  64. <text class="label">加入我们</text>
  65. <text class="iconfont icon-arrow-right"></text>
  66. </view>
  67. <view class="entry">
  68. <image src="https://mncdn.wenlvti.net/uploads/20250313/d2e9010323d098aa51e268fc32f14d3d.png" mode="aspectFill"></image>
  69. <text class="label">我的预约</text>
  70. <text class="iconfont icon-arrow-right"></text>
  71. </view> -->
  72. <view class="entry" @click="showService">
  73. <image src="https://mncdn.wenlvti.net/uploads/20250313/d2e9010323d098aa51e268fc32f14d3d.png" mode="aspectFill"></image>
  74. <text class="label">在线客服</text>
  75. <text class="iconfont icon-arrow-right"></text>
  76. </view>
  77. <view v-if="userInfo" class="entry" @click="doLogout">
  78. <image src="https://mncdn.wenlvti.net/uploads/20250313/cbc47d0b9cad7891e6154359952858c6.png" mode="aspectFill"></image>
  79. <text class="label">退出登录</text>
  80. <text class="iconfont icon-arrow-right"></text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <tabbar :current="4"></tabbar>
  86. </view>
  87. </template>
  88. <script setup lang="ts">
  89. import Tabbar from '@/common/components/tabs/tabbar.vue';
  90. import { confirm } from '@/common/utils/DialogAction';
  91. import { navTo } from '@/common/utils/PageAction';
  92. import { useAuthStore } from '@/store/auth';
  93. import { computed } from 'vue';
  94. import { useReqireLogin } from '@/common/composeabe/RequireLogin';
  95. const UserHead = 'https://mncdn.wenlvti.net/app_static/minnan/images/home/UserHead.png';
  96. const authStore = useAuthStore();
  97. const userInfo = computed(() => authStore.userInfo);
  98. const { requireLogin } = useReqireLogin();
  99. function doLogout() {
  100. confirm({
  101. content: '您确定要退出登录吗?',
  102. }).then((res) => {
  103. if (res)
  104. authStore.logout();
  105. });
  106. }
  107. function goContributeList() {
  108. requireLogin(() => navTo('contribute/list'), '登录后才能投稿哦!');
  109. }
  110. function goContribute() {
  111. requireLogin(() => navTo('contribute/submit'), '登录后才能投稿哦!');
  112. }
  113. function showService() {
  114. uni.showModal({
  115. title: '联系客服',
  116. content: '联系电话:18888888888',
  117. });
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .page-user-index {
  122. > .content {
  123. margin-top: 10vh;
  124. }
  125. > .title {
  126. width: 100rpx;
  127. }
  128. }
  129. .list{
  130. margin-bottom: 34rpx;
  131. .entry{
  132. border-bottom: 1rpx solid #dddddd;
  133. font-size: 28rpx;
  134. color: #333333;
  135. display: flex;
  136. align-items: center;
  137. padding: 30rpx 0;
  138. margin: 0 30rpx;
  139. image{
  140. width: 32rpx;
  141. height: 32rpx;
  142. }
  143. text.label{
  144. flex:1;
  145. margin-left: 12rpx;
  146. }
  147. &:last-child{
  148. border-bottom: none;
  149. }
  150. text.iconfont{
  151. color:#AAAAAA;
  152. font-size: 20rpx;
  153. }
  154. }
  155. }
  156. .user-info{
  157. display: flex;
  158. align-items: center;
  159. padding: 24rpx 8rpx 60rpx 8rpx;
  160. image.avatar{
  161. width: 127rpx;
  162. height: 127rpx;
  163. border-radius: 50%;
  164. margin-right: 24rpx;
  165. }
  166. .info{
  167. color:#111111;
  168. flex:1;
  169. .nickname{
  170. font-weight: bold;
  171. display: block;
  172. font-size: 36rpx;
  173. color: #333333;
  174. margin-bottom: 20rpx;
  175. }
  176. .extra{
  177. font-size: 24rpx;
  178. text{
  179. color: #333333;
  180. font-weight: 600;
  181. }
  182. text.label{
  183. display: inline-block;
  184. margin-right: 10rpx;
  185. color:#666666;
  186. &.point-label{
  187. margin-left: 24rpx;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. .btn{
  194. width: 148rpx;
  195. height: 54rpx;
  196. background: linear-gradient(0deg, #299365, rgba(41, 147, 101, 0.8));
  197. border-radius: 27rpx;
  198. font-weight: 400;
  199. font-size: 24rpx;
  200. color: #FFFFFF;
  201. line-height: 54rpx;
  202. text-align: center;
  203. margin-right: 27rpx;
  204. }
  205. </style>