my.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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('/pageMy/myDetail/myDetail')" :src="user.portrait"
  6. mode="aspectFill"></image>
  7. <view class="name" @click="$navigateTo('/pageMy/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('/pageMy/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('/pageMy/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('/pageMy/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('/pageMy/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('/pageMy/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('/pageMy/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('/pageMy/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('/pageMy/dataCenter/dataCenter')">
  76. <view class="my-icon bg4">
  77. <uni-icons custom-prefix="iconfont" type="icon-wenjian" color="#fff" size="20">
  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 class="my-item" @click="$navigateTo('/pageMy/download/download')">
  88. <view class="my-icon bg5">
  89. <uni-icons custom-prefix="iconfont" type="icon-wodexiazaizhongxin" color="#fff" size="18">
  90. </uni-icons>
  91. </view>
  92. <view class="item-content">
  93. 我的下载
  94. </view>
  95. <view class="my-forward">
  96. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import {
  106. getMyCount,
  107. getUserInfoById
  108. } from '@/request/api/my.js'
  109. export default {
  110. data() {
  111. return {
  112. fansCount: {
  113. attentionCount: 0,
  114. fansCount: 0,
  115. roomCount: 0
  116. },
  117. user: {}
  118. }
  119. },
  120. onShow() {
  121. if (!uni.getStorageSync('token')) {
  122. this.user = {};
  123. this.fansCount = {
  124. attentionCount: 0,
  125. fansCount: 0,
  126. roomCount: 0
  127. }
  128. } else {
  129. this.user = this.$store.getters.user;
  130. this.user.organizedName = this.$store.getters.organization && this.$store.getters.organization.name;
  131. this.init();
  132. }
  133. },
  134. methods: {
  135. init() {
  136. getMyCount().then(res => {
  137. if (res.code === 200) {
  138. this.fansCount = res.data;
  139. }
  140. })
  141. getUserInfoById(this.user.userId).then(res => {
  142. if (res.code === 200) {
  143. this.user = res.data;
  144. this.user['userName'] = res.data.name;
  145. this.user['userId'] = res.data.id;
  146. this.user.organizedName = res.data.mgrOrganization && res.data.mgrOrganization.name;
  147. this.$store.dispatch('app/changeUser', res.data);
  148. }
  149. })
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .my-box {
  156. height: 100vh;
  157. background: #fff;
  158. overflow-y: auto;
  159. .my-content {
  160. display: flex;
  161. flex-direction: column;
  162. align-items: center;
  163. padding-bottom: 80rpx;
  164. }
  165. .my-top {
  166. height: 260rpx;
  167. 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');
  168. background-position: center center;
  169. background-size: cover;
  170. background-repeat: no-repeat;
  171. width: 100%;
  172. }
  173. .my-avatar {
  174. width: 200rpx;
  175. height: 200rpx;
  176. border-radius: 50%;
  177. margin-top: -100rpx;
  178. border: 6rpx solid #fff;
  179. background: #eee;
  180. }
  181. .name {
  182. font-size: 20px;
  183. font-weight: 700;
  184. margin: 10rpx 0;
  185. }
  186. .organization {
  187. color: $uni-secondary-color;
  188. font-weight: 300;
  189. }
  190. .my-tab {
  191. width: 100%;
  192. padding: 0 30rpx;
  193. box-sizing: border-box;
  194. margin: 40rpx 0;
  195. .tab-box {
  196. height: 160rpx;
  197. border-radius: 24rpx;
  198. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  199. display: flex;
  200. align-items: center;
  201. }
  202. .tab-item {
  203. flex: 1;
  204. text-align: center;
  205. }
  206. .tab-number {
  207. font-size: 40rpx;
  208. font-weight: 600;
  209. }
  210. .tab-text {
  211. font-size: 24rpx;
  212. font-weight: 300;
  213. margin-top: 10rpx;
  214. }
  215. }
  216. .my-list {
  217. width: 100%;
  218. padding: 0 30rpx;
  219. box-sizing: border-box;
  220. .my-list-box {
  221. border-radius: 24rpx;
  222. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  223. overflow: hidden;
  224. }
  225. .my-item {
  226. display: flex;
  227. align-items: center;
  228. padding: 20rpx 30rpx;
  229. }
  230. .my-item:active {
  231. background: $uni-background-color;
  232. }
  233. .my-icon {
  234. width: 80rpx;
  235. height: 80rpx;
  236. border-radius: 16rpx;
  237. display: flex;
  238. align-items: center;
  239. justify-content: center;
  240. margin-right: 20rpx;
  241. background: #c1c0c8;
  242. &.bg1 {
  243. background: #88d498;
  244. }
  245. &.bg2 {
  246. background: #ffb997;
  247. }
  248. &.bg3 {
  249. background: #7ad9ff;
  250. }
  251. &.bg4 {
  252. background: #9ac0cd;
  253. }
  254. &.bg5 {
  255. background: #40e0d0;
  256. }
  257. }
  258. .my-forward {
  259. height: 40rpx;
  260. }
  261. .item-content {
  262. flex: 1;
  263. width: 0;
  264. overflow: hidden;
  265. font-weight: 700;
  266. }
  267. }
  268. }
  269. </style>