图书馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.4 KiB

2 weeks ago
  1. <template>
  2. <view class="item-container" @click="$emit('click')">
  3. <view class="item-box">
  4. <view class="item-box-left">
  5. <image
  6. class="img-item"
  7. :src="data.imgCover"
  8. mode="scaleToFill"
  9. />
  10. </view>
  11. <view class="item-box-right">
  12. <view class="item-title line-clamp-2">{{ data.title || '暂无标题' }}</view>
  13. <text class="item-author">{{ data.nickname || '佚名' }}</text>
  14. <text class="item-publish">{{ data.publish || '暂无出版社数据' }}</text>
  15. <!-- <view class="item-desc line-clamp-2">{{ data.desc || '暂无简介' }}</view> -->
  16. <!-- <view class="item-bottom-box">
  17. <view class="hot-box">
  18. <text class="hot-text">{{ hotNumber(data.views) }} 热度</text>
  19. </view>
  20. </view>-->
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: "book-list-item",
  28. props: {
  29. data: {
  30. type: Object,
  31. required: true
  32. }
  33. },
  34. methods: {
  35. hotNumber(num) {
  36. if (!num) return "0";
  37. if (num >= 10000) {
  38. return (num / 10000).toFixed(1) + "w";
  39. }
  40. return num;
  41. }
  42. }
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. .item-container {
  47. padding-bottom: 10px;
  48. .item-box {
  49. display: flex;
  50. justify-content: flex-start;
  51. align-items: flex-start;
  52. // margin: 0 10px;
  53. padding: 10px;
  54. background-color: #fff;
  55. border-radius: 6px;
  56. // box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  57. border-bottom: 1px solid #f4f4f4;
  58. .item-box-left {
  59. margin-right: 8px;
  60. .img-item{
  61. width: 64px;
  62. height: 90px;
  63. margin: 0 12px 0 0;
  64. border-radius: 5px;
  65. }
  66. }
  67. .item-box-right {
  68. display: flex;
  69. flex-direction: column;
  70. justify-content: flex-start;
  71. flex: 1;
  72. .item-title {
  73. font-size: 15px;
  74. font-weight: bold;
  75. color: #000;
  76. padding-bottom: 10px;
  77. }
  78. .item-author,
  79. .item-publish {
  80. font-size: 12px;
  81. color: #888;
  82. padding-bottom: 10px;
  83. }
  84. .hot-text {
  85. font-size: 12px;
  86. color: #ff4444;
  87. }
  88. .item-desc {
  89. padding-top: 5px;
  90. font-size: 13px;
  91. color: #666;
  92. line-height: 1.4;
  93. }
  94. .item-bottom-box {
  95. margin-top: 8px;
  96. display: flex;
  97. justify-content: space-between;
  98. align-items: center;
  99. }
  100. }
  101. }
  102. }
  103. </style>