PageSpirit.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view>
  3. <u-navbar :autoBack="true" :title="list.title" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#121212"></u-navbar>
  4. <view class="block_3">
  5. <view class="text_3">
  6. <text class="text_10">
  7. <!-- <u-parse :content="list.content"></u-parse> -->
  8. {{ (list.content || '').replace(/<\/?[^>]*>/g, '') | removeHTMLTag }}
  9. </text>
  10. </view>
  11. <view class="box_3">
  12. <image style="width: 100%; height: 100%" :src="list.image"></image>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. let that;
  19. export default {
  20. data() {
  21. return {
  22. main_body_id: '',
  23. list: {}
  24. };
  25. },
  26. filters: {
  27. removeHTMLTag(str) {
  28. str = str.replace(/<\/?[^>]*>/g, ''); // 去除HTML tag
  29. str = str.replace(/[ | ]*\n/g, '\n'); // 去除行尾空白
  30. str = str.replace(/\n[\s| | ]*\r/g, '\n'); //去除多余空行
  31. // str = str.replace(/ /gi, ''); // 去掉
  32. const arrEntities = {
  33. lt: '<',
  34. gt: '>',
  35. nbsp: ' ',
  36. amp: '&',
  37. quot: '"'
  38. }; // 转义符换成普通字符
  39. str = str.replace(/&(lt|gt|nbsp|amp|quot);/gi, function (all, t) {
  40. return arrEntities[t];
  41. });
  42. return str;
  43. }
  44. },
  45. onLoad(o) {
  46. that = this;
  47. this.main_body_id = this.$db.get('main_body_id');
  48. this.getContentDetails(o.id);
  49. },
  50. mounted() {},
  51. methods: {
  52. // 详情
  53. getContentDetails(id) {
  54. this.$api.getContentDetails(
  55. {
  56. main_body_id: this.main_body_id,
  57. id: id
  58. },
  59. function (res) {
  60. that.list = res.data;
  61. // console.log(that.list, '99999999');
  62. }
  63. );
  64. }
  65. }
  66. };
  67. </script>
  68. <style>
  69. .box_r {
  70. display: flex;
  71. align-items: center;
  72. margin-right: 15rpx;
  73. }
  74. .sh_xs {
  75. margin: 32rpx;
  76. display: flex;
  77. flex-flow: wrap;
  78. justify-content: space-between;
  79. }
  80. .block_3 {
  81. background-color: rgba(255, 255, 255, 1);
  82. width: 749rpx;
  83. margin-top: 60rpx;
  84. display: flex;
  85. flex-direction: column;
  86. }
  87. .text_3 {
  88. width: 685rpx;
  89. height: 400rpx;
  90. text-indent: 2rem;
  91. font-size: 0rpx;
  92. overflow: scroll;
  93. line-height: 48rpx;
  94. margin: 38rpx 0 0 42rpx;
  95. }
  96. .text_10 {
  97. width: 685rpx;
  98. height: 300rpx;
  99. /* overflow-wrap: break-word; */
  100. color: rgba(49, 37, 32, 1);
  101. font-size: 30rpx;
  102. line-height: 48rpx;
  103. }
  104. .box_3 {
  105. background-color: rgba(232, 242, 217, 1);
  106. height: 422rpx;
  107. margin-top: 46rpx;
  108. display: flex;
  109. flex-direction: column;
  110. width: 750rpx;
  111. }
  112. .box_4 {
  113. background-color: rgba(0, 0, 0, 0.15);
  114. width: 750rpx;
  115. height: 422rpx;
  116. display: flex;
  117. flex-direction: column;
  118. }
  119. .paragraph_5 {
  120. width: 684rpx;
  121. height: 378rpx;
  122. overflow-wrap: break-word;
  123. color: rgba(49, 37, 32, 1);
  124. font-size: 30rpx;
  125. font-family: SourceHanSansCN-Regular;
  126. font-weight: normal;
  127. line-height: 14rpx;
  128. }
  129. .box_35 {
  130. height: 32rpx;
  131. flex-direction: row;
  132. display: flex;
  133. margin: 50rpx 0 32rpx 380rpx;
  134. }
  135. </style>