_id.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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="bdsharebuttonbox share">
  35. <img class="icon" src="~/assets/images/news/icon_wechat.png" data-cmd="weixin" alt="" srcset="" title="分享到微信" />
  36. <img class="icon" src="~/assets/images/news/icon_qq.png" data-cmd="sqq" alt="" srcset="" title="分享到QQ好友" />
  37. <img class="icon" src="~/assets/images/news/icon_sina.png" data-cmd="tsina" alt="" srcset="" title="分享到新浪微博" />
  38. <!-- <a href="#" data-cmd="tsina" title="分享到新浪微博">微博</a> -->
  39. <!-- <img class="icon" src="~/assets/images/news/icon_wechat.png" data-cmd="weixin" alt="" srcset="">
  40. <img class="icon" src="~/assets/images/news/icon_qq.png" data-cmd="sqq" alt="" srcset="">
  41. <img class="icon" src="~/assets/images/news/icon_sina.png" data-cmd="tsina" alt="" srcset=""> -->
  42. </div>
  43. </div>
  44. </div>
  45. <article>
  46. <div v-html="news.articleContent"></div>
  47. </article>
  48. </div>
  49. </div>
  50. <div class="news-hot new-right">
  51. <div class="news-hot-title">
  52. 热门文章
  53. </div>
  54. <div class="hot-list">
  55. <div class="hot-item" v-for="(item, index) in articleList" :key="index">
  56. <div class="hot-title">
  57. <nuxt-link target="_blank" :to="{name: 'news-newsView-id', params: { id: item.id }, query: {cateId: item.cateId } }">
  58. {{ item.title }}
  59. </nuxt-link>
  60. </div>
  61. <div class="hot-info">
  62. <span class="time">{{ item.time }}</span>
  63. <span class="views">观看人数:{{ item.views}}</span>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="hot-top-style"></div>
  68. </div>
  69. </div>
  70. </section>
  71. </template>
  72. <script>
  73. import axios from "axios";
  74. export default {
  75. data() {
  76. return {
  77. articleList: [
  78. {
  79. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  80. time: '2020-6-29',
  81. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  82. imgUrl: require('~/assets/images/news/img.png'),
  83. id: '1',
  84. cateId: '1',
  85. views: 103,
  86. },
  87. {
  88. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  89. time: '2020-6-29',
  90. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  91. imgUrl: require('~/assets/images/news/img.png'),
  92. id: '2',
  93. cateId: '2',
  94. views: 141,
  95. },
  96. {
  97. title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
  98. time: '2020-6-29',
  99. content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
  100. imgUrl: require('~/assets/images/news/img.png'),
  101. id: '3',
  102. cateId: '3',
  103. views: 165,
  104. }
  105. ]
  106. };
  107. },
  108. async asyncData({ params, query, store }) {
  109. const { data: { data: news} } = await axios(`${store.state.wordpressAPI}/official-api/article/get/${params.id}`);
  110. return {
  111. news
  112. }
  113. },
  114. head() {
  115. return {
  116. };
  117. },
  118. mounted() {
  119. this.$nextTick(function (){
  120. window._bd_share_config = {
  121. "common": {
  122. "bdSnsKey": {},
  123. "bdText": "",
  124. "bdMini": "1",
  125. "bdMiniList": ["qzone", "tsina", "weixin", "sqq", "duitang", "hx", "fx", "youdao", "sdo", "qingbiji", "people", "xinhua", "mail", "isohu", "yaolan", "wealink", "ty", "iguba", "fbook", "twi", "linkedin", "h163", "evernotecn", "copy", "print"],
  126. "bdPic": "",
  127. "bdStyle": "2",
  128. "bdSize": "32"
  129. },
  130. "share": {}
  131. };
  132. const s = document.createElement('script');
  133. s.type = 'text/javascript';
  134. s.src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5);
  135. document.body.appendChild(s);
  136. })
  137. },
  138. };
  139. </script>
  140. <style lang="scss">
  141. .news-detail {
  142. margin-top: 118px;
  143. display: flex;
  144. .news-left {
  145. flex: 1;
  146. }
  147. .breadcrumb-list {
  148. font-size: 15px;
  149. ul {
  150. display: flex;
  151. li {
  152. margin-right: 10px;
  153. color: #535F72;
  154. a {
  155. color: #535F72;
  156. }
  157. }
  158. }
  159. .breadcrumb-active {
  160. a {
  161. font-size: 15px;
  162. font-weight: 500;
  163. color: #2D71FA;
  164. line-height: 21px;
  165. }
  166. }
  167. }
  168. .el-breadcrumb {
  169. font-size: 15px;
  170. }
  171. .article {
  172. margin: 32px auto 200px;
  173. .title {
  174. font-size: 32px;
  175. font-weight: 600;
  176. color: #262626;
  177. line-height: 45px;
  178. }
  179. .info {
  180. margin-top: 30px;
  181. font-size: 15px;
  182. font-weight: 400;
  183. color: #535F72;
  184. .info-item {
  185. margin-right: 42px;
  186. .share {
  187. margin-left: 32px;
  188. font-size: 0;
  189. .icon {
  190. margin-right: 44px;
  191. width: 27px;
  192. height: 24px;
  193. }
  194. a {
  195. font-size: 12px;
  196. }
  197. }
  198. }
  199. }
  200. article {
  201. color: #333330;
  202. margin-top: 34px;
  203. p {
  204. font-size: 16px;
  205. font-weight: 400;
  206. color: #333330;
  207. line-height: 32px;
  208. letter-spacing: 1px;
  209. }
  210. img {
  211. max-width: 850px;
  212. }
  213. }
  214. }
  215. .info {
  216. display: flex;
  217. align-items: center;
  218. .info-item {
  219. display: flex;
  220. align-items: center;
  221. }
  222. }
  223. .new-right {
  224. position: relative;
  225. width: 290px;
  226. border-radius: 4px;
  227. padding: 30px 15px 40px;
  228. max-height: 450px;
  229. margin-left: 60px;
  230. border: 1px solid #F1F1F1;
  231. overflow: hidden;
  232. .hot-top-style {
  233. position: absolute;
  234. top: 0;
  235. left: 0;
  236. height: 8px;
  237. width: 100%;
  238. background: #236AFA;
  239. border-radius: 4px 4px 0px 0px;
  240. }
  241. .news-hot-title {
  242. font-size: 26px;
  243. font-weight: 400;
  244. color: #262626;
  245. line-height: 37px;
  246. }
  247. .hot-item {
  248. margin-top: 18px;
  249. padding-top: 30px;
  250. border-top: 1px solid #F1F1F1;
  251. .hot-title {
  252. font-size: 14px;
  253. font-weight: 400;
  254. color: #262626;
  255. line-height: 20px;
  256. letter-spacing: 1px;
  257. font-family: PingFangSC-Regular, PingFang SC;
  258. overflow: hidden;
  259. text-overflow: ellipsis;
  260. display: -webkit-box;
  261. -webkit-box-orient: vertical;
  262. -webkit-line-clamp: 2;
  263. }
  264. .hot-info {
  265. font-size: 10px;
  266. font-weight: 400;
  267. color: #ABABAB;
  268. line-height: 14px;
  269. margin-top: 4px;
  270. .time {
  271. margin-right: 48px;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. </style>