s-user-card.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <!-- 装修用户组件:用户卡片 -->
  2. <template>
  3. <view class="ss-user-info-wrap ss-p-t-50">
  4. <view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
  5. <view class="left-box ss-flex ss-col-center ss-m-l-36">
  6. <view class="avatar-box ss-m-r-24">
  7. <image class="avatar-img" :src="
  8. isLogin
  9. ? sheep.$url.cdn(userInfo.avatar)
  10. : sheep.$url.static('/static/images/default_avatar.png')
  11. " mode="aspectFill" @tap="sheep.$router.go('/pages/user/info')"></image>
  12. </view>
  13. <view>
  14. <view class="nickname-box ss-flex ss-col-center">
  15. <view class="nick-name ss-m-r-20">{{ userInfo?.username || username }}</view>
  16. </view>
  17. <view class="user-name ss-m-t-5">昵称:{{ userInfo?.nickname || nickname }}</view>
  18. </view>
  19. </view>
  20. <view class="right-box ss-m-r-30">
  21. <!-- <button class="ss-reset-button" style="margin-right: 20rpx;"
  22. @tap="showAuthModal('officialAccountFirstLogin')">
  23. <text class="cicon-service-o"></text>
  24. </button> -->
  25. <button class="ss-reset-button" @tap="sheep.$router.go('/pages/user/setting')">
  26. <image src="@/static/icon/setting.png" class="audioPaly" style="width:40rpx;height:40rpx"/>
  27. </button>
  28. </view>
  29. </view>
  30. <!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
  31. <!-- <view class="bind-mobile-box ss-flex ss-row-between ss-col-center" v-if="isLogin && !userInfo.mobile">
  32. <view class="ss-flex">
  33. <text class="cicon-mobile-o" />
  34. <view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
  35. </view>
  36. <button class="ss-reset-button bind-btn" @tap="onBind">去绑定</button>
  37. </view> -->
  38. </view>
  39. </template>
  40. <script setup>
  41. /**
  42. * 用户卡片
  43. *
  44. * @property {Number} leftSpace - 容器左间距
  45. * @property {Number} rightSpace - 容器右间距
  46. *
  47. * @property {String} avatar - 头像
  48. * @property {String} username - 昵称
  49. * @property {String} nickname - 昵称
  50. * @property {String} vip - 等级
  51. * @property {String} collectNum - 收藏数
  52. * @property {String} likeNum - 点赞数
  53. *
  54. *
  55. */
  56. import {
  57. computed,
  58. reactive,
  59. } from 'vue';
  60. import sheep from '@/sheep';
  61. import {
  62. showShareModal,
  63. showAuthModal
  64. } from '@/sheep/hooks/useModal';
  65. // 用户信息
  66. const userInfo = computed(() => sheep.$store('user').userInfo);
  67. // console.log('用户信息', userInfo)
  68. // 是否登录
  69. const isLogin = computed(() => sheep.$store('user').isLogin);
  70. // 接收参数
  71. const props = defineProps({
  72. background: {
  73. type: String,
  74. default: '',
  75. },
  76. // 头像
  77. avatar: {
  78. type: String,
  79. default: '',
  80. },
  81. nickname: {
  82. type: String,
  83. default: '请登录',
  84. },
  85. username: {
  86. type: String,
  87. default: '无',
  88. },
  89. vip: {
  90. type: [String, Number],
  91. default: '1',
  92. },
  93. collectNum: {
  94. type: [String, Number],
  95. default: '1',
  96. },
  97. likeNum: {
  98. type: [String, Number],
  99. default: '1',
  100. },
  101. });
  102. function onBind() {
  103. showAuthModal('changeMobile');
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .ss-user-info-wrap {
  108. box-sizing: border-box;
  109. .avatar-box {
  110. width: 100rpx;
  111. height: 100rpx;
  112. border-radius: 50%;
  113. overflow: hidden;
  114. .avatar-img {
  115. width: 100%;
  116. height: 100%;
  117. }
  118. }
  119. .nick-name {
  120. font-size: 34rpx;
  121. font-weight: 400;
  122. color: #333333;
  123. line-height: normal;
  124. }
  125. .user-name{
  126. color: #999999;
  127. }
  128. .vip-img {
  129. width: 30rpx;
  130. height: 30rpx;
  131. }
  132. .cicon-service-o,
  133. .cicon-settings-o {
  134. font-size: 40rpx;
  135. }
  136. .right-box {
  137. display: flex;
  138. }
  139. }
  140. .bind-mobile-box {
  141. width: 100%;
  142. height: 84rpx;
  143. padding: 0 34rpx 0 44rpx;
  144. box-sizing: border-box;
  145. background: #ffffff;
  146. box-shadow: 0px -8rpx 9rpx 0px rgba(#e0e0e0, 0.3);
  147. .cicon-mobile-o {
  148. font-size: 30rpx;
  149. color: #ff690d;
  150. }
  151. .mobile-title {
  152. font-size: 24rpx;
  153. font-weight: 500;
  154. color: #ff690d;
  155. }
  156. .bind-btn {
  157. width: 100rpx;
  158. height: 50rpx;
  159. background: #ff6100;
  160. border-radius: 25rpx;
  161. font-size: 24rpx;
  162. font-weight: 500;
  163. color: #ffffff;
  164. }
  165. }
  166. </style>