ContentMainText.vue 4.4 KB

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