Document.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view class="div distributor-article-list">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar :title="title" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class='main-content'>
  13. <rich-text class="div content" :nodes='content'></rich-text>
  14. </view>
  15. </view></home-base>
  16. </template>
  17. <script>
  18. import {getFontSize} from '@/util/common'
  19. import TitleHeader from '../../TitleHeader'
  20. import HomeBase from '../HomeBase'
  21. import { getDocumentInfo } from '../../../api/homeArticle'
  22. export default {
  23. name:'HomeDocument',
  24. mounted(){
  25. // #ifdef MP-WEIXIN
  26. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  27. // #endif
  28. },
  29. computed:{
  30. fontSize(){
  31. return getFontSize()
  32. },
  33. },
  34. data(){
  35. return {
  36. navHeight: 0,
  37. title: '',
  38. content: ''
  39. }
  40. },
  41. components:{
  42. TitleHeader,
  43. HomeBase,
  44. },
  45. onLoad: function (option) {
  46. let type = option.type
  47. getDocumentInfo(type).then(res => {
  48. this.title = res.result.document_title
  49. this.content = res.result.document_content
  50. }).catch(function (error) {
  51. uni.showToast({icon:'none',title: error.message})
  52. })
  53. },
  54. methods:{
  55. goBack(){
  56. uni.navigateBack({delta:1})
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .main-content{padding: 0 $pageSpace;box-sizing: border-box;}
  63. .content{padding:.5rem;font-size:$subFontSize;}
  64. </style>