cmsinfo.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="container">
  3. <view class="title" :style="{ height: height + 'px', lineHeight: height + 'px', paddingTop: top + 'px' }">
  4. <uni-icons @click="back" class="back" color="#fff" type="back" size="25"></uni-icons>
  5. <text>{{ info.title }}</text>
  6. </view>
  7. <!-- <text class="time">创建时间:{{ info.createTime }}</text> -->
  8. <rich-text image-menu-prevent="true" :nodes="info.content || info.noticeContent" class="content" :style="{ marginTop: height + top + 'px' }"></rich-text>
  9. <!-- <view class="content" v-html="info.content || info.noticeContent"> -->
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import request from '../../api/cms.js';
  15. import requestNotice from '../../api/system.js';
  16. export default {
  17. onLoad: function (option) {
  18. this.id = option.id;
  19. },
  20. data() {
  21. return {
  22. id: '',
  23. info: null,
  24. height: 60,
  25. top: 25,
  26. }
  27. },
  28. async mounted() {
  29. const res = await request.getArticleDetail({ id: this.id });
  30. this.info = res.data;
  31. await request.addBlogViews({ id: this.id });
  32. const client = wx.getMenuButtonBoundingClientRect();
  33. this.height = client.height;
  34. this.top = client.top;
  35. },
  36. methods: {
  37. back() {
  38. uni.navigateBack();
  39. }
  40. }
  41. }
  42. </script>
  43. <style>
  44. .title {
  45. position: fixed;
  46. color: #fff;
  47. background-color: #fd6b18;
  48. top: 0;
  49. width: 100%;
  50. }
  51. .back {
  52. margin: 0 15px 0 5px;
  53. }
  54. .time {
  55. width: 100%;
  56. text-align: center;
  57. display: block;
  58. font-size: 12px;
  59. }
  60. .content {
  61. display: block;
  62. width: 90%;
  63. margin: 10px auto;
  64. }
  65. </style>