newssqdetail.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="ndetail ">
  3. <!-- 详情 -->
  4. <view class="ndbox mb12">
  5. <view class="plr15">
  6. <view class="tit">{{datainfo.communityTitle}}</view>
  7. <view class="time mb12">{{datainfo.publishTime}}</view>
  8. <view class="rich">
  9. <rich-text :nodes="communityContent" style="word-break: break-all;"></rich-text>
  10. </view>
  11. </view>
  12. <view class="ndbfox flexc">
  13. <view class="flexcc ndbflist">
  14. <image :src="nicona"></image>
  15. <view>32</view>
  16. </view>
  17. <view class="flexcc ndbflist">
  18. <image :src="niconb"></image>
  19. <view>32</view>
  20. </view>
  21. <view class="flexcc ndbflist">
  22. <image :src="niconc"></image>
  23. <view>32</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="ndbox mb12 plr15">
  28. <view class="pltit">评论<text>(31)</text></view>
  29. <!-- 评论列表 -->
  30. <view class="pllist flex">
  31. <image :src="head" class="head"></image>
  32. <view class="flex1 overh">
  33. <view class="flexat mb14 ">
  34. <view class="plname flex1 over">床前明月光</view>
  35. <view class="plrbtn flexc flex0">
  36. <!-- <image :src="niconb" class="imga"></image> -->
  37. <image :src="nicond"></image>
  38. <view>点赞</view>
  39. </view>
  40. <view class="plrbtn flexc flex0">
  41. <image :src="nicone" class="imgb"></image>
  42. <view>回复</view>
  43. </view>
  44. </view>
  45. <view class="infotxt mb15">支持!去看一下优惠政策!<view class="infotime">12-3</view></view>
  46. </view>
  47. </view>
  48. <view class="pllist flex">
  49. <image :src="head" class="head"></image>
  50. <view class="flex1 overh">
  51. <view class="flexat mb14 ">
  52. <view class="plname flex1 over">疑是地上霜</view>
  53. <view class="plrbtn flexc flex0">
  54. <image :src="niconb" class="imga"></image>
  55. <!-- <image :src="nicond"></image> -->
  56. <view>点赞</view>
  57. </view>
  58. <view class="plrbtn flexc flex0">
  59. <image :src="nicone" class="imgb"></image>
  60. <view>回复</view>
  61. </view>
  62. </view>
  63. <view class="infotxt mb15">提前缴一年的物业费,可以免一个月吗?<view class="infotime">12-3</view></view>
  64. <!-- 二级回复 -->
  65. <view class="pllist flex">
  66. <image :src="head" class="head"></image>
  67. <view class="flex1 overh">
  68. <view class="flexat mb14 ">
  69. <view class="plname flex1 over">幸福小区物业</view>
  70. <view class="plrbtn flexc flex0">
  71. <image :src="niconb" class="imga"></image>
  72. <!-- <image :src="nicond"></image> -->
  73. <view>点赞</view>
  74. </view>
  75. <view class="plrbtn flexc flex0">
  76. <image :src="nicone" class="imgb"></image>
  77. <view>回复</view>
  78. </view>
  79. </view>
  80. <view class="infotxt mb15">尊敬的业主朋友,您的建议我司已收到,将在内 部讨论后于物业公告中告知结果,谢谢您的宝贵 建议!<view class="infotime">12-3</view></view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 评论 -->
  87. <view class="pjfbtn">
  88. <view class="flexc pjfbox">
  89. <uni-easyinput type="textarea" autoHeight v-model="text" :inputBorder='false' placeholder="发表我的评论…" />
  90. <view class="btns">发送</view>
  91. </view>
  92. </view>
  93. <loading></loading>
  94. </view>
  95. </template>
  96. <script>
  97. import config from '@/config'
  98. const baseUrl = config.baseUrl
  99. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  100. import {newsDet} from "@/api/work/manage.js"
  101. export default{
  102. components:{},
  103. data(){
  104. return{
  105. nicona:require('@/manage/static/news/nicona.png'),
  106. niconb:require('@/manage/static/news/niconb.png'),
  107. niconc:require('@/manage/static/news/niconc.png'),
  108. nicond:require('@/manage/static/news/nicond.png'),
  109. nicone:require('@/manage/static/news/nicone.png'),
  110. head:require('@/manage/static/news/head.png'),
  111. datainfo:{
  112. },
  113. communityContent:'<span>hello uni-app x!</span><br/><span>uni-app x,终极跨平台方案</span>',
  114. text:'',
  115. id:"",
  116. }
  117. },
  118. onLoad: function(e) {
  119. this.id=e.id;
  120. // this.getDetailFn()
  121. },
  122. // 上拉触底加载更多触发事件
  123. onReachBottom() {
  124. if (this.reachflag) {
  125. this.pageNum++
  126. this.getDataFn()
  127. }
  128. },
  129. methods:{
  130. checkPermi, checkRole,
  131. getDetailFn(){
  132. newsDet(this.id).then(res=>{
  133. if(res.code==200){
  134. this.datainfo=res.data;
  135. var data=JSON.parse(JSON.stringify(res.data))
  136. if(data.communityContent){
  137. this.communityContent=this.formatRichText(data.communityContent)
  138. }
  139. }
  140. })
  141. },
  142. //解析富文本方法
  143. formatRichText(html) {
  144. let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
  145. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '').replace(/style=""/gi, '');
  146. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  147. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  148. return match;
  149. });
  150. newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
  151. match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
  152. return match;
  153. });
  154. newContent = newContent.replace(/<br[^>]*\/>/gi, '');
  155. newContent = newContent.replace(/\<img src="/gi,
  156. '<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;" src="' +baseUrlimg);
  157. return newContent;
  158. },
  159. }
  160. }
  161. </script>
  162. <style>
  163. page{background: #F3F3F0;}
  164. </style>
  165. <style lang="scss" scoped>
  166. .ndetail{
  167. min-height: 100vh;padding: 20rpx 18rpx 100rpx;
  168. .ndbox{background: #FFFFFF;border-radius: 20rpx;padding-top: 30rpx;
  169. .tit{font-weight: bold;font-size: 32rpx;color: #272727;margin-bottom: 14rpx;text-align: center;padding-top: 4rpx;}
  170. .time{font-weight: 500;font-size: 24rpx;color: #AAAAAA;text-align: center;}
  171. .rich{border-top: 2rpx solid #E5E5E5;padding: 28rpx 0;}
  172. .ndbfox{
  173. border-top: 2rpx solid #E5E5E5;
  174. .ndbflist{width: 33.3%;min-height: 78rpx;padding: 16rpx 0;box-sizing: border-box;
  175. image{width: 26rpx;height: 26rpx;margin-right: 26rpx;}
  176. view{font-weight: 500;font-size: 26rpx;color: #666666;}
  177. }
  178. }
  179. }
  180. }
  181. .pltit{font-weight: bold;font-size: 30rpx;color: #272727;
  182. text{margin-left: 24rpx;font-size: 24rpx;color: #666666;}
  183. }
  184. .pllist{padding-top: 20rpx;margin-bottom: 16rpx;border-bottom: 2rpx solid #DADADA;
  185. .head{width: 40rpx;height: 40rpx;margin-right: 18rpx;flex: 0 0 auto;}
  186. .plname{font-weight: bold;font-size: 30rpx;color: #161616;}
  187. .plrbtn{margin-left: 36rpx;
  188. image{width: 26rpx;height: 24rpx;margin-right: 16rpx;
  189. &.imga{width: 26rpx;height: 26rpx;}
  190. &.imgb{width: 26rpx;height: 22rpx;}
  191. }
  192. view{font-weight: bold;font-size: 24rpx;color: #314081;}
  193. }
  194. .infotxt{font-weight: 500;font-size: 26rpx;color: #161616;line-height: 40rpx;
  195. &:before {content: "";float: right;width: 0;height: calc(100% - 16px);background: red;}
  196. .infotime{font-weight: 500;font-size: 24rpx;color: #666666; float: right;clear: both;}
  197. }
  198. .pllist{
  199. padding-top: 0;border-bottom: none;margin-bottom: 0;
  200. }
  201. }
  202. .pjfbtn{background: #FFFFFF;position: fixed;bottom: 0;left: 0;right: 0;padding:20rpx 48rpx;box-shadow: 0px 0px 18rpx 0px rgba(159,159,159,0.47);
  203. .pjfbox{background: #E6E6E6;border-radius: 10rpx;
  204. .btns{nt-weight: bold;padding: 0 34rpx;height: 60rpx;line-height: 60rpx;flex: 0 0 auto;
  205. font-size: 26rpx;
  206. }
  207. color: #314081;}
  208. }
  209. .pjfbtn /deep/ .uni-easyinput{flex: 1;font-size: 26rpx;color: #222327;}
  210. .pjfbtn /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;margin: 0;background: #E6E6E6;box-sizing: border-box;padding: 10rpx 0 10rpx 36rpx;border-radius:10rpx 0 0 10rpx;}
  211. </style>