_id.vue 2.5 KB

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