meCard.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="waterfall-item" :style="{width,...customStyle}" @click="goWork(item)">
  3. <view class="waterfall-item__image" :style="{width,backgroundColor:item.backgroundColor}">
  4. <image :src="item.image" mode="widthFix" style="border-radius: 20rpx;"></image>
  5. </view>
  6. <view class="waterfall-item__ft">
  7. <view class="waterfall-item__ft__title">
  8. <text class="value" :style="{color:textColor}">{{item.title}}</text>
  9. </view>
  10. <view class="waterfall-item__ft__desc">
  11. <view class="user">
  12. <image :src="item.avator" mode="aspectFill" class="avater">
  13. </image>
  14. <text class="name" :style="{color:textColor}">{{item.nickname}}</text>
  15. </view>
  16. <view class="like" @click="changeLike">
  17. <image class="like-icon" :src="isLike ?'/static/icon/icon-18.png':'/static/icon/icon-19.png'" mode="">
  18. </image>
  19. <text class="value" :style="{color:textColor}">{{item.num_like}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="waterfall-item__tips">
  24. <view class="item">
  25. <image class="look-icon" src="@/static/icon/icon-17.png" mode=""></image>
  26. <text class="value" style="color: #fff;">{{item.num_view}}</text>
  27. </view>
  28. <view class="item" style="background-color: #1F1F1F;">
  29. <text class="value" style="color: #ACF934;">精选</text>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: "meCard",
  37. props: {
  38. width: {
  39. type: String,
  40. default: ''
  41. },
  42. item: {
  43. type: Object,
  44. default: () => ({})
  45. },
  46. textColor: {
  47. type: String,
  48. default: '#ff0000'
  49. },
  50. customStyle: {
  51. type: Object,
  52. default: () => ({
  53. background: '#3F4141',
  54. })
  55. }
  56. },
  57. data() {
  58. return {
  59. isLike: false,
  60. };
  61. },
  62. methods: {
  63. changeLike() {
  64. this.isLike = !this.isLike
  65. },
  66. goWork(item) {
  67. uni.$emit('check_login', () => {
  68. uni.navigateTo({
  69. url: '/pages/index/workDetail?id=' + item.id
  70. })
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .waterfall-item {
  78. margin-bottom: 20rpx;
  79. border-radius: 30rpx;
  80. position: relative;
  81. // #ifndef APP-NVUE
  82. .waterfall-item__image {
  83. width: 100%;
  84. height: auto;
  85. box-sizing: border-box;
  86. padding: 28rpx 20rpx;
  87. image {
  88. width: 100%;
  89. height: 100%;
  90. }
  91. }
  92. // #endif
  93. .waterfall-item__tips {
  94. position: absolute;
  95. top: 10rpx;
  96. padding: 0rpx 10rpx;
  97. // #ifndef APP-NVUE
  98. box-sizing: border-box;
  99. // #endif
  100. width: 100%;
  101. display: flex;
  102. flex-direction: row;
  103. align-items: center;
  104. justify-content: space-between;
  105. .item {
  106. // #ifndef APP-NVUE
  107. // #endif
  108. display: flex;
  109. flex-direction: row;
  110. align-items: center;
  111. background: rgba(0, 0, 0, 0.2);
  112. padding: 4rpx 14rpx;
  113. border-radius: 12rpx;
  114. .look-icon {
  115. width: 26rpx;
  116. height: 26rpx;
  117. margin-right: 10rpx;
  118. }
  119. .value {
  120. font-size: 20rpx;
  121. }
  122. }
  123. }
  124. .waterfall-item__ft {
  125. padding: 10rpx 20rpx;
  126. &__title {
  127. line-height: 48rpx;
  128. font-weight: 700;
  129. .value {
  130. font-size: 30rpx;
  131. }
  132. }
  133. &__desc {
  134. width: 100%;
  135. // #ifndef APP-NVUE
  136. display: flex;
  137. // #endif
  138. // #ifdef APP-NVUE
  139. // #endif
  140. flex-direction: row;
  141. align-items: center;
  142. justify-content: space-between;
  143. margin: 20rpx 0;
  144. .user {
  145. // #ifndef APP-NVUE
  146. display: flex;
  147. // #endif
  148. // #ifdef APP-NVUE
  149. flex-direction: row;
  150. // #endif
  151. align-items: center;
  152. .avater {
  153. width: 36rpx;
  154. height: 36rpx;
  155. border-radius: 18rpx;
  156. margin-right: 10rpx;
  157. }
  158. .name {
  159. font-size: 24rpx;
  160. }
  161. }
  162. .like {
  163. // #ifndef APP-NVUE
  164. display: flex;
  165. // #endif
  166. // #ifdef APP-NVUE
  167. flex-direction: row;
  168. // #endif
  169. align-items: center;
  170. .like-icon {
  171. width: 30rpx;
  172. height: 30rpx;
  173. margin-right: 10rpx;
  174. }
  175. .value {
  176. font-size: 24rpx;
  177. }
  178. }
  179. }
  180. &__btn {
  181. height: 65rpx;
  182. border-radius: 18px;
  183. background-image: linear-gradient(to bottom, #BFFE9C, #AEE75D);
  184. // #ifndef APP-NVUE
  185. background: linear-gradient(180deg, #BFFE9C 0%, #AEE75D 62%, #AEE75D 100%);
  186. display: flex;
  187. // #endif
  188. justify-content: center;
  189. align-items: center;
  190. &__icon {
  191. width: 155rpx;
  192. height: 32rpx;
  193. }
  194. }
  195. }
  196. }
  197. </style>