index.vue 1.6 KB

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