index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div class="container news">
  3. <div class="banner">
  4. <div class="banner-content">
  5. <h3 class="title">NEWS</h3>
  6. <h3 class="title">新闻中心</h3>
  7. </div>
  8. </div>
  9. <section class="content w1200">
  10. <div class="aside">
  11. <ul class="news-cate-list">
  12. <li v-for="(item, index) in $store.state.newsNav" :key="index" class="news-cate-item">
  13. <div class="icon"><img :src="item.icon" alt="" srcset=""></div>
  14. <div :class="['title', cateId == item.id ? 'active' : '']" @click="changeCate(item, index)">{{ item.title }}</div>
  15. </li>
  16. </ul>
  17. </div>
  18. <div class="news-main">
  19. <section class="news-list">
  20. <div class="news-list-item" v-for="(item, index) in newsList" :key="index">
  21. <div class="news-list-left">
  22. <nuxt-link :to="{ name: 'news-newsView-id', params: { id: cateId }, query: { cateId: cateId } }">
  23. <img :src="item.imgUrl" alt="">
  24. </nuxt-link>
  25. </div>
  26. <div class="news-list-right">
  27. <div class="news-list-title">
  28. <nuxt-link :to="{ name: 'news-newsView-id', params: { id: cateId }, query: { cateId: cateId } }">
  29. {{ item.title }}
  30. </nuxt-link>
  31. </div>
  32. <div class="news-list-desc">{{ item.content }}</div>
  33. <div class="news-list-bottom">{{ item.time }}</div>
  34. </div>
  35. </div>
  36. </section>
  37. <div class="news-pagination">
  38. <el-pagination
  39. @size-change="handleSizeChange"
  40. @current-change="handleCurrentChange"
  41. :current-page="currentPage"
  42. :page-sizes="[100, 200, 300, 400]"
  43. :page-size="100"
  44. background
  45. layout="total, sizes, prev, pager, next, jumper"
  46. :total="400">
  47. </el-pagination>
  48. </div>
  49. </div>
  50. </section>
  51. </div>
  52. </template>
  53. <script>
  54. if (process.browser) {
  55. var {WOW} = require('wowjs')
  56. }
  57. export default {
  58. name: 'news',
  59. mounted () {
  60. if (process.browser) {
  61. new WOW({
  62. offset: 0,
  63. live: true
  64. }).init()
  65. }
  66. },
  67. data() {
  68. return {
  69. currentPage: 1,
  70. newsList: [
  71. {
  72. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  73. time: '2020-6-29',
  74. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  75. imgUrl: require('~/assets/images/news/img.png'),
  76. id: '1',
  77. cateId: '1',
  78. },
  79. {
  80. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 慧乔迁……..',
  81. time: '2020-6-29',
  82. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  83. imgUrl: require('~/assets/images/news/img.png'),
  84. id: '1'
  85. },
  86. {
  87. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 慧乔迁……..',
  88. time: '2020-6-29',
  89. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  90. imgUrl: require('~/assets/images/news/img.png'),
  91. id: '1'
  92. },
  93. {
  94. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 慧乔迁……..',
  95. time: '2020-6-29',
  96. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  97. imgUrl: require('~/assets/images/news/img.png'),
  98. id: '1'
  99. }
  100. ]
  101. }
  102. },
  103. components: {
  104. },
  105. head() {
  106. },
  107. async asyncData({ params, query, store }) {
  108. let cateId = query.cateId || 1;
  109. console.log(cateId);
  110. return {
  111. cateId
  112. }
  113. },
  114. created() {
  115. },
  116. mounted() {
  117. },
  118. methods: {
  119. handleSizeChange() {
  120. },
  121. handleCurrentChange() {
  122. },
  123. changeCate(item, index) {
  124. this.cateId = item.id;
  125. this.currentIndex = index;
  126. }
  127. },
  128. };
  129. </script>
  130. <style lang="scss">
  131. @import "~static/common/style.sass";
  132. .banner {
  133. background: url('~assets/images/news/header.png') 100% 100% no-repeat #ffffff;
  134. height: 882px;
  135. .banner-content {
  136. display: flex;
  137. flex-direction: column;
  138. justify-content: center;
  139. align-items: center;
  140. height: 100%;
  141. .title {
  142. font-size: 80px;
  143. font-weight: 500;
  144. color: #FFFFFF;
  145. line-height: 112px;
  146. }
  147. }
  148. }
  149. .news {
  150. .news-main {
  151. margin-bottom: 116px;
  152. }
  153. .content {
  154. display: flex;
  155. margin-top: 138px;
  156. .aside {
  157. box-sizing: border-box;
  158. width: 200px;
  159. background: #FFFFFF;
  160. box-shadow: 0px 2px 9px 0px rgba(211, 213, 212, 0.5);
  161. border-radius: 6px;
  162. padding: 8px 0 36px 16px;
  163. margin-right: 15px;
  164. height: 224px;
  165. }
  166. .news-cate-item {
  167. display: flex;
  168. align-items: center;
  169. font-size: 0;
  170. .icon {
  171. margin-right: 18px;
  172. }
  173. .title {
  174. font-size: 20px;
  175. font-weight: 500;
  176. color: #959698;
  177. line-height: 28px;
  178. padding: 12px 0;
  179. &.active {
  180. font-size: 30px;
  181. font-weight: 500;
  182. color: #262626;
  183. line-height: 42px;
  184. transition: .3s;
  185. }
  186. }
  187. }
  188. .news-main {
  189. flex: 1;
  190. }
  191. .news-list {
  192. .news-list-item {
  193. padding: 20px 50px 20px 20px;
  194. display: flex;
  195. height: 212px;
  196. background: #FFFFFF;
  197. box-shadow: 0px 2px 15px 0px rgba(206, 209, 217, 0.42);
  198. border-radius: 10px;
  199. margin-bottom: 20px;
  200. .news-list-left {
  201. margin-right: 28px;
  202. width: 266px;
  203. height: 170px;
  204. overflow: hidden;
  205. img {
  206. width: 100%;
  207. height: 100%;
  208. border-radius: 4px;
  209. transition: all .5s ease;
  210. &:hover {
  211. transform: scale(1.2);
  212. }
  213. }
  214. }
  215. .news-list-right {
  216. flex: 1;
  217. display: flex;
  218. flex-direction: column;
  219. justify-content: space-between;
  220. .news-list-title {
  221. font-size: 22px;
  222. font-weight: 500;
  223. color: #242424;
  224. line-height: 44px;
  225. overflow: hidden;
  226. text-overflow: ellipsis;
  227. display: -webkit-box;
  228. -webkit-box-orient: vertical;
  229. -webkit-line-clamp: 2;
  230. :hover {
  231. text-decoration: underline;
  232. }
  233. }
  234. .news-list-desc {
  235. font-size: 16px;
  236. font-weight: 400;
  237. color: #797979;
  238. line-height: 32px;
  239. overflow: hidden;
  240. text-overflow: ellipsis;
  241. display: -webkit-box;
  242. -webkit-box-orient: vertical;
  243. -webkit-line-clamp: 2;
  244. }
  245. .news-list-bottom {
  246. font-size: 10px;
  247. font-weight: 400;
  248. color: #ABABAB;
  249. line-height: 14px;
  250. }
  251. }
  252. }
  253. }
  254. .news-pagination {
  255. margin-top: 80px;
  256. .el-pagination.is-background {
  257. text-align: center;
  258. .el-pager {
  259. li.number {
  260. background: #ffffff;
  261. color: #2F2F2F;
  262. border: 1px solid #DCDFE6;
  263. min-width: 34px;
  264. &.active {
  265. background: $theme_color;
  266. color: #ffffff;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. </style>