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

121 lines
2.9 KiB

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