my.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="my-box">
  3. <view class="my-content">
  4. <view class="my-top"></view>
  5. <image class="my-avatar" @tap="detail" :src="user.portrait" mode="aspectFill"></image>
  6. <view class="name" @click="$navigateTo('/pageMy/myDetail/myDetail')">{{user.userName || '登录/注册'}}</view>
  7. <view class="organization" v-if="user.organizedName">{{user.organizedName}}</view>
  8. <view class="my-list">
  9. <view class="my-list-box">
  10. <view class="my-item" @click="$navigateTo('/pageMy/organization/organization')">
  11. <view class="my-icon bg3">
  12. <uni-icons custom-prefix="iconfont" type="icon-wodegongsi-gaoliang" color="#fff" size="22">
  13. </uni-icons>
  14. </view>
  15. <view class="item-content">
  16. 我的公司
  17. </view>
  18. <view class="my-forward">
  19. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  20. </view>
  21. </view>
  22. <view class="my-item" @click="$navigateTo('/pageMy/download/download')">
  23. <view class="my-icon bg5">
  24. <uni-icons custom-prefix="iconfont" type="icon-wodexiazaizhongxin" color="#fff" size="18">
  25. </uni-icons>
  26. </view>
  27. <view class="item-content">
  28. 我的下载
  29. </view>
  30. <view class="my-forward">
  31. <uni-icons type="forward" size="18" color="#c1c0c8"></uni-icons>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. fansCount: {
  44. attentionCount: 0,
  45. fansCount: 0,
  46. roomCount: 0
  47. },
  48. user: {}
  49. }
  50. },
  51. onShow() {
  52. if (!uni.getStorageSync('token')) {
  53. this.user = {};
  54. this.fansCount = {
  55. attentionCount: 0,
  56. fansCount: 0,
  57. roomCount: 0
  58. }
  59. } else {
  60. this.user = this.$store.getters.user;
  61. this.user.organizedName = this.$store.getters.organization && this.$store.getters.organization.name;
  62. }
  63. },
  64. methods: {
  65. init() {
  66. getMyCount().then(res => {
  67. if (res.code === 200) {
  68. this.fansCount = res.data;
  69. }
  70. })
  71. getUserInfoById(this.user.userId).then(res => {
  72. if (res.code === 200) {
  73. this.user = res.data;
  74. this.user['userName'] = res.data.name;
  75. this.user['userId'] = res.data.id;
  76. this.user.organizedName = res.data.mgrOrganization && res.data.mgrOrganization.name;
  77. this.$store.dispatch('app/changeUser', res.data);
  78. }
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .my-box {
  86. height: 100vh;
  87. background: #fff;
  88. overflow-y: auto;
  89. .my-content {
  90. display: flex;
  91. flex-direction: column;
  92. align-items: center;
  93. padding-bottom: 80rpx;
  94. }
  95. .my-top {
  96. height: 260rpx;
  97. 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');
  98. background-position: center center;
  99. background-size: cover;
  100. background-repeat: no-repeat;
  101. width: 100%;
  102. }
  103. .my-avatar {
  104. width: 200rpx;
  105. height: 200rpx;
  106. border-radius: 50%;
  107. margin-top: -100rpx;
  108. border: 6rpx solid #fff;
  109. background: #eee;
  110. }
  111. .name {
  112. font-size: 20px;
  113. font-weight: 700;
  114. margin: 10rpx 0;
  115. }
  116. .organization {
  117. font-weight: 300;
  118. }
  119. .my-tab {
  120. width: 100%;
  121. padding: 0 30rpx;
  122. box-sizing: border-box;
  123. margin: 40rpx 0;
  124. .tab-box {
  125. height: 160rpx;
  126. border-radius: 24rpx;
  127. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  128. display: flex;
  129. align-items: center;
  130. }
  131. .tab-item {
  132. flex: 1;
  133. text-align: center;
  134. }
  135. .tab-number {
  136. font-size: 40rpx;
  137. font-weight: 600;
  138. }
  139. .tab-text {
  140. font-size: 24rpx;
  141. font-weight: 300;
  142. margin-top: 10rpx;
  143. }
  144. }
  145. .my-list {
  146. width: 100%;
  147. padding: 0 30rpx;
  148. box-sizing: border-box;
  149. .my-list-box {
  150. border-radius: 24rpx;
  151. box-shadow: 1px 1px 12px rgba(164, 164, 164, 0.25);
  152. overflow: hidden;
  153. }
  154. .my-item {
  155. display: flex;
  156. align-items: center;
  157. padding: 20rpx 30rpx;
  158. }
  159. .my-icon {
  160. width: 80rpx;
  161. height: 80rpx;
  162. border-radius: 16rpx;
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. margin-right: 20rpx;
  167. background: #c1c0c8;
  168. &.bg1 {
  169. background: #88d498;
  170. }
  171. &.bg2 {
  172. background: #ffb997;
  173. }
  174. &.bg3 {
  175. background: #7ad9ff;
  176. }
  177. &.bg4 {
  178. background: #9ac0cd;
  179. }
  180. &.bg5 {
  181. background: #40e0d0;
  182. }
  183. }
  184. .my-forward {
  185. height: 40rpx;
  186. }
  187. .item-content {
  188. flex: 1;
  189. width: 0;
  190. overflow: hidden;
  191. font-weight: 700;
  192. }
  193. }
  194. }
  195. </style>