CrowdFundingItem.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="grid-item" @click="handleClick">
  3. <view class="item-image-wrapper">
  4. <image :src="item.main_image" class="item-image"></image>
  5. </view>
  6. <view class="line-box"></view>
  7. <view class="item-info-area">
  8. <view class="item-title two-omit">{{ item.title || item.short_title }}</view>
  9. <view class="item-info">
  10. <text class="item-price">已筹 ¥{{ item.current_amount }}</text>
  11. <text class="item-supporters">支持者 {{ item.supporter_count }}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'CrowdFundingItem',
  19. props: {
  20. item: {
  21. type: Object,
  22. required: true
  23. }
  24. },
  25. methods: {
  26. handleClick() {
  27. this.$emit('click', this.item.id);
  28. }
  29. }
  30. }
  31. </script>
  32. <style scoped lang="scss">
  33. .grid-item {
  34. background: #fff;
  35. border-radius: 12rpx;
  36. overflow: hidden;
  37. display: flex;
  38. flex-direction: column;
  39. .line-box{
  40. width: 100%;
  41. height: 6rpx;
  42. background: linear-gradient(to right, #ACF934, transparent);
  43. }
  44. .item-image-wrapper {
  45. width: 100%;
  46. position: relative;
  47. padding-bottom: 100%; // 1:1
  48. overflow: hidden;
  49. // border-top-left-radius: 18px;
  50. // border-top-right-radius: 18px;
  51. }
  52. .item-image {
  53. position: absolute;
  54. left: 0; top: 0; width: 100%; height: 100%;
  55. object-fit: cover;
  56. // border-top-left-radius: 18px;
  57. // border-top-right-radius: 18px;
  58. display: block;
  59. }
  60. .item-info-area {
  61. background: #fff;
  62. padding: 12rpx 20rpx;
  63. display: flex;
  64. flex-direction: column;
  65. justify-content: flex-end;
  66. .item-title {
  67. font-size: 26rpx;
  68. color: #1f1f1f;
  69. font-weight: 500;
  70. overflow: hidden;
  71. text-overflow: ellipsis;
  72. }
  73. .item-info {
  74. display: flex;
  75. justify-content: space-between;
  76. align-items: center;
  77. // padding: 0 12px 0 12px;
  78. font-size: 20rpx;
  79. margin-top: 12rpx;
  80. .item-price {
  81. color: #999999;
  82. font-weight: 400;
  83. }
  84. .item-supporters {
  85. color: #999999;
  86. font-weight: 400;
  87. }
  88. }
  89. }
  90. }
  91. </style>