index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view class="container">
  3. <uni-title type="h1" align="center" :title="info.title || info.noticeTitle"></uni-title>
  4. <text class="time">创建时间:{{ info.createTime }}</text>
  5. <rich-text image-menu-prevent="true" :nodes="info.content || info.noticeContent" class="content"></rich-text>
  6. <!-- <view class="content" v-html="info.content || info.noticeContent"> -->
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import request from '../../api/cms.js';
  12. import requestNotice from '../../api/system.js';
  13. export default {
  14. onLoad: function (option) {
  15. this.id = option.id;
  16. this.noticeId = option.noticeId;
  17. },
  18. data() {
  19. return {
  20. id: '',
  21. info: null,
  22. noticeId: ''
  23. }
  24. },
  25. async mounted() {
  26. let res = {};
  27. if (this.id && this.id !== '') {
  28. res = await request.getArticleDetail({ id: this.id });
  29. }
  30. if (this.noticeId && this.noticeId !== '') {
  31. res = await requestNotice.getSystemNoticeDetails({ id: this.noticeId });
  32. }
  33. this.info = res.data;
  34. if (this.id && this.id !== '') await request.addBlogViews({ id: this.id });
  35. },
  36. methods: {}
  37. }
  38. </script>
  39. <style>
  40. .time {
  41. width: 100%;
  42. text-align: center;
  43. display: block;
  44. font-size: 12px;
  45. }
  46. .content {
  47. display: block;
  48. width: 90%;
  49. margin: 10px auto;
  50. }
  51. </style>