news.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div id="news">
  3. <el-row v-loading="loading">
  4. <el-col :span="24" class="news">
  5. <el-col :span="24" class="newsTop">
  6. <el-col :span="18" class="text">
  7. {{ newsList.title || title }}
  8. </el-col>
  9. <el-col :span="6" class="link">
  10. <el-link :underline="false" @click="$router.push({ path: path, query: { title: newsList.title } })">
  11. MORE<i class="el-icon-circle-plus-outline" style="color:#f8b024;font-weight:bold;margin:0 5px;"></i>
  12. </el-link>
  13. </el-col>
  14. </el-col>
  15. <el-col :span="24" class="info">
  16. <el-col :span="11" class="block">
  17. <el-carousel :interval="5000" arrow="always" ref="shubiao">
  18. <el-carousel-item v-for="(item, index) in infoList" :key="index" :name="`${index}`">
  19. <!-- @click="$router.push({ path: `/info/detail?id=${item.id}` })" -->
  20. <el-link :underline="false" @click="$router.push({ path: `/detail?id=${item.id}` })">
  21. <el-image style="width:369px;height:242px;" :src="item.pic"></el-image>
  22. <el-col :span="24" class="cont">
  23. <p>{{ item.title }}</p>
  24. </el-col>
  25. </el-link>
  26. </el-carousel-item>
  27. </el-carousel>
  28. </el-col>
  29. <el-col :span="12" class="content">
  30. <el-col
  31. :span="24"
  32. class="titList"
  33. @mouseover="shuYi(index)"
  34. :class="newListActive(item)"
  35. v-for="(item, index) in infoList"
  36. :key="index"
  37. @click="$router.push({ path: `/detail?id=${tag.id}` })"
  38. >
  39. <span class="shu"></span>
  40. <!-- @click="$router.push({ path: `/info/detail?id=${tag.id}` })" -->
  41. <span class="title">{{ item.title }}</span>
  42. <span class="time">{{ item.publish_time }}</span>
  43. </el-col>
  44. </el-col>
  45. </el-col>
  46. </el-col>
  47. </el-row>
  48. </div>
  49. </template>
  50. <script>
  51. import _ from 'lodash';
  52. export default {
  53. name: 'news',
  54. props: {
  55. newsList: null,
  56. },
  57. components: {},
  58. data: () => ({
  59. loading: true,
  60. title: '就业动态',
  61. infoList: [],
  62. path: undefined,
  63. }),
  64. watch: {
  65. newsList: {
  66. handler(val) {
  67. if (val) this.assignData(val);
  68. },
  69. },
  70. },
  71. created() {},
  72. computed: {},
  73. methods: {
  74. assignData(data) {
  75. let columns = _.get(data, 'children');
  76. let news = [];
  77. for (const item of columns) {
  78. if (!this.path) this.path = item.path;
  79. let newsList = _.get(item, `children`);
  80. if (newsList) {
  81. news = news.concat(news, newsList);
  82. }
  83. }
  84. this.$set(this, `infoList`, news);
  85. this.loading = false;
  86. },
  87. shuYi(index) {
  88. this.$refs.shubiao.setActiveItem(`${index}`);
  89. },
  90. newListActive(item) {},
  91. },
  92. };
  93. </script>
  94. <style lang="less" scoped>
  95. p {
  96. padding: 0;
  97. margin: 0;
  98. }
  99. /deep/.el-carousel__indicators {
  100. display: none;
  101. }
  102. .newsTop {
  103. height: 35px;
  104. line-height: 35px;
  105. border-bottom: 2px solid #0656d1;
  106. }
  107. .newsTop .text {
  108. font-size: 20px;
  109. color: #0874ee;
  110. font-weight: 600;
  111. padding: 0 10px;
  112. }
  113. .newsTop .link {
  114. text-align: right;
  115. padding: 0 5px;
  116. }
  117. .info {
  118. margin: 24px 0 0 0;
  119. }
  120. .block {
  121. width: 369px;
  122. height: 242px;
  123. overflow: hidden;
  124. }
  125. .cont {
  126. position: absolute;
  127. bottom: 0;
  128. height: 40px;
  129. line-height: 40px;
  130. background-color: #0656d19f;
  131. }
  132. .cont p {
  133. font-size: 18px;
  134. color: #fff;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. white-space: nowrap;
  138. padding: 0 15px;
  139. }
  140. /deep/.el-carousel__container {
  141. height: 242px;
  142. }
  143. .content {
  144. float: right;
  145. width: 415px;
  146. }
  147. .titList {
  148. border-bottom: 1px dashed #ccc;
  149. padding: 5px 0;
  150. }
  151. .titList .shu {
  152. display: inline-block;
  153. width: 2px;
  154. height: 16px;
  155. background-color: transparent;
  156. }
  157. .titList .title {
  158. font-size: 14px;
  159. color: #5b5b5b;
  160. display: inline-block;
  161. width: 270px;
  162. padding: 0 10px;
  163. overflow: hidden;
  164. text-overflow: ellipsis;
  165. white-space: nowrap;
  166. }
  167. .titList .time {
  168. font-size: 14px;
  169. color: #5b5b5b;
  170. display: inline-block;
  171. width: 100px;
  172. overflow: hidden;
  173. padding: 0 10px;
  174. }
  175. .titList:hover {
  176. cursor: pointer;
  177. }
  178. .titList:hover .title {
  179. color: #333333;
  180. }
  181. .titList:hover .shu {
  182. background-color: #0656d1;
  183. }
  184. /deep/.el-carousel__arrow {
  185. width: 17px;
  186. height: 39px;
  187. border-radius: 0;
  188. background-color: #0656d1;
  189. }
  190. /deep/.el-carousel__arrow--left {
  191. left: 0;
  192. }
  193. /deep/.el-carousel__arrow--right {
  194. right: 0;
  195. }
  196. .el-carousel__item h3 {
  197. color: #475669;
  198. font-size: 18px;
  199. opacity: 0.75;
  200. line-height: 300px;
  201. margin: 0;
  202. }
  203. .el-carousel__item:nth-child(2n) {
  204. background-color: #99a9bf;
  205. }
  206. .el-carousel__item:nth-child(2n + 1) {
  207. background-color: #d3dce6;
  208. }
  209. </style>