my.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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">
  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">
  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>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. getMyCount
  77. } from '@/request/api/my.js'
  78. export default {
  79. data() {
  80. return {
  81. fansCount: {
  82. attentionCount: 0,
  83. fansCount: 0,
  84. roomCount: 0
  85. },
  86. user: {}
  87. }
  88. },
  89. onShow() {
  90. if (!uni.getStorageSync('token')) {
  91. this.user = {};
  92. this.fansCount = {
  93. attentionCount: 0,
  94. fansCount: 0,
  95. roomCount: 0
  96. }
  97. } else {
  98. this.user = this.$store.getters.user;
  99. this.user.organizedName = this.$store.getters.organization.name;
  100. this.init();
  101. }
  102. },
  103. methods: {
  104. init() {
  105. getMyCount().then(res => {
  106. if (res.code === 200) {
  107. this.fansCount = res.data;
  108. }
  109. })
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. .my-box {
  116. height: 100vh;
  117. background: #fff;
  118. overflow-y: auto;
  119. .my-content {
  120. display: flex;
  121. flex-direction: column;
  122. align-items: center;
  123. padding-bottom: 80rpx;
  124. }
  125. .my-top {
  126. height: 260rpx;
  127. 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');
  128. background-position: center center;
  129. background-size: cover;
  130. background-repeat: no-repeat;
  131. width: 100%;
  132. }
  133. .my-avatar {
  134. width: 200rpx;
  135. height: 200rpx;
  136. border-radius: 50%;
  137. margin-top: -100rpx;
  138. border: 6rpx solid #fff;
  139. background: #eee;
  140. }
  141. .name {
  142. font-size: 20px;
  143. font-weight: 700;
  144. margin: 10rpx 0;
  145. }
  146. .organization {
  147. color: $uni-secondary-color;
  148. font-weight: 300;
  149. }
  150. .my-tab {
  151. width: 100%;
  152. padding: 0 30rpx;
  153. box-sizing: border-box;
  154. margin: 40rpx 0;
  155. .tab-box {
  156. height: 160rpx;
  157. border-radius: 24rpx;
  158. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  159. display: flex;
  160. align-items: center;
  161. }
  162. .tab-item {
  163. flex: 1;
  164. text-align: center;
  165. }
  166. .tab-number {
  167. font-size: 40rpx;
  168. font-weight: 600;
  169. }
  170. .tab-text {
  171. font-size: 24rpx;
  172. font-weight: 300;
  173. margin-top: 10rpx;
  174. }
  175. }
  176. .my-list {
  177. width: 100%;
  178. padding: 0 30rpx;
  179. box-sizing: border-box;
  180. .my-item {
  181. display: flex;
  182. align-items: center;
  183. border-bottom: 2rpx solid $uni-border-1;
  184. padding: 20rpx 0;
  185. }
  186. .my-item:first-child {
  187. border-top: 2rpx solid $uni-border-1;
  188. }
  189. .my-icon {
  190. width: 80rpx;
  191. height: 80rpx;
  192. border-radius: 50%;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. margin-right: 20rpx;
  197. background: #c1c0c8;
  198. }
  199. .my-forward {
  200. height: 40rpx;
  201. }
  202. .item-content {
  203. flex: 1;
  204. width: 0;
  205. overflow: hidden;
  206. font-weight: 700;
  207. }
  208. }
  209. }
  210. </style>