template-book-V-3.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="book-V-3-content">
  3. <view class="title-content">
  4. <view class="title-content__title" >{{templateData.name}}</view>
  5. <view class="title-content__look-more" @click="clickLookMore">
  6. <image class="image" src="../../../static/imgs/bookstore/img_look_more.png" mode="aspectFit"></image>
  7. </view>
  8. </view>
  9. <view class="book-content">
  10. <view class="book-content__box" v-for="(item,index) in templateData.list" :key="index"
  11. @click="clickBook(item,index)">
  12. <view class="book-content__box__book-cover">
  13. <image class="image" :src="item.book_cover" mode="aspectFill"></image>
  14. </view>
  15. <view class="book-content__box__book-info">
  16. <view class="book-content__box__book-info__name">
  17. {{item.book_name}}
  18. </view>
  19. <view class="book-content__box__book-info__info1">
  20. <view class="book-content__box__book-info__info1__author">
  21. {{item.author_name}} 著 | {{util.convertUnit(item.book_read_num)}}人读过
  22. </view>
  23. <view class="book-content__box__book-info__info1__status">
  24. <image class="image" v-if="item.book_is_action==1" src="../../../static/imgs/public/img_wanjie.png" mode="aspectFit"></image>
  25. <image class="image" v-else src="../../../static/imgs/public/img_lianzai.png" mode="aspectFit"></image>
  26. </view>
  27. </view>
  28. <!-- <view class="book-content__box__book-info__author book-content__box__book-info__name">
  29. 作者:{{item.author_name}}
  30. </view> -->
  31. <!-- <view class="book-content__box__book-info__readNum book-content__box__book-info__name">
  32. 阅读数量:{{item.book_read_num}}
  33. </view> -->
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script setup lang="ts">
  40. import { book_item_data } from '../../../data/data';
  41. import { util } from '../../../framework/util';
  42. defineProps({
  43. templateData: Object,
  44. })
  45. const emits = defineEmits(['clickBook'])
  46. function clickLookMore() {
  47. }
  48. function clickBook(data:book_item_data) {
  49. emits('clickBook',data)
  50. }
  51. </script>
  52. <style lang="scss">
  53. .book-V-3-content{
  54. display: flex;
  55. flex-direction: column;
  56. margin: 0px 20rpx;
  57. margin-bottom: 30rpx;
  58. padding: 20rpx 0;
  59. border-radius: 20rpx;
  60. box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
  61. background-color: #ffffff;
  62. .title-content {
  63. display: flex;
  64. flex-direction: row;
  65. justify-content: space-between;
  66. align-items: center;
  67. margin-left: 30rpx;
  68. &__title {
  69. font-size: 20px;
  70. font-weight: 500;
  71. }
  72. &__look-more{
  73. display: flex;
  74. flex-shrink: 0;
  75. width: 134px;
  76. height: 54px;
  77. align-items: center;
  78. // background-color: green;
  79. .image{
  80. width: 100%;
  81. height: 100%;
  82. }
  83. }
  84. }
  85. .book-content{
  86. display: flex;
  87. flex-direction: column;
  88. margin-top: 10rpx;
  89. // background-color: red;
  90. &__box{
  91. display: flex;
  92. flex-direction: row;
  93. margin-bottom: 30rpx;
  94. padding: 0 20rpx;
  95. // background-color: green;
  96. &__book-cover{
  97. width: 180rpx;
  98. height: 200rpx;
  99. flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
  100. .image {
  101. width: 100%;
  102. height: 100%;
  103. }
  104. }
  105. &__book-info{
  106. display: flex;
  107. flex-direction: column;
  108. margin-left: 20rpx;
  109. width: 100%;
  110. // background-color: red;
  111. &__name{
  112. margin-top: 10rpx;
  113. display: -webkit-box;
  114. align-items: center;
  115. -webkit-line-clamp: 1;
  116. -webkit-box-orient: vertical;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. font-size: 18px;
  120. }
  121. &__info1 {
  122. display: flex;
  123. flex-direction: row;
  124. justify-content: space-between;
  125. align-items: center;
  126. margin-top: 20rpx;
  127. // background-color: red;
  128. &__author{
  129. display: -webkit-box;
  130. -webkit-line-clamp: 1;
  131. -webkit-box-orient: vertical;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. font-size: 15px;
  135. color: #6F6F6F;
  136. }
  137. &__status{
  138. flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
  139. width: 162rpx;
  140. height: 48rpx;
  141. // background-color: green;
  142. .image {
  143. width: 100%;
  144. height: 100%;
  145. }
  146. }
  147. }
  148. &__author{
  149. margin-top: 20rpx;
  150. font-size: 16px;
  151. -webkit-line-clamp: 1;
  152. }
  153. &__readNum{
  154. margin-top: 20rpx;
  155. font-size: 15px;
  156. -webkit-line-clamp: 1;
  157. }
  158. }
  159. }
  160. }
  161. }
  162. </style>