index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="page">
  3. <view class="noticeTitle" >{{notice.noticeTitle}}</view>
  4. <view class="flex-row justify-between" >
  5. <view class="time">
  6. 发布人:<text>{{notice.createBy}}</text>
  7. </view>
  8. <view class="time">
  9. <text>{{this.dateFormat(notice.createTime) }}</text>
  10. </view>
  11. </view>
  12. <scroll-view scroll-y="true" class="scroll-y " style="display: inline-block" :style="{'height':height}">
  13. <view class="content-box flex-col " :style="{'height':height}">
  14. <!-- <web-view src="http://www.gzqcdj.cn/doc/2.html"></web-view>-->
  15. <rich-text v-html="notice.noticeContent">
  16. </rich-text>
  17. </view>
  18. </scroll-view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. notice: {},
  26. height:''
  27. };
  28. },
  29. onLoad(option) {
  30. // 判断Openid是否为空
  31. let sysInfo=uni.getSystemInfoSync();
  32. this.height= sysInfo.windowHeight - 50 +'px';
  33. console.log("获取到的高度",this.height)
  34. this.getNoticeDetail(option.noticeId);
  35. },
  36. methods: {
  37. getNoticeDetail(id){
  38. let that = this;
  39. // 用户绑定门店
  40. this.$api.getNoticeDetail({noticeId:id}).then((res)=>{
  41. console.log('++++++++++++++++getNoticeDetail++++++++++++++++++',res)
  42. const regex = /<img\b[^>]*>/g;
  43. // const result = res.data.data.noticeContent.replace(regex, (match) => {
  44. // const newMatch = match.replace(/http:/, 'https:');
  45. // return newMatch.replace(/<img/, '<img class="content-img"');
  46. // });
  47. this.notice = res.data.data;
  48. })
  49. },
  50. // 日期格式化
  51. dateFormat(date){
  52. let time = Date.parse(date);
  53. return uni.$u.date(time, 'yyyy-mm-dd');
  54. },
  55. }
  56. };
  57. </script>
  58. <style lang="scss">
  59. @import '/common/css/common.css';
  60. @import './index.rpx.css';
  61. </style>