template-book-V-3.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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_status_bg_2.png" mode="aspectFit"></image>
  25. <image class="image" v-else src="../../../static/imgs/public/img_status_bg_3.png" mode="aspectFit"></image>
  26. <view class="book-content__box__book-info__info1__status__name">
  27. {{item.book_is_action==1?"完结":"连载"}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="book-content__box__book-info__brief">
  32. {{item.book_brief}}
  33. </view>
  34. <view class="book-content__box__book-info__info2">
  35. <view class="book-content__box__book-info__info2__chapter-count">
  36. {{item.chapter_count}}章
  37. </view>
  38. <view class="book-content__box__book-info__info2__update-time">
  39. {{util.convertTimeString(item.chapter_time_time)}}更新
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script setup lang="ts">
  48. import { book_item_data } from '../../../data/data';
  49. import { tools } from '../../../framework/tools';
  50. import { util } from '../../../framework/util';
  51. const props = defineProps({
  52. templateData: Object,
  53. })
  54. const emits = defineEmits(['clickBook'])
  55. function clickLookMore() {
  56. // console.log(props.templateData)
  57. // tools.gotoSeeMore(props.templateData.id)
  58. }
  59. function clickBook(data:book_item_data) {
  60. emits('clickBook',data)
  61. }
  62. </script>
  63. <style lang="scss">
  64. .book-V-3-content{
  65. display: flex;
  66. flex-direction: column;
  67. margin: 0px 20rpx;
  68. margin-bottom: 30rpx;
  69. padding: 20rpx 0;
  70. border-radius: 20rpx;
  71. box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
  72. background-color: #ffffff;
  73. .title-content {
  74. display: flex;
  75. flex-direction: row;
  76. justify-content: space-between;
  77. align-items: center;
  78. margin: 20rpx 0;
  79. margin-left: 30rpx;
  80. &__title {
  81. font-size: 20px;
  82. font-weight: 500;
  83. }
  84. &__look-more{
  85. display: flex;
  86. flex-shrink: 0;
  87. width: 128px;
  88. height: 48px;
  89. align-items: center;
  90. // background-color: green;
  91. .image{
  92. width: 100%;
  93. height: 100%;
  94. }
  95. }
  96. }
  97. .book-content{
  98. display: flex;
  99. flex-direction: column;
  100. margin-top: 10rpx;
  101. // background-color: red;
  102. &__box{
  103. display: flex;
  104. flex-direction: row;
  105. margin-bottom: 30rpx;
  106. padding: 0 20rpx;
  107. // background-color: green;
  108. &__book-cover{
  109. width: 194rpx;
  110. height: 259rpx;
  111. flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
  112. .image {
  113. width: 100%;
  114. height: 100%;
  115. }
  116. }
  117. &__book-info{
  118. display: flex;
  119. flex-direction: column;
  120. margin-left: 20rpx;
  121. width: 100%;
  122. // background-color: red;
  123. &__name{
  124. margin-top: 10rpx;
  125. display: -webkit-box;
  126. align-items: center;
  127. -webkit-line-clamp: 1;
  128. -webkit-box-orient: vertical;
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. font-size: 18px;
  132. }
  133. &__info1 {
  134. display: flex;
  135. flex-direction: row;
  136. justify-content: space-between;
  137. align-items: center;
  138. margin-top: 15rpx;
  139. // background-color: red;
  140. &__author{
  141. display: -webkit-box;
  142. -webkit-line-clamp: 1;
  143. -webkit-box-orient: vertical;
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. font-size: 13px;
  147. color: #6F6F6F;
  148. }
  149. &__status{
  150. flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
  151. width: 162rpx;
  152. height: 48rpx;
  153. position: relative;
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. .image {
  158. width: 100%;
  159. height: 100%;
  160. }
  161. &__name{
  162. position: absolute;
  163. font-size: 14px;
  164. color: #ffffff;
  165. }
  166. }
  167. }
  168. &__brief{
  169. margin-top: 15rpx;
  170. display: -webkit-box;
  171. font-size: 13px;
  172. color: #6F6F6F;
  173. -webkit-line-clamp: 2;
  174. -webkit-box-orient: vertical;
  175. overflow: hidden;
  176. text-overflow: ellipsis;
  177. }
  178. &__info2{
  179. margin-top: 15rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. font-size: 13px;
  183. color: #6F6F6F;
  184. &__chapter-count {
  185. }
  186. &__update-time {
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. </style>