BookListModule.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="BookListModule">
  3. <div class="module">
  4. <div class="title">
  5. <div class="title-left">
  6. <svg-icon :icon-class="name" className="icon-img"></svg-icon>
  7. <span>
  8. {{typeList[name].name}}
  9. </span>
  10. </div>
  11. <div class="title-right">
  12. <!-- <div class="title-button">
  13. <img
  14. src="../../assets/common/Left-one.png"
  15. alt=""
  16. >
  17. <img
  18. src="../../assets/common/Right-one.png"
  19. alt=""
  20. >
  21. </div> -->
  22. <a class="lookmore" @click="lookmore"><span>查看全部</span><i class="el-icon-arrow-right"></i></a>
  23. </div>
  24. </div>
  25. <div class="list">
  26. <template v-if="name==='baozhi'">
  27. <a class="img-box">
  28. <img src="../../assets/baozhi-ding.png" class="baozhi-ding" />
  29. </a>
  30. </template>
  31. <div class="item-box">
  32. <BookCard
  33. :item="item"
  34. :headerBg="headerBg"
  35. :headerBorder="headerBorder"
  36. :userBg="userBg"
  37. :LoginNavIndex="LoginNavIndex"
  38. :previousPage="previousPage"
  39. class="item"
  40. v-for="(item,index) in list"
  41. :key="index+'todayNew'"
  42. :style="{
  43. marginLeft:index==0?'0':'24px',
  44. }"
  45. />
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  53. //例如:import 《组件名称》from ‘《组件路径》';
  54. import BookCard from "./BookCard.vue"
  55. export default {
  56. //import引入的组件需要注入到对象中才能使用
  57. components: {
  58. BookCard,
  59. },
  60. props: ["list", "name", "value","LoginNavIndex","userBg","headerBorder","headerBg","previousPage"],
  61. data() {
  62. //这里存放数据
  63. return {
  64. typeList: {
  65. huakan: {
  66. name: '画刊',
  67. },
  68. baozhi: {
  69. name: '报纸',
  70. },
  71. xiti: {
  72. name: '练习册',
  73. },
  74. kecheng: {
  75. name: '课程',
  76. },
  77. jingdu: {
  78. name: '精读课堂'
  79. }
  80. }
  81. }
  82. },
  83. //计算属性 类似于data概念
  84. computed: {},
  85. //监控data中数据变化
  86. watch: {},
  87. //方法集合
  88. methods: {
  89. // 查看全部
  90. lookmore(){
  91. this.$router.push({
  92. path: "/bookStore/all",
  93. query: {
  94. name: encodeURIComponent(this.typeList[this.name].name),
  95. type: this.name
  96. }
  97. })
  98. },
  99. },
  100. //生命周期 - 创建完成(可以访问当前this实例)
  101. created() {
  102. },
  103. //生命周期 - 挂载完成(可以访问DOM元素)
  104. mounted() {
  105. },
  106. //生命周期-创建之前
  107. beforeCreated() { },
  108. //生命周期-挂载之前
  109. beforeMount() { },
  110. //生命周期-更新之前
  111. beforUpdate() { },
  112. //生命周期-更新之后
  113. updated() { },
  114. //生命周期-销毁之前
  115. beforeDestory() { },
  116. //生命周期-销毁完成
  117. destoryed() { },
  118. //如果页面有keep-alive缓存功能,这个函数会触发
  119. activated() { }
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. /* @import url(); 引入css类 */
  124. .module {
  125. margin-top: 12px;
  126. .title {
  127. display: flex;
  128. justify-content: space-between;
  129. align-items: flex-end;
  130. &-left{
  131. display: flex;
  132. align-items: center;
  133. .icon-img{
  134. width: 24px;
  135. height: 24px;
  136. margin: 3px 8px 0 0;
  137. color: rgba(0, 0, 0, 0.88);
  138. }
  139. span{
  140. font-weight: 400;
  141. font-size: 24px;
  142. line-height: 32px;
  143. color: #1F2C5C;
  144. display: block;
  145. }
  146. }
  147. &-right{
  148. display: flex;
  149. align-items: center;
  150. }
  151. div.title-button {
  152. width: 48px;
  153. height: 24px;
  154. background: #d4e3fc;
  155. border-radius: 40px;
  156. display: flex;
  157. justify-content: center;
  158. align-items: center;
  159. img {
  160. width: 16px;
  161. height: 16px;
  162. margin: 0 4px;
  163. cursor: pointer;
  164. }
  165. }
  166. .lookmore{
  167. display: flex;
  168. align-items: center;
  169. margin-left: 24px;
  170. font-weight: 400;
  171. font-size: 16px;
  172. line-height: 24px;
  173. color: #000;
  174. .el-icon-arrow-right{
  175. margin-left: 4px;
  176. color: rgba(0, 0, 0, 0.88);
  177. height: 22px;
  178. line-height: 24px;
  179. }
  180. &:hover{
  181. color: #165DFF;
  182. .el-icon-arrow-right{
  183. color: #165DFF;
  184. }
  185. }
  186. }
  187. }
  188. .list{
  189. display: flex;
  190. padding: 24px 0 0 0;
  191. }
  192. .item-box {
  193. display: flex;
  194. flex: 1;
  195. overflow: auto;
  196. padding-bottom: 40px;
  197. &::-webkit-scrollbar {
  198. display: none;
  199. }
  200. .item {
  201. width: 200px;
  202. flex-shrink: 0;
  203. border-radius: 8px;
  204. overflow: hidden;
  205. background: #ffffff;
  206. &:hover{
  207. box-shadow: 0px 0px 30px rgba(0,0,0,0.1);
  208. }
  209. }
  210. }
  211. .img-box{
  212. margin-right: 24px;
  213. font-size: 0;
  214. }
  215. .baozhi-ding{
  216. width: 450px;
  217. height: 384px;
  218. }
  219. }
  220. </style>