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