detail.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="detail-wrap">
  3. <el-breadcrumb separator="/" class="path">
  4. <el-breadcrumb-item :to="{ path: '/' }" class="path-home">首页</el-breadcrumb-item>
  5. <el-breadcrumb-item :to="{ path: '/cms/help/list' }">帮助列表</el-breadcrumb-item>
  6. <el-breadcrumb-item class="path-help">帮助详情</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <div class="help-detail" v-loading="loading">
  9. <div class="title">{{ detail.title }}</div>
  10. <div class="info">
  11. <div class="time">{{ $util.timeStampTurnTime(detail.create_time) }}</div>
  12. </div>
  13. <div class="content" v-html="detail.content"></div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import {
  19. mapGetters
  20. } from 'vuex';
  21. import {
  22. helpDetail
  23. } from '@/api/cms/help';
  24. export default {
  25. name: 'help_detail',
  26. components: {},
  27. data: () => {
  28. return {
  29. detail: [],
  30. loading: true
  31. };
  32. },
  33. created() {
  34. this.id = this.$route.query.id;
  35. this.getDetail();
  36. },
  37. computed: {
  38. ...mapGetters(['siteInfo'])
  39. },
  40. watch: {
  41. $route(curr) {
  42. this.id = curr.query.id;
  43. this.getDetail();
  44. }
  45. },
  46. methods: {
  47. getDetail() {
  48. helpDetail({
  49. id: this.id
  50. })
  51. .then(res => {
  52. if (res.code == 0) {
  53. if (res.data) {
  54. this.loading = false;
  55. this.detail = res.data;
  56. window.document.title = `${this.detail.title} - ${this.siteInfo.site_name}`;
  57. } else {
  58. this.$router.push({
  59. path: '/cms/help/list'
  60. });
  61. }
  62. }
  63. })
  64. .catch(err => {
  65. this.loading = false;
  66. this.$message.error(err.message);
  67. });
  68. }
  69. }
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .detail-wrap {
  74. width: 1210px;
  75. margin: 20px auto;
  76. background-color: #fff;
  77. }
  78. .path {
  79. padding: 15px;
  80. }
  81. .help-detail {
  82. background-color: #ffffff;
  83. padding: 10px;
  84. border-radius: 5px;
  85. margin: 10px 0;
  86. .title {
  87. text-align: center;
  88. font-size: 18px;
  89. margin: 10px 0;
  90. }
  91. .info {
  92. // margin: 0 43px;
  93. border-bottom: 1px dotted #e9e9e9;
  94. .time {
  95. text-align: center;
  96. color: #838383;
  97. margin-bottom: 17px;
  98. }
  99. }
  100. .content {
  101. padding-top: 10px;
  102. // margin: 0 65px;
  103. }
  104. }
  105. </style>