国产化查询机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.2 KiB

2 months ago
2 months ago
2 months ago
  1. <template>
  2. <div class="detail-content">
  3. <div v-if="detailData" class="detail-info">
  4. <h2 class="detail-title">{{ detailData.overTitle }}</h2>
  5. <div class="detail-date">发布时间{{ detailData.create_time }}</div>
  6. <div class="detail-content" v-html="detailData.introHtml" />
  7. </div>
  8. <div v-else-if="loading">
  9. <p>加载中...</p>
  10. </div>
  11. <div v-else>
  12. <p>加载详情失败</p>
  13. <button @click="reloadDetail">重新加载</button>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'ColumnListMixDetail',
  20. data() {
  21. return {
  22. detailData: null,
  23. loading: true
  24. }
  25. },
  26. created() {
  27. this.loadDetailData()
  28. },
  29. methods: {
  30. loadDetailData() {
  31. this.loading = true
  32. const storedData = localStorage.getItem('columnListMixDetail')
  33. if (storedData) {
  34. this.detailData = JSON.parse(storedData)
  35. this.loading = false
  36. return
  37. }
  38. // 方式2: 如果需要从接口重新获取(推荐)
  39. // const itemId = this.$route.query.itemId
  40. // if (itemId) {
  41. // FetchTopicDetail({ id: itemId }).then(res => {
  42. // this.detailData = res.data
  43. // }).catch(err => {
  44. // console.error('获取详情失败', err)
  45. // }).finally(() => {
  46. // this.loading = false
  47. // })
  48. // } else {
  49. // this.loading = false
  50. // }
  51. },
  52. // 重新加载详情
  53. reloadDetail() {
  54. this.loadDetailData()
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. @import "~@/assets/styles/index.scss";
  61. .detail-content{
  62. height: calc(100% - 60px);
  63. overflow-y: scroll;
  64. }
  65. .detail-info{
  66. .detail-title{
  67. font-size: 32px;
  68. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  69. font-weight: 400;
  70. color: #333333;
  71. line-height: 100px;
  72. text-align: center;
  73. }
  74. .detail-date{
  75. text-align: center;
  76. margin-bottom: 20px;
  77. }
  78. .detail-content{
  79. ::v-deep p{
  80. span{
  81. display: block !important;
  82. text-indent:2em !important;
  83. }
  84. img{
  85. display: block;
  86. margin: 10px auto;
  87. }
  88. }
  89. }
  90. }
  91. </style>