index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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:'user'
  37. }
  38. },
  39. onLoad(e) {
  40. this.type = e.type;
  41. uni.showLoading({
  42. title: '加载中',
  43. mask:true
  44. });
  45. if(e){
  46. console.log(e,'e');
  47. getUserAgreement(e.type).then(res => {
  48. console.log(res,'res1');
  49. this.content = res.data.content;
  50. setTimeout(()=>{
  51. this.$nextTick(()=>{
  52. uni.hideLoading()
  53. })
  54. },5000)
  55. }).catch(err => {
  56. that.$util.Tips({
  57. title: err.msg
  58. });
  59. })
  60. }else{
  61. getUserAgreement('privacy').then(res => {
  62. uni.hideLoading()
  63. console.log(res,'res2');
  64. this.content = res.data.content;
  65. setTimeout(()=>{
  66. this.$nextTick(()=>{
  67. uni.hideLoading()
  68. })
  69. },5000)
  70. }).catch(err => {
  71. that.$util.Tips({
  72. title: err.msg
  73. });
  74. })
  75. }
  76. },
  77. mounted() {},
  78. methods: {
  79. goBack(){
  80. uni.navigateBack({
  81. delta: 1
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. page{
  89. background-color: #fff;
  90. }
  91. .content {
  92. padding: 0 30rpx 40rpx 30rpx;
  93. }
  94. .sys-head {
  95. position: fixed;
  96. width: 100%;
  97. background-color: #fff;
  98. top:0;
  99. left:0;
  100. z-index: 9;
  101. .sys-title{
  102. height: 43px;
  103. line-height: 43px;
  104. text-align: center;
  105. position: relative;
  106. .iconfont{
  107. position: absolute;
  108. left:20rpx;
  109. }
  110. }
  111. }
  112. </style>