recommendedDetails.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="box">
  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 {
  70. height: 100%;
  71. background-color: #fff9e9;
  72. }
  73. .box_r {
  74. display: flex;
  75. align-items: center;
  76. margin-right: 15rpx;
  77. }
  78. .sh_xs {
  79. margin: 32rpx;
  80. display: flex;
  81. flex-flow: wrap;
  82. justify-content: space-between;
  83. }
  84. .block_3 {
  85. /* background-color: rgba(255, 255, 255, 1); */
  86. width: 749rpx;
  87. margin-top: 60rpx;
  88. display: flex;
  89. flex-direction: column;
  90. }
  91. .text_3 {
  92. width: 685rpx;
  93. height: 400rpx;
  94. text-indent: 2rem;
  95. font-size: 0rpx;
  96. overflow: scroll;
  97. line-height: 48rpx;
  98. margin: 38rpx 0 0 42rpx;
  99. }
  100. .text_10 {
  101. width: 685rpx;
  102. height: 300rpx;
  103. /* overflow-wrap: break-word; */
  104. color: rgba(49, 37, 32, 1);
  105. font-size: 30rpx;
  106. line-height: 48rpx;
  107. }
  108. .box_3 {
  109. background-color: rgba(232, 242, 217, 1);
  110. height: 422rpx;
  111. margin-top: 46rpx;
  112. display: flex;
  113. flex-direction: column;
  114. width: 750rpx;
  115. }
  116. .box_4 {
  117. background-color: rgba(0, 0, 0, 0.15);
  118. width: 750rpx;
  119. height: 422rpx;
  120. display: flex;
  121. flex-direction: column;
  122. }
  123. .paragraph_5 {
  124. width: 684rpx;
  125. height: 378rpx;
  126. overflow-wrap: break-word;
  127. color: rgba(49, 37, 32, 1);
  128. font-size: 30rpx;
  129. font-family: SourceHanSansCN-Regular;
  130. font-weight: normal;
  131. line-height: 14rpx;
  132. }
  133. .box_35 {
  134. height: 32rpx;
  135. flex-direction: row;
  136. display: flex;
  137. margin: 50rpx 0 32rpx 380rpx;
  138. }
  139. </style>