index.vue 1.8 KB

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