_id.vue 8.6 KB

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