special.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div>
  3. <div class="swiperBox">
  4. <el-carousel height="450px" >
  5. <el-carousel-item v-for="item in bannerList" :key="item" >
  6. <img class="swiperImg" :src="item.logo" alt="" @click="toUrl(item)">
  7. </el-carousel-item>
  8. </el-carousel>
  9. </div>
  10. <div class="main">
  11. <div class="leftSlide">
  12. <div class="special">
  13. <div class="specialItem u-flex" @click="toInfo(item)" v-for="(item,index) in specialList" :key="index">
  14. <img class="poster" :src="item.logo" alt="">
  15. <div class="specialItemInfo">
  16. <div class="specialItemInfoTitle">
  17. {{item.title}}
  18. </div>
  19. <div class="specialItemTips u-row-between">
  20. <div>
  21. <img style="height: 12px;" src="../assets/image/eye.png" alt="">{{item.page_view}}
  22. </div>
  23. <div>
  24. {{item.create_at}}
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="page">
  31. <el-pagination background @current-change="pageChange" :page-size="page_num" layout="prev, pager, next" :total="count" />
  32. </div>
  33. </div>
  34. <div class="rightSlide">
  35. <HotMessage/>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script setup>
  41. import {useRouter } from "vue-router"
  42. import {onMounted ,ref} from "vue"
  43. import HotMessage from '@/components/HotMessage.vue'
  44. import {banner,subject_list} from '@/utils/api'
  45. onMounted(()=>{
  46. getBanner()
  47. getSpecialList()
  48. })
  49. let router=useRouter()
  50. let toInfo=(item)=>{
  51. router.push('specialInfo?id='+item.id)
  52. }
  53. let page=ref(1)
  54. let page_num=ref(10)
  55. let count=ref(0)
  56. let specialList=ref([])
  57. let getSpecialList=()=>{
  58. subject_list({page:page.value,page_num:page_num.value}).then(res=>{
  59. specialList.value=res.data.list
  60. count.value=res.data.count
  61. })
  62. }
  63. let pageChange=(e)=>{
  64. page.value=e
  65. getSpecialList()
  66. }
  67. let bannerList=ref([])
  68. let getBanner=()=>{
  69. banner().then(res=>{
  70. bannerList.value=res.data
  71. })
  72. }
  73. let toUrl=(item)=>{
  74. window.location.href=item.url
  75. }
  76. </script>
  77. <style>
  78. .el-carousel__item{
  79. text-align: center;
  80. }
  81. </style>
  82. <style lang="scss" scoped>
  83. .page{
  84. width: 1200px;
  85. margin: 40px auto 230px;
  86. padding-left: 141px;
  87. }
  88. .swiperImg{
  89. // width: 100%;
  90. height: 100%;
  91. }
  92. .main{
  93. display: flex;
  94. width: 1200px;
  95. margin: 40px auto;
  96. .leftSlide{
  97. width: 800px;
  98. margin-right: 20px;
  99. .special{
  100. width: 800px;
  101. border-radius: 10px;
  102. padding: 0 12px 0;
  103. .specialItem{
  104. border-radius: 10px;
  105. background: #FFFFFF;
  106. padding: 20px;
  107. margin-bottom: 20px;
  108. .poster{
  109. margin-right: 17px;
  110. width: 239px;
  111. height: 156px;
  112. border-radius: 10px;
  113. }
  114. .specialItemInfo{
  115. flex: 1;
  116. .specialItemInfoTitle{
  117. font-size: 24px;
  118. font-weight: bold;
  119. }
  120. .specialItemTips{
  121. margin-top: 53px;
  122. div{
  123. display: flex;
  124. color: #999999;
  125. align-items: center;
  126. img{
  127. width: 16px;
  128. margin-right: 11px;
  129. }
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. </style>