user-info.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="infobox">
  3. <view class="left" v-if="isLogin" @click="$u.route('/pages-mine/pages/setting')">
  4. <u-avatar size="118" :src="data.avatar"></u-avatar>
  5. <view class="info">
  6. <view class="username">{{ data.nickname || '' }}</view>
  7. <view class="desc">{{ data.mobile}}</view>
  8. </view>
  9. </view>
  10. <view class="left" v-else @click="$u.route('/pages/login/index')">
  11. <u-avatar size="118"></u-avatar>
  12. <view class="info">
  13. <view class="username">登录</view>
  14. <!-- <view class="desc">点击登录跳转至登录页面</view> -->
  15. </view>
  16. </view>
  17. <!-- <view class="right"><u-icon size="20" name="arrow-right"></u-icon></view> -->
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'user-info',
  23. props: {
  24. // 数据源
  25. data: {
  26. type: Object,
  27. default: () => {
  28. return {};
  29. }
  30. },
  31. isLogin: {
  32. type: Boolean,
  33. default: false
  34. }
  35. },
  36. data() {
  37. return {};
  38. }
  39. };
  40. </script>
  41. <style lang="scss" scoped>
  42. .infobox {
  43. color: $app-theme-text-white-color;
  44. display: flex;
  45. justify-content: space-between;
  46. align-items: center;
  47. padding: 30rpx 48rpx 100rpx;
  48. position: relative;
  49. z-index: $app-zIndex-normal;
  50. background-color: #22ac38;
  51. // border-radius: 0 0 150rpx 150rpx;
  52. .left {
  53. display: flex;
  54. align-items: center;
  55. .info {
  56. margin-left: 24rpx;
  57. display: flex;
  58. align-content: space-between;
  59. flex-wrap: wrap;
  60. .username {
  61. font-size: 32rpx;
  62. width: 100%;
  63. color: $app-theme-text-white-color;
  64. margin-bottom: 16rpx;
  65. font-weight: bold;
  66. }
  67. .desc {
  68. font-size: 24rpx;
  69. width: 100%;
  70. color: $app-theme-text-white-color;
  71. display: -webkit-box;
  72. overflow: hidden;
  73. -webkit-line-clamp: 1;
  74. -webkit-box-orient: vertical;
  75. }
  76. }
  77. }
  78. .right {
  79. display: flex;
  80. align-items: center;
  81. }
  82. }
  83. </style>