_id.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="client-details-page">
  3. <div :style="{backgroundImage: 'url(' + bannerDefault + ')'}" class="client-banner-box"></div>
  4. <!-- 详情页 -->
  5. <div class="client-details-box">
  6. <div class="client-container">
  7. <!--行业资讯详情-->
  8. <h1>{{infoData.title}}</h1>
  9. <p class="details-visits-box"><i></i><span>{{infoData.createDate}}</span>
  10. </p>
  11. <div class="client-content-box" v-html="infoData.content"></div>
  12. <div class="client-details-pagination">
  13. <a v-show="infoData.lastId" :href="`${baseUrl}/news/${infoData.lastId}`">
  14. <span class="mta-hidden-xs" @click.prevent="changeNews(infoData.lastId)" :title="'上一篇:'+infoData.lastTitle">上一篇:{{infoData.lastTitle}}</span>
  15. </a>
  16. <a v-show="infoData.nextId" :href="`${baseUrl}/news/${infoData.nextId}`">
  17. <span class="mta-hidden-xs" @click.prevent="changeNews(infoData.nextId)" :title="'下一篇:'+infoData.nextTitle">下一篇:{{infoData.nextTitle}}</span>
  18. </a>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import { mapGetters } from 'vuex';
  26. export default {
  27. name: 'news_id',
  28. layout: 'templateB',
  29. async asyncData({ params, $axios, store }) {
  30. // 设置选中菜单
  31. store.commit('setActiveNav', '/news');
  32. try {
  33. const url = '/common/client/web/news/info';
  34. const opt = {
  35. id: params.id,
  36. };
  37. const res = await $axios.post(url, opt);
  38. console.log(res);
  39. return {
  40. infoData: res.data.data,
  41. };
  42. } catch (e) {
  43. return {};
  44. }
  45. },
  46. head(){
  47. return {
  48. // title: this.infoData.title,
  49. // meta: [
  50. // {
  51. // hid: this.infoData.keyword,
  52. // name: 'description',
  53. // content: this.infoData.intro
  54. // }
  55. // ],
  56. }
  57. },
  58. computed: {
  59. baseUrl() {
  60. return this.getBaseUrl;
  61. },
  62. ...mapGetters(['getBaseUrl']),
  63. },
  64. data() {
  65. return {
  66. // banner图
  67. bannerDefault: require(`~/static/images/website/banner/cx-banner-xwzx.png`),
  68. }
  69. },
  70. methods: {
  71. changeNews(id) {
  72. this.$router.push({ name: 'news-id', params: { id } });
  73. },
  74. },
  75. };
  76. </script>
  77. <style lang="scss">
  78. .client-details-page .client-details-wrap.isRiZhi {
  79. width: 100% !important;
  80. border-right: none;
  81. h1 {
  82. text-align: center;
  83. }
  84. .details-visits-box {
  85. text-align: center;
  86. }
  87. }
  88. </style>