news.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div id="news">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="title">
  6. <span>{{ title }}</span>
  7. </el-col>
  8. <el-col :span="24" class="list">
  9. <el-col :span="13" class="block">
  10. <el-carousel ref="shubiao">
  11. <el-carousel-item v-for="(item, index) in newsList" :key="index" :name="`${index}`">
  12. <el-link :underline="false" @click="$router.push({ path: `/master/detail/news/${item.id}` })">
  13. <el-image style="width:396px;height:280px;" :src="item.pic" class="newsList"></el-image>
  14. <el-col :span="24" class="content"><p v-html="item.content"></p></el-col>
  15. </el-link>
  16. </el-carousel-item>
  17. </el-carousel>
  18. </el-col>
  19. <el-col :span="11" class="newsLi">
  20. <ul>
  21. <li class="listdata">
  22. <span class="qiudata"></span>
  23. <el-link :underline="false">今天(3月8日星期五)</el-link>
  24. </li>
  25. <li
  26. class="newsTitle"
  27. v-for="(tag, index) in newsList"
  28. :key="index"
  29. :type="tag.type"
  30. @mouseover="shuYi(index)"
  31. :class="newListActive(tag)"
  32. @click="$router.push({ path: `/master/detail/news/${tag.id}` })"
  33. >
  34. <span class="qiu"></span>
  35. <p class="textOver">{{ tag.title }}</p>
  36. </li>
  37. </ul>
  38. </el-col>
  39. </el-col>
  40. </el-col>
  41. </el-row>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. name: 'news',
  47. props: {
  48. newsList: null,
  49. },
  50. components: {},
  51. data: () => ({
  52. title: '就业新闻',
  53. }),
  54. created() {},
  55. computed: {},
  56. methods: {
  57. shuYi(index) {
  58. this.$refs.shubiao.setActiveItem(`${index}`);
  59. },
  60. // eslint-disable-next-line no-unused-vars
  61. newListActive(item) {},
  62. },
  63. };
  64. </script>
  65. <style lang="less" scoped>
  66. ul {
  67. margin: 0;
  68. padding: 0;
  69. }
  70. li {
  71. list-style: none;
  72. }
  73. p {
  74. padding: 0;
  75. margin: 0;
  76. }
  77. .textOver {
  78. overflow: hidden;
  79. text-overflow: ellipsis;
  80. white-space: nowrap;
  81. }
  82. .title {
  83. height: 90px;
  84. padding: 50px 0 0 10px;
  85. color: #333;
  86. font-size: 24px;
  87. font-family: 微软雅黑;
  88. }
  89. .list {
  90. height: 280px;
  91. background: #eeeeee;
  92. }
  93. /deep/.el-carousel__container {
  94. height: 280px;
  95. }
  96. /deep/.el-carousel__indicators--horizontal {
  97. display: none;
  98. }
  99. /deep/.el-carousel__arrow {
  100. display: none;
  101. }
  102. .content {
  103. position: absolute;
  104. bottom: 0;
  105. height: 50px;
  106. line-height: 20px;
  107. padding: 0 10px;
  108. background-color: rgba(0, 0, 0, 0.5);
  109. }
  110. .content p {
  111. font-size: 12px;
  112. color: #fff;
  113. overflow: hidden;
  114. text-overflow: ellipsis;
  115. -webkit-line-clamp: 2;
  116. word-break: break-all;
  117. display: -webkit-box;
  118. -webkit-box-orient: vertical;
  119. }
  120. /deep/.content p p {
  121. padding: 3px 0 0 0;
  122. margin: 0;
  123. }
  124. .block {
  125. width: 396px;
  126. height: 280px;
  127. }
  128. .newsLi {
  129. width: 334px;
  130. height: 280px;
  131. background-color: #eeeeee;
  132. overflow: hidden;
  133. }
  134. .listdata {
  135. height: 32px;
  136. line-height: 32px;
  137. border-left: 3px solid #eeeeee;
  138. }
  139. .listdata .el-link {
  140. color: #999999;
  141. font-size: 13px;
  142. font-family: 微软雅黑;
  143. }
  144. .newsTitle {
  145. height: 32px;
  146. line-height: 32px;
  147. border-left: 3px solid transparent;
  148. }
  149. .newsTitle:hover {
  150. border-left: 3px solid #415285;
  151. background: #fff;
  152. cursor: pointer;
  153. }
  154. .newsTitle:hover .qiu {
  155. background: #415285;
  156. }
  157. .qiudata {
  158. display: inline-block;
  159. width: 10px;
  160. height: 10px;
  161. background: #fff;
  162. border: 1px solid #ccc;
  163. border-radius: 90px;
  164. margin: 0 15px;
  165. }
  166. .qiu {
  167. float: left;
  168. width: 10px;
  169. height: 10px;
  170. background: #d5d5d5;
  171. border-radius: 90px;
  172. margin: 11px 15px 0 17px;
  173. }
  174. </style>