View.vue 1.8 KB

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