index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view>
  3. <!-- #ifdef MP || APP-PLUS -->
  4. <view class="sys-head">
  5. <view class="sys-bar" :style="{height:sysHeight}"></view>
  6. <view class="sys-title">
  7. {{type==='privacy'?'隐私协议':'用户协议'}}
  8. <text class="iconfont icon-fanhui1" @click="goBack"></text>
  9. </view>
  10. </view>
  11. <!-- #endif -->
  12. <view class="content">
  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 + 'px';
  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,
  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: 80px 30rpx 40rpx 30rpx;
  75. line-height: 2;
  76. }
  77. .sys-head {
  78. position: fixed;
  79. width: 100%;
  80. background-color: #fff;
  81. .sys-title{
  82. height: 43px;
  83. line-height: 43px;
  84. text-align: center;
  85. position: relative;
  86. .iconfont{
  87. position: absolute;
  88. left:20rpx;
  89. }
  90. }
  91. }
  92. </style>