infoCard.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="info-card-detail" :style="{ 'background-image': pagesType == '专栏详情' ? 'url(' + authorDetail.BgImg + ')' : '' }">
  3. <view class="name-author">
  4. <view class="author-img">
  5. <view class="img-box">
  6. <image :src="authorDetail.HeadImg"></image>
  7. </view>
  8. <view class="set-btn" v-if="pagesType == '专栏详情'"> 编辑专栏</view>
  9. <view class="set-btn" v-else> + 关注</view>
  10. </view>
  11. <view class="name-box">
  12. <text>{{ authorDetail.SpecialName }}</text>
  13. <text>{{ authorDetail.NickName }}</text>
  14. </view>
  15. </view>
  16. <view class="info-card-lable">
  17. <text v-for="item in dataProcessing(authorDetail.Label)" :key="item">{{ item }}</text>
  18. </view>
  19. <view class="info-card-fans">
  20. <text>{{ authorDetail.SpecialArticleNum }}</text>
  21. <text>文章</text>
  22. <text>{{ authorDetail.CollectNum }}</text>
  23. <text>被收藏</text>
  24. <text>{{ authorDetail.FollowNum }}</text>
  25. <text>粉丝</text>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. authorDetail: {
  33. type: Object,
  34. default: {},
  35. },
  36. pagesType: {
  37. type: String,
  38. default: "",
  39. },
  40. },
  41. data() {
  42. return {};
  43. },
  44. methods: {
  45. // 数据处理
  46. dataProcessing(item) {
  47. return item ? item.split(",") : [];
  48. },
  49. },
  50. };
  51. </script>
  52. <style lang="scss" scope>
  53. .info-card-detail {
  54. border-radius: 16rpx;
  55. background-size: 100% 100%;
  56. // 上面的那个盒子用就把上面的样式去掉
  57. width: 100%;
  58. padding: 40rpx 35rpx;
  59. background-repeat: no-repeat;
  60. color: #fff;
  61. .name-author {
  62. display: flex;
  63. .author-img {
  64. position: relative;
  65. display: flex;
  66. justify-content: center;
  67. width: 126rpx;
  68. height: 138rpx;
  69. text-align: center;
  70. .img-box {
  71. width: 110rpx;
  72. height: 110rpx;
  73. border-radius: 50%;
  74. overflow: hidden;
  75. image {
  76. width: 160rpx;
  77. height: 160rpx;
  78. }
  79. }
  80. .set-btn {
  81. position: absolute;
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. left: 0;
  86. bottom: 0;
  87. width: 126rpx;
  88. height: 48rpx;
  89. border-radius: 150rpx;
  90. background-color: #376cbb;
  91. color: #fff;
  92. }
  93. }
  94. .name-box {
  95. margin-left: 20rpx;
  96. text:nth-child(1) {
  97. font-size: 36rpx;
  98. font-weight: 500;
  99. line-height: 50rpx;
  100. padding: 20rpx 0;
  101. }
  102. text:nth-child(2) {
  103. font-size: 28rpx;
  104. font-weight: 400;
  105. line-height: 39rpx;
  106. }
  107. }
  108. }
  109. .info-card-lable {
  110. display: flex;
  111. flex-wrap: wrap;
  112. text {
  113. height: 45rpx;
  114. padding: 6rpx 12rpx 6rpx 12rpx;
  115. border-radius: 150rpx;
  116. background-color: #8994a1;
  117. margin: 20rpx 20rpx 0rpx 0;
  118. }
  119. }
  120. .info-card-fans {
  121. margin-top: 20rpx;
  122. display: flex;
  123. align-items: center;
  124. text:nth-child(2n + 1) {
  125. color: #ffe8a8;
  126. font-size: 38rpx;
  127. font-weight: 500;
  128. }
  129. text:nth-child(2n) {
  130. margin: 0 40rpx 0 5rpx;
  131. }
  132. }
  133. }
  134. </style>