_id.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <section class="cotainer">
  3. <div class="news-detail w1200">
  4. <div class="news-left">
  5. <div class="breadcrumb">
  6. <div class="breadcrumb-list">
  7. <ul>
  8. <li><nuxt-link to="/">首页</nuxt-link></li>
  9. <li>></li>
  10. <li><nuxt-link to="/news">新闻中心</nuxt-link></li>
  11. <li>></li>
  12. <template v-for="(item,index) in $store.state.newsNav">
  13. <li class="breadcrumb-active" v-if="item.id == $route.query.cateId" :key="index">
  14. <nuxt-link :to="{name: 'news', query: {cateId: item.id}}">{{item.type}}</nuxt-link>
  15. </li>
  16. </template>
  17. </ul>
  18. </div>
  19. </div>
  20. <div class="article">
  21. <div class="title">{{ news.articleTitle }}</div>
  22. <div class="info">
  23. <div class="info-item">{{ news.createTime }}</div>
  24. <div class="info-item">
  25. <span class="">观看人数:</span>
  26. <span class="text">1000</span>
  27. </div>
  28. <div class="info-item">
  29. <span>作者:</span>
  30. <span>{{ news.articleAuthor }}</span>
  31. </div>
  32. <div class="info-item">
  33. <span>分享</span>
  34. <div class="share">
  35. <img class="icon" src="~/assets/images/news/icon_wechat.png" alt="" srcset="">
  36. <img class="icon" src="~/assets/images/news/icon_qq.png" alt="" srcset="">
  37. <img class="icon" src="~/assets/images/news/icon_sina.png" alt="" srcset="">
  38. </div>
  39. </div>
  40. </div>
  41. <article>
  42. <div v-html="news.articleContent"></div>
  43. </article>
  44. </div>
  45. </div>
  46. <div class="news-hot new-right">
  47. <div class="news-hot-title">
  48. 热门文章
  49. </div>
  50. <div class="hot-list">
  51. <div class="hot-item" v-for="(item, index) in articleList" :key="index">
  52. <div class="hot-title">
  53. <nuxt-link target="_blank" :to="{name: 'news-newsView-id', params: { id: item.id }, query: {cateId: item.cateId } }">
  54. {{ item.title }}
  55. </nuxt-link>
  56. </div>
  57. <div class="hot-info">
  58. <span class="time">{{ item.time }}</span>
  59. <span class="views">观看人数:{{ item.views}}</span>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="hot-top-style"></div>
  64. </div>
  65. </div>
  66. </section>
  67. </template>
  68. <script>
  69. import axios from "axios";
  70. export default {
  71. data() {
  72. return {
  73. articleList: [
  74. {
  75. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  76. time: '2020-6-29',
  77. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  78. imgUrl: require('~/assets/images/news/img.png'),
  79. id: '1',
  80. cateId: '1',
  81. views: 103,
  82. },
  83. {
  84. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  85. time: '2020-6-29',
  86. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  87. imgUrl: require('~/assets/images/news/img.png'),
  88. id: '2',
  89. cateId: '2',
  90. views: 141,
  91. },
  92. {
  93. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  94. time: '2020-6-29',
  95. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  96. imgUrl: require('~/assets/images/news/img.png'),
  97. id: '3',
  98. cateId: '3',
  99. views: 165,
  100. }
  101. ]
  102. };
  103. },
  104. async asyncData({ params, query, store }) {
  105. const { data: { data: news} } = await axios(`${store.state.wordpressAPI}/official-api/article/get/${params.id}`);
  106. return {
  107. news
  108. }
  109. },
  110. head() {
  111. return {
  112. };
  113. },
  114. mounted() {
  115. },
  116. };
  117. </script>
  118. <style lang="scss">
  119. .news-detail {
  120. margin-top: 118px;
  121. display: flex;
  122. .news-left {
  123. flex: 1;
  124. }
  125. .breadcrumb-list {
  126. font-size: 15px;
  127. ul {
  128. display: flex;
  129. li {
  130. margin-right: 10px;
  131. color: #535F72;
  132. a {
  133. color: #535F72;
  134. }
  135. }
  136. }
  137. .breadcrumb-active {
  138. a {
  139. font-size: 15px;
  140. font-weight: 500;
  141. color: #2D71FA;
  142. line-height: 21px;
  143. }
  144. }
  145. }
  146. .el-breadcrumb {
  147. font-size: 15px;
  148. }
  149. .article {
  150. margin: 32px auto 200px;
  151. .title {
  152. font-size: 32px;
  153. font-weight: 600;
  154. color: #262626;
  155. line-height: 45px;
  156. }
  157. .info {
  158. margin-top: 30px;
  159. font-size: 15px;
  160. font-weight: 400;
  161. color: #535F72;
  162. .info-item {
  163. margin-right: 42px;
  164. .share {
  165. margin-left: 32px;
  166. font-size: 0;
  167. .icon {
  168. margin-right: 44px;
  169. width: 27px;
  170. height: 24px;
  171. }
  172. }
  173. }
  174. }
  175. article {
  176. color: #333330;
  177. margin-top: 34px;
  178. p {
  179. font-size: 16px;
  180. font-weight: 400;
  181. color: #333330;
  182. line-height: 32px;
  183. letter-spacing: 1px;
  184. }
  185. img {
  186. max-width: 850px;
  187. }
  188. }
  189. }
  190. .info {
  191. display: flex;
  192. align-items: center;
  193. .info-item {
  194. display: flex;
  195. align-items: center;
  196. }
  197. }
  198. .new-right {
  199. position: relative;
  200. width: 290px;
  201. border-radius: 4px;
  202. padding: 30px 15px 40px;
  203. max-height: 450px;
  204. margin-left: 60px;
  205. border: 1px solid #F1F1F1;
  206. overflow: hidden;
  207. .hot-top-style {
  208. position: absolute;
  209. top: 0;
  210. left: 0;
  211. height: 8px;
  212. width: 100%;
  213. background: #236AFA;
  214. border-radius: 4px 4px 0px 0px;
  215. }
  216. .news-hot-title {
  217. font-size: 26px;
  218. font-weight: 400;
  219. color: #262626;
  220. line-height: 37px;
  221. }
  222. .hot-item {
  223. margin-top: 18px;
  224. padding-top: 30px;
  225. border-top: 1px solid #F1F1F1;
  226. .hot-title {
  227. font-size: 14px;
  228. font-weight: 400;
  229. color: #262626;
  230. line-height: 20px;
  231. letter-spacing: 1px;
  232. font-family: PingFangSC-Regular, PingFang SC;
  233. overflow: hidden;
  234. text-overflow: ellipsis;
  235. display: -webkit-box;
  236. -webkit-box-orient: vertical;
  237. -webkit-line-clamp: 2;
  238. }
  239. .hot-info {
  240. font-size: 10px;
  241. font-weight: 400;
  242. color: #ABABAB;
  243. line-height: 14px;
  244. margin-top: 4px;
  245. .time {
  246. margin-right: 48px;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. </style>