my.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view class="my-box">
  3. <view class="my-content">
  4. <view class="my-top"></view>
  5. <image class="my-avatar" @click="$navigateTo('/pages/myDetail/myDetail')" :src="user.portrait"
  6. mode="aspectFill"></image>
  7. <view class="name" @click="$navigateTo('/pages/myDetail/myDetail')">{{user.userName || '登录/注册'}}</view>
  8. <view class="organization" v-if="user.organizedName">{{user.organizedName}}</view>
  9. <view class="my-tab">
  10. <view class="tab-box">
  11. <view class="tab-item" @click="$navigateTo('/pages/myHouse/myHouse')">
  12. <view class="tab-number">{{fansCount.roomCount}}</view>
  13. <view class="tab-text">房源</view>
  14. </view>
  15. <view class="tab-item" @click="$navigateTo('/pages/fans/fans')">
  16. <view class="tab-number">{{fansCount.fansCount}}</view>
  17. <view class="tab-text">粉丝</view>
  18. </view>
  19. <view class="tab-item" @click="$navigateTo('/pages/attention/attention')">
  20. <view class="tab-number">{{fansCount.attentionCount}}</view>
  21. <view class="tab-text">关注</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="my-list">
  26. <view class="my-item" @click="$navigateTo('/pages/collect/collect')">
  27. <view class="my-icon">
  28. <uni-icons type="staff-filled" color="#fff" size="24"></uni-icons>
  29. </view>
  30. <view class="item-content">
  31. 我的收藏
  32. </view>
  33. <view class="my-forward">
  34. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  35. </view>
  36. </view>
  37. <view class="my-item" @click="$navigateTo('/pages/client/client')">
  38. <view class="my-icon">
  39. <uni-icons type="staff-filled" color="#fff" size="24"></uni-icons>
  40. </view>
  41. <view class="item-content">
  42. 我的客户
  43. </view>
  44. <view class="my-forward">
  45. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  46. </view>
  47. </view>
  48. <view class="my-item">
  49. <view class="my-icon">
  50. <uni-icons type="staff-filled" color="#fff" size="24"></uni-icons>
  51. </view>
  52. <view class="item-content">
  53. 我的公司
  54. </view>
  55. <view class="my-forward">
  56. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  57. </view>
  58. </view>
  59. <view class="my-item">
  60. <view class="my-icon">
  61. <uni-icons type="staff-filled" color="#fff" size="24"></uni-icons>
  62. </view>
  63. <view class="item-content">
  64. 我的下载
  65. </view>
  66. <view class="my-forward">
  67. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  68. </view>
  69. </view>
  70. <view class="my-item">
  71. <view class="my-icon">
  72. <uni-icons type="staff-filled" color="#fff" size="24"></uni-icons>
  73. </view>
  74. <view class="item-content">
  75. 客服中心
  76. </view>
  77. <view class="my-forward">
  78. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. getMyCount
  88. } from '@/request/api/my.js'
  89. export default {
  90. data() {
  91. return {
  92. fansCount: {
  93. attentionCount: 0,
  94. fansCount: 0,
  95. roomCount: 0
  96. },
  97. user: {}
  98. }
  99. },
  100. onShow() {
  101. if (!uni.getStorageSync('token')) {
  102. this.user = {};
  103. this.fansCount = {
  104. attentionCount: 0,
  105. fansCount: 0,
  106. roomCount: 0
  107. }
  108. } else {
  109. this.user = this.$store.getters.user;
  110. this.user.organizedName = this.$store.getters.organization.name;
  111. this.init();
  112. }
  113. },
  114. methods: {
  115. init() {
  116. getMyCount().then(res => {
  117. if (res.code === 200) {
  118. this.fansCount = res.data;
  119. }
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss">
  126. .my-box {
  127. height: 100vh;
  128. background: #fff;
  129. overflow-y: auto;
  130. .my-content {
  131. display: flex;
  132. flex-direction: column;
  133. align-items: center;
  134. padding-bottom: 80rpx;
  135. }
  136. .my-top {
  137. height: 260rpx;
  138. background-image: url('https://images.unsplash.com/photo-1558591710-4b4a1ae0f04d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyMDUzMDJ8MHwxfHNlYXJjaHw1fHxhYnN0cmFjdHxlbnwxfHx8fDE2NTI4OTYzNTU&ixlib=rb-1.2.1&q=80&w=1080');
  139. background-position: center center;
  140. background-size: cover;
  141. background-repeat: no-repeat;
  142. width: 100%;
  143. }
  144. .my-avatar {
  145. width: 200rpx;
  146. height: 200rpx;
  147. border-radius: 50%;
  148. margin-top: -100rpx;
  149. border: 6rpx solid #fff;
  150. background: #eee;
  151. }
  152. .name {
  153. font-size: 20px;
  154. font-weight: 700;
  155. margin: 10rpx 0;
  156. }
  157. .organization {
  158. color: $uni-secondary-color;
  159. font-weight: 300;
  160. }
  161. .my-tab {
  162. width: 100%;
  163. padding: 0 30rpx;
  164. box-sizing: border-box;
  165. margin: 40rpx 0;
  166. .tab-box {
  167. height: 160rpx;
  168. border-radius: 24rpx;
  169. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  170. display: flex;
  171. align-items: center;
  172. }
  173. .tab-item {
  174. flex: 1;
  175. text-align: center;
  176. }
  177. .tab-number {
  178. font-size: 40rpx;
  179. font-weight: 600;
  180. }
  181. .tab-text {
  182. font-size: 24rpx;
  183. font-weight: 300;
  184. margin-top: 10rpx;
  185. }
  186. }
  187. .my-list {
  188. width: 100%;
  189. padding: 0 30rpx;
  190. box-sizing: border-box;
  191. .my-item {
  192. display: flex;
  193. align-items: center;
  194. border-bottom: 2rpx solid $uni-border-1;
  195. padding: 20rpx 0;
  196. }
  197. .my-item:first-child {
  198. border-top: 2rpx solid $uni-border-1;
  199. }
  200. .my-icon {
  201. width: 80rpx;
  202. height: 80rpx;
  203. border-radius: 50%;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. margin-right: 20rpx;
  208. background: #c1c0c8;
  209. }
  210. .my-forward {
  211. height: 40rpx;
  212. }
  213. .item-content {
  214. flex: 1;
  215. width: 0;
  216. overflow: hidden;
  217. font-weight: 700;
  218. }
  219. }
  220. }
  221. </style>