agreement.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="agreement ">
  3. <u-navbar :title="title" leftIconColor="#1a1a1a" titleStyle="color:#1a1a1a" :autoBack="true"
  4. placeholder></u-navbar>
  5. <!-- <video src="http://192.168.0.70:8181/path/2025-09-25/动态数据展示114542895.mp4" controls
  6. style="width:100%;height:200px;"></video> -->
  7. <!-- <view class="top ql-editor-box" v-html="$utils.richTextImg(agreement)"></view> -->
  8. <u-parse class="top ql-editor-box" :content="$utils.richTextImg(agreement)" ></u-parse>
  9. </view>
  10. </template>
  11. <script>
  12. // import uParse from '@/components/u-parse/u-parse.vue'
  13. import {
  14. protocolInfo,
  15. problemInfo
  16. } from '@/api/user.js'
  17. var app = getApp()
  18. export default {
  19. components: {
  20. // uParse
  21. },
  22. data() {
  23. return {
  24. title: "协议",
  25. agreement: '',
  26. balance: [],
  27. parmas: {
  28. page: 1,
  29. limit: 20,
  30. title: ''
  31. },
  32. noData: false,
  33. tabTop: 0,
  34. status: 'more', //more|loading|noMore
  35. }
  36. },
  37. onLoad(options) {
  38. if (options.type) {
  39. this.agreementInfo(options.type);
  40. if (options.type == 'user_protocol') {
  41. this.title = '用户协议';
  42. } else if (options.type == 'service_protocol') {
  43. this.title = '用户服务协议';
  44. } else if (options.type == 'privacy_protocol') {
  45. this.title = '用户隐私协议';
  46. } else if (options.type == 'about_us') {
  47. this.title = '关于我们';
  48. }
  49. }
  50. if (options.helpId) {
  51. this.title = '帮助中心';
  52. this.helpCenterInfo(options.helpId)
  53. }
  54. },
  55. methods: {
  56. agreementInfo(type) {
  57. protocolInfo({
  58. code: type
  59. }).then(res => {
  60. let data = this.replaceIframeWithVideo(res.data.protocolContent)
  61. // console.log('data', data);
  62. this.agreement = data
  63. })
  64. },
  65. replaceIframeWithVideo(html) {
  66. return html.replace(
  67. /<iframe[^>]+?src=(["'])(https?:\/\/[^"']+?\.mp4)\1[^>]*?>\s*<\/iframe>/gi,
  68. (match, quote, src) => {
  69. return `<video class="ql-video" src="${src}" controls style="width:100%;height:200px;"></video>`;
  70. }
  71. );
  72. },
  73. // 获取帮助中心详情
  74. helpCenterInfo(id) {
  75. problemInfo(id).then(res => {
  76. this.agreement = res.data.replyContent
  77. })
  78. }
  79. }
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. ::v-deep .u-navbar__content,
  84. ::v-deep .u-status-bar {
  85. background-color: #fff !important;
  86. color: #1a1a1a;
  87. }
  88. .agreement {
  89. width: 100%;
  90. overflow: hidden;
  91. padding: 0 20rpx;
  92. box-sizing: border-box;
  93. min-height: 100vh;
  94. // background-color: #fff;
  95. }
  96. .topsearch {
  97. position: fixed;
  98. left: 0;
  99. width: 100%;
  100. z-index: 2;
  101. box-sizing: border-box;
  102. background-color: #fff;
  103. }
  104. .topsbox {
  105. padding: 80rpx 30rpx 0;
  106. }
  107. .leftbox {
  108. height: 60rpx;
  109. line-height: 60rpx;
  110. background-color: #e6e6e6;
  111. border-radius: 30rpx;
  112. }
  113. .u-p30s {
  114. padding: 10rpx 30rpx;
  115. }
  116. .uptop {
  117. padding: 30rpx 0;
  118. width: 100%;
  119. position: relative;
  120. }
  121. .turn {
  122. transform: rotate(90deg);
  123. }
  124. .top {
  125. padding: 20rpx;
  126. }
  127. ::v-deep .hxicon {
  128. color: #1a1a1a !important;
  129. }
  130. </style>