View.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="container" v-if="isShow">
  3. <view class="contentBox">
  4. <view class="headerBox">
  5. <view class="title">{{NoticeTitle}}</view>
  6. <!-- <view class="timecenter">{{NoticeDate}}</view> -->
  7. </view>
  8. <view class="article">
  9. <bctos-rich-text :nodes="NoticeContent"></bctos-rich-text>
  10. </view>
  11. <view class="bottomBox" style="display: none;">
  12. <view class="author">{{NoticeBMName}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. isShow: false,
  22. id: '',
  23. NoticeTitle: "",
  24. NoticeDate: "",
  25. NoticeContent: '',
  26. NoticeBMName: '',
  27. }
  28. },
  29. onLoad(option) {
  30. this.id = decodeURIComponent(option.id);
  31. this.getData();
  32. },
  33. methods: {
  34. getData() {
  35. let that = this;
  36. that.$admin.reqDirect({
  37. method: 'GET',
  38. url: '/api/v1/Snapshot/bulletions/' + that.id
  39. }).then(res => {
  40. if (res) {
  41. that.NoticeTitle = res.title;
  42. that.NoticeDate = res.creationTime ? that.$util.formatTime(new Date(res.creationTime)) : '';
  43. that.NoticeContent = res.content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, reSrc) {
  44. var strImg = '<img src="' + reSrc + '" style="width:100%;" />';
  45. return strImg;
  46. });
  47. that.NoticeBMName = '';
  48. }
  49. that.isShow = true;
  50. }, err => {
  51. that.$util.msg(err);
  52. })
  53. },
  54. onBackTo() {
  55. uni.navigateBack();
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="less">
  61. .contentBox {
  62. height: calc(100% - 30rpx);
  63. padding: 0 20rpx 30rpx;
  64. overflow-y: auto;
  65. }
  66. .headerBox {
  67. border-bottom: 1px #d2d2d2 solid;
  68. padding: 40rpx 0 20rpx;
  69. }
  70. .title {
  71. font-size: 36rpx;
  72. font-weight: bold;
  73. margin-bottom: 20rpx;
  74. text-align: center;
  75. }
  76. .time{
  77. font-size: 30rpx;
  78. color: #666666;
  79. text-align: right;
  80. }
  81. .timecenter {
  82. font-size: 30rpx;
  83. color: #666666;
  84. text-align: center;
  85. }
  86. .article {
  87. font-size: 28rpx;
  88. background-color: #FFFFFF;
  89. color: #777;
  90. padding: 30rpx 0;
  91. line-height: 2.5;
  92. }
  93. .bottomBox {
  94. padding-bottom: 20rpx;
  95. }
  96. .author {
  97. text-align: right;
  98. }
  99. </style>