index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view>
  3. <view class="content">
  4. <jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  10. import parser from '@/components/jyf-parser/jyf-parser';
  11. import { getUserAgreement } from '@/api/user.js';
  12. export default {
  13. components: {
  14. 'jyf-parser': parser
  15. },
  16. data() {
  17. return {
  18. tagStyle: {
  19. img: 'width:100%;display:block;',
  20. table: 'width:100%',
  21. video: 'width:100%'
  22. },
  23. content: ``,
  24. sysHeight: sysHeight || 0,
  25. type: ''
  26. };
  27. },
  28. computed: {
  29. pageName() {
  30. let list = {
  31. privacy: '隐私协议',
  32. cancel: '注销协议',
  33. user: '用户协议',
  34. supplier: '供应商入驻协议'
  35. };
  36. uni.setNavigationBarTitle({
  37. title: list[this.type]
  38. });
  39. return list[this.type];
  40. }
  41. },
  42. onLoad(e) {
  43. this.type = e.type;
  44. if (e) {
  45. getUserAgreement(e.type)
  46. .then((res) => {
  47. this.content = res.data.content;
  48. })
  49. .catch((err) => {
  50. that.$util.Tips({
  51. title: err.msg
  52. });
  53. });
  54. } else {
  55. getUserAgreement('privacy')
  56. .then((res) => {
  57. this.content = res.data.content;
  58. })
  59. .catch((err) => {
  60. that.$util.Tips({
  61. title: err.msg
  62. });
  63. });
  64. }
  65. },
  66. mounted() {},
  67. methods: {
  68. goBack() {
  69. uni.navigateBack({
  70. delta: 1
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style scoped lang="scss">
  77. page {
  78. background-color: #fff;
  79. }
  80. .content {
  81. padding: 0 30rpx 40rpx 30rpx;
  82. }
  83. .sys-head {
  84. position: fixed;
  85. width: 100%;
  86. background-color: #fff;
  87. top: 0;
  88. left: 0;
  89. z-index: 9;
  90. .sys-title {
  91. height: 43px;
  92. line-height: 43px;
  93. text-align: center;
  94. position: relative;
  95. .iconfont {
  96. position: absolute;
  97. left: 20rpx;
  98. }
  99. }
  100. }
  101. </style>