indexNewsListShow.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="news-tab-box">
  3. <div class="news-first-box">
  4. <div class="news-first">
  5. <div class="news-first-left">
  6. <img
  7. :src="indexFirstNewsList.articleImg.articleImgSrc"
  8. :alt="indexFirstNewsList.articleImg.articleImgAlt"
  9. >
  10. </div>
  11. <div class="news-first-right">
  12. <div class="news-first-right-title-box">
  13. <div class="news-first-title">
  14. <nuxt-link
  15. target="_blank"
  16. :to="{name:'news-newsView-id',params:{id:indexFirstNewsList.articleId},query: {category: indexFirstNewsList.articleCategoryId}}"
  17. >
  18. <b>{{indexFirstNewsList.articleName}}</b>
  19. </nuxt-link>
  20. </div>
  21. <div class="news-first-times">
  22. <p>{{indexFirstNewsList.articleAddTime}}</p>
  23. </div>
  24. </div>
  25. <div class="news-first-intro">{{getTxt(indexFirstNewsList.articleText)}}</div>
  26. <div class="news-first-more">
  27. <nuxt-link
  28. target="_blank"
  29. :to="{name:'news-category',params:{category: indexFirstNewsList.articleCategoryId}}"
  30. >了解更多 &gt;</nuxt-link>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="news-list">
  36. <ul>
  37. <li v-for="(item,index) in indexNewsList" :key="index">
  38. <div class="news-list-title">
  39. <nuxt-link
  40. target="_blank"
  41. :to="{name:'news-newsView-id',params:{id:item.articleId},query: {category: item.articleCategoryId}}"
  42. >
  43. <b>{{item.articleName}}</b>
  44. </nuxt-link>
  45. </div>
  46. <div class="news-list-times">
  47. <p>{{getTime(item.articleAddTime)}}</p>
  48. </div>
  49. </li>
  50. </ul>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. export default {
  56. name: "indexNewsListShow",
  57. props: {
  58. indexFirstNewsList: Object,
  59. indexNewsList: Array,
  60. },
  61. methods: {
  62. getTxt(str) {
  63. var txt = str
  64. .replace(/<\/?.+?>/g, "")
  65. .replace(/(^\s+)|(\s+$)/g, "")
  66. .replace(/\s/g, "");
  67. txt = txt.length < 150 ? txt : txt.substring(0, 150).concat("...");
  68. return txt;
  69. },
  70. getTime(time) {
  71. var time = time.slice(5, 10);
  72. return time;
  73. },
  74. },
  75. };
  76. </script>
  77. <style scoped>
  78. .news-tab-box {
  79. width: 100%;
  80. height: auto;
  81. }
  82. .news-tab-content .news-tab-box:first-child {
  83. display: block;
  84. }
  85. .news-first {
  86. overflow: hidden;
  87. width: 100%;
  88. height: 398px;
  89. padding-bottom: 90px;
  90. box-sizing: border-box;
  91. }
  92. .news-first-left {
  93. float: left;
  94. overflow: hidden;
  95. width: 422px;
  96. height: 308px;
  97. }
  98. .news-first-right {
  99. float: right;
  100. overflow: hidden;
  101. width: 737px;
  102. height: auto;
  103. }
  104. .news-first-left img {
  105. width: 100%;
  106. height: 100%;
  107. }
  108. .news-first-right-title-box {
  109. overflow: hidden;
  110. width: 100%;
  111. height: auto;
  112. padding-bottom: 30px;
  113. border-bottom: 2px solid #eaeaeb;
  114. }
  115. .news-first-title {
  116. float: left;
  117. overflow: hidden;
  118. max-width: 645px;
  119. height: 50px;
  120. font-size: 20px;
  121. font-weight: bold;
  122. line-height: 50px;
  123. text-align: left;
  124. }
  125. .news-first-times {
  126. float: right;
  127. overflow: hidden;
  128. width: 92px;
  129. height: 50px;
  130. color: #858585;
  131. font-size: 14px;
  132. line-height: 50px;
  133. text-align: center;
  134. }
  135. .news-first-title a {
  136. display: block;
  137. overflow: hidden;
  138. width: 100%;
  139. height: 100%;
  140. color: #22202b;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. }
  144. .news-tab-box b {
  145. overflow: hidden;
  146. display: block;
  147. width: 100%;
  148. height: 100%;
  149. font-weight: normal;
  150. text-overflow: ellipsis;
  151. white-space: nowrap;
  152. }
  153. .news-first-intro {
  154. overflow: hidden;
  155. width: 100%;
  156. height: 152px;
  157. padding: 50px 0 40px;
  158. border-bottom: 2px solid #eaeaeb;
  159. box-sizing: border-box;
  160. color: #858585;
  161. font-size: 14px;
  162. line-height: 20px;
  163. text-align: left;
  164. }
  165. .news-first-more {
  166. float: right;
  167. overflow: hidden;
  168. width: 163px;
  169. height: 40px;
  170. margin: 28px auto 0;
  171. border: 3px solid #000;
  172. font-size: 14px;
  173. line-height: 40px;
  174. text-align: center;
  175. -webkit-transition: all 0.5s ease;
  176. -o-transition: all 0.5s ease;
  177. transition: all 0.5s ease;
  178. }
  179. .news-first-more:hover {
  180. -webkit-transform: translateY(-5px);
  181. -ms-transform: translateY(-5px);
  182. -o-transform: translateY(-5px);
  183. transform: translateY(-5px);
  184. }
  185. .news-first-more a {
  186. display: block;
  187. width: 100%;
  188. height: 100%;
  189. color: #22202b;
  190. font-weight: bold;
  191. -webkit-transition: all 0.5s ease;
  192. -o-transition: all 0.5s ease;
  193. transition: all 0.5s ease;
  194. }
  195. .news-first-more:hover a {
  196. background: #22202b;
  197. color: #feeabd;
  198. }
  199. .news-list {
  200. overflow: hidden;
  201. width: 100%;
  202. height: auto;
  203. }
  204. .news-list ul {
  205. overflow: hidden;
  206. width: 100%;
  207. }
  208. .news-list ul li {
  209. position: relative;
  210. float: left;
  211. overflow: hidden;
  212. width: 400px;
  213. height: 26px;
  214. color: #999;
  215. font-size: 14px;
  216. line-height: 26px;
  217. text-align: left;
  218. }
  219. .news-list ul li::after {
  220. position: absolute;
  221. top: 50%;
  222. left: 0;
  223. content: "";
  224. width: 2px;
  225. height: 2px;
  226. border-radius: 50%;
  227. background: #999;
  228. }
  229. .news-list-title {
  230. float: left;
  231. overflow: hidden;
  232. max-width: 300px;
  233. height: 100%;
  234. padding-left: 6px;
  235. box-sizing: border-box;
  236. }
  237. .news-list-title a {
  238. display: block;
  239. overflow: hidden;
  240. width: 100%;
  241. height: 100%;
  242. color: #999;
  243. text-overflow: ellipsis;
  244. white-space: nowrap;
  245. }
  246. .news-list-times {
  247. float: right;
  248. width: 90px;
  249. height: 26px;
  250. padding-left: 10px;
  251. box-sizing: border-box;
  252. }
  253. .news-list-times p {
  254. overflow: hidden;
  255. width: 100%;
  256. height: 100%;
  257. }
  258. .news-list ul li:hover,
  259. .news-list ul li:hover a {
  260. color: #000;
  261. }
  262. </style>