my.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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-list-box">
  27. <view class="my-item" @click="$navigateTo('/pages/collect/collect')">
  28. <view class="my-icon bg1">
  29. <uni-icons custom-prefix="iconfont" type="icon-wodeshoucangshixin" color="#fff" size="20">
  30. </uni-icons>
  31. </view>
  32. <view class="item-content">
  33. 我的收藏
  34. </view>
  35. <view class="my-forward">
  36. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  37. </view>
  38. </view>
  39. <view class="my-item" @click="$navigateTo('/pages/client/client')">
  40. <view class="my-icon bg2">
  41. <uni-icons custom-prefix="iconfont" type="icon-wodekehu" color="#fff" size="20">
  42. </uni-icons>
  43. </view>
  44. <view class="item-content">
  45. 我的客户
  46. </view>
  47. <view class="my-forward">
  48. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  49. </view>
  50. </view>
  51. <view class="my-item" @click="$navigateTo('/pages/myReservation/myReservation')">
  52. <view class="my-icon bg5">
  53. <uni-icons custom-prefix="iconfont" type="icon-kefuzhongxin" color="#fff" size="24">
  54. </uni-icons>
  55. </view>
  56. <view class="item-content">
  57. 我的预约
  58. </view>
  59. <view class="my-forward">
  60. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  61. </view>
  62. </view>
  63. <view class="my-item" @click="$navigateTo('/pages/organization/organization')">
  64. <view class="my-icon bg3">
  65. <uni-icons custom-prefix="iconfont" type="icon-wodegongsi-gaoliang" color="#fff" size="22">
  66. </uni-icons>
  67. </view>
  68. <view class="item-content">
  69. 我的公司
  70. </view>
  71. <view class="my-forward">
  72. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  73. </view>
  74. </view>
  75. <view class="my-item" @click="$navigateTo('/pages/download/download')">
  76. <view class="my-icon bg4">
  77. <uni-icons custom-prefix="iconfont" type="icon-wodexiazaizhongxin" color="#fff" size="18">
  78. </uni-icons>
  79. </view>
  80. <view class="item-content">
  81. 我的下载
  82. </view>
  83. <view class="my-forward">
  84. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. getMyCount
  95. } from '@/request/api/my.js'
  96. export default {
  97. data() {
  98. return {
  99. fansCount: {
  100. attentionCount: 0,
  101. fansCount: 0,
  102. roomCount: 0
  103. },
  104. user: {}
  105. }
  106. },
  107. onShow() {
  108. if (!uni.getStorageSync('token')) {
  109. this.user = {};
  110. this.fansCount = {
  111. attentionCount: 0,
  112. fansCount: 0,
  113. roomCount: 0
  114. }
  115. } else {
  116. this.user = this.$store.getters.user;
  117. this.user.organizedName = this.$store.getters.organization && this.$store.getters.organization.name;
  118. this.init();
  119. }
  120. },
  121. methods: {
  122. init() {
  123. getMyCount().then(res => {
  124. if (res.code === 200) {
  125. this.fansCount = res.data;
  126. }
  127. })
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .my-box {
  134. height: 100vh;
  135. background: #fff;
  136. overflow-y: auto;
  137. .my-content {
  138. display: flex;
  139. flex-direction: column;
  140. align-items: center;
  141. padding-bottom: 80rpx;
  142. }
  143. .my-top {
  144. height: 260rpx;
  145. 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');
  146. background-position: center center;
  147. background-size: cover;
  148. background-repeat: no-repeat;
  149. width: 100%;
  150. }
  151. .my-avatar {
  152. width: 200rpx;
  153. height: 200rpx;
  154. border-radius: 50%;
  155. margin-top: -100rpx;
  156. border: 6rpx solid #fff;
  157. background: #eee;
  158. }
  159. .name {
  160. font-size: 20px;
  161. font-weight: 700;
  162. margin: 10rpx 0;
  163. }
  164. .organization {
  165. color: $uni-secondary-color;
  166. font-weight: 300;
  167. }
  168. .my-tab {
  169. width: 100%;
  170. padding: 0 30rpx;
  171. box-sizing: border-box;
  172. margin: 40rpx 0;
  173. .tab-box {
  174. height: 160rpx;
  175. border-radius: 24rpx;
  176. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  177. display: flex;
  178. align-items: center;
  179. }
  180. .tab-item {
  181. flex: 1;
  182. text-align: center;
  183. }
  184. .tab-number {
  185. font-size: 40rpx;
  186. font-weight: 600;
  187. }
  188. .tab-text {
  189. font-size: 24rpx;
  190. font-weight: 300;
  191. margin-top: 10rpx;
  192. }
  193. }
  194. .my-list {
  195. width: 100%;
  196. padding: 0 30rpx;
  197. box-sizing: border-box;
  198. .my-list-box {
  199. border-radius: 24rpx;
  200. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  201. overflow: hidden;
  202. }
  203. .my-item {
  204. display: flex;
  205. align-items: center;
  206. padding: 20rpx 30rpx;
  207. }
  208. .my-item:active {
  209. background: $uni-background-color;
  210. }
  211. .my-icon {
  212. width: 80rpx;
  213. height: 80rpx;
  214. border-radius: 16rpx;
  215. display: flex;
  216. align-items: center;
  217. justify-content: center;
  218. margin-right: 20rpx;
  219. background: #c1c0c8;
  220. &.bg1 {
  221. background: #88d498;
  222. }
  223. &.bg2 {
  224. background: #ffb997;
  225. }
  226. &.bg3 {
  227. background: #7ad9ff;
  228. }
  229. &.bg4 {
  230. background: #9ac0cd;
  231. }
  232. &.bg5 {
  233. background: #40e0d0;
  234. }
  235. }
  236. .my-forward {
  237. height: 40rpx;
  238. }
  239. .item-content {
  240. flex: 1;
  241. width: 0;
  242. overflow: hidden;
  243. font-weight: 700;
  244. }
  245. }
  246. }
  247. </style>