index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view class="container">
  3. <uni-title type="h1" class="title" 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"></view> -->
  7. </view>
  8. </template>
  9. <script>
  10. import request from '../../api/cms.js';
  11. import requestNotice from '../../api/system.js';
  12. import { BASE_URL } from '../../env.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. .title {
  52. width: 90%;
  53. margin: 0 auto;
  54. display: block;
  55. }
  56. .uni-title__base {
  57. line-height: 1.2em !important;
  58. }
  59. </style>