ContentMainText.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <ContentModuleCard title="公告正文" class="content-main-text-container">
  3. <section class="content-main-text">
  4. <pre v-html="content.contentHighlighted"></pre>
  5. </section>
  6. <AttachmentDownloadCard class="attachment-download-section" />
  7. <div></div>
  8. <Reward
  9. :beforeLeavePage="beforeLeavePage"
  10. v-if="rewardShow"
  11. :id="content.id" />
  12. <section class="others-footer">
  13. <div class="origin-link-container">
  14. <OriginLink :id="content.id" v-if="content.originalShow" />
  15. </div>
  16. <button class="feedback-button clickable" @click="feedback">
  17. 意见反馈
  18. </button>
  19. </section>
  20. </ContentModuleCard>
  21. </template>
  22. <script>
  23. import ContentModuleCard from '@/views/article/ui/ContentModuleCard.vue'
  24. import AttachmentDownloadCard from '@/views/article/components/AttachmentDownloadCard.vue'
  25. import OriginLink from '@/views/article/components/OriginLink.vue'
  26. import Reward from '@/views/article/components/Reward.vue'
  27. import { mapState, mapGetters } from 'vuex'
  28. import { LINKS } from '@/data'
  29. import { openAppOrWxPage } from '@/utils/'
  30. export default {
  31. name: 'ContentMainText',
  32. components: {
  33. AttachmentDownloadCard,
  34. OriginLink,
  35. Reward,
  36. ContentModuleCard
  37. },
  38. props: {
  39. beforeLeavePage: Function
  40. },
  41. computed: {
  42. ...mapState({
  43. content: (state) => state.article.mainModel.content
  44. }),
  45. canRead() {
  46. return this.content.isCanRead
  47. },
  48. rewardShow() {
  49. return this.canRead && this.$envs.inWX
  50. },
  51. ...mapGetters('user', ['isLogin'])
  52. },
  53. methods: {
  54. async feedback() {
  55. if (this.beforeLeavePage) {
  56. await this.beforeLeavePage()
  57. }
  58. openAppOrWxPage(LINKS.用户反馈, {
  59. query: {
  60. fkid: this.content.id
  61. }
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. ::v-deep {
  69. .content-module-main {
  70. padding: 12px 16px;
  71. background-color: $white;
  72. }
  73. }
  74. .content-main-text {
  75. margin-bottom: 16px;
  76. ::v-deep {
  77. pre {
  78. display: inherit;
  79. padding: 0;
  80. margin: 0;
  81. font-size: 14px !important;
  82. word-break: break-word;
  83. white-space: pre-wrap;
  84. color: #333;
  85. background-color: #fff;
  86. border: 0px;
  87. border-radius: 4px;
  88. line-height: 25px;
  89. overflow-x: hidden;
  90. }
  91. .content-table-container {
  92. max-width: 100%;
  93. overflow-x: scroll;
  94. }
  95. table {
  96. border-collapse: collapse !important;
  97. white-space-collapse: collapse;
  98. border-spacing: 0px !important;
  99. line-height: 21px;
  100. background: transparent;
  101. max-width: 100%;
  102. th,
  103. tr td {
  104. border: 1px solid #ebebeb;
  105. padding: 2px 4px;
  106. }
  107. }
  108. // 第三方认证服务插入样式
  109. .third-party-verify-button {
  110. color: #2cb7ca;
  111. }
  112. .icon-third-party-verify-logo {
  113. display: inline-block;
  114. width: 18px;
  115. height: 18px;
  116. background-repeat: no-repeat;
  117. background-size: contain;
  118. vertical-align: sub;
  119. }
  120. .button-text {
  121. display: inline-block;
  122. margin-left: 2px;
  123. line-height: 18px;
  124. text-decoration: underline;
  125. }
  126. }
  127. }
  128. .attachment-download-section {
  129. margin-bottom: 10px;
  130. }
  131. .icon-data-download {
  132. width: 24px;
  133. height: 24px;
  134. }
  135. .others-footer {
  136. display: flex;
  137. align-items: center;
  138. justify-content: space-between;
  139. font-size: 15px;
  140. line-height: 22px;
  141. .feedback-button {
  142. color: #9b9ca3;
  143. background: transparent;
  144. }
  145. }
  146. </style>