图书馆小程序
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.

103 lines
2.3 KiB

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