agreement.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view class="agreement">
  3. <u-navbar :title="title" leftIconColor="#1a1a1a" titleStyle="color:#1a1a1a" :autoBack="true"
  4. placeholder></u-navbar>
  5. <!-- <video class="ql-video" src="http://192.168.0.70:8181/path/2025-09-25/动态数据展示114542895.mp4" controls style="width: 100%; height: 200px;"></video> -->
  6. <view class="top ql-editor-box" v-html="$utils.richTextImg(agreement)">
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. protocolInfo,
  13. problemInfo
  14. } from '@/api/user.js'
  15. var app = getApp()
  16. export default {
  17. data() {
  18. return {
  19. title: "协议",
  20. agreement: '',
  21. balance: [],
  22. parmas: {
  23. page: 1,
  24. limit: 20,
  25. title: ''
  26. },
  27. noData: false,
  28. tabTop: 0,
  29. status: 'more', //more|loading|noMore
  30. }
  31. },
  32. onLoad(options) {
  33. if (options.type) {
  34. this.agreementInfo(options.type);
  35. if (options.type == 'user_protocol') {
  36. this.title = '用户协议';
  37. } else if (options.type == 'service_protocol') {
  38. this.title = '服务协议';
  39. } else if (options.type == 'privacy_protocol') {
  40. this.title = '隐私协议';
  41. } else if (options.type == 'about_us') {
  42. this.title = '关于我们';
  43. }
  44. }
  45. if (options.helpId) {
  46. this.title = '帮助中心';
  47. this.helpCenterInfo(options.helpId)
  48. }
  49. },
  50. methods: {
  51. agreementInfo(type) {
  52. protocolInfo({
  53. code: type
  54. }).then(res => {
  55. let data = this.replaceIframeWithVideo(res.data.protocolContent)
  56. console.log('data',data);
  57. this.agreement = data
  58. })
  59. },
  60. replaceIframeWithVideo(html) {
  61. return html.replace(
  62. /<iframe[^>]+?src=(["'])(https?:\/\/[^"']+?\.mp4)\1[^>]*?>\s*<\/iframe>/gi,
  63. (match, quote, src) => {
  64. return `<video src="${src}" controls style="width: 100px; height: 200px;"></video>`;
  65. }
  66. );
  67. },
  68. // 获取帮助中心详情
  69. helpCenterInfo(id) {
  70. problemInfo(id).then(res => {
  71. this.agreement = res.data.replyContent
  72. })
  73. }
  74. }
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. ::v-deep .u-navbar__content,
  79. ::v-deep .u-status-bar {
  80. background-color: #fff !important;
  81. color: #1a1a1a;
  82. }
  83. .agreement {
  84. width: 100%;
  85. overflow: hidden;
  86. }
  87. .topsearch {
  88. position: fixed;
  89. left: 0;
  90. width: 100%;
  91. z-index: 2;
  92. box-sizing: border-box;
  93. background-color: #fff;
  94. }
  95. .topsbox {
  96. padding: 80rpx 30rpx 0;
  97. }
  98. .leftbox {
  99. height: 60rpx;
  100. line-height: 60rpx;
  101. background-color: #e6e6e6;
  102. border-radius: 30rpx;
  103. }
  104. .u-p30s {
  105. padding: 10rpx 30rpx;
  106. }
  107. .uptop {
  108. padding: 30rpx 0;
  109. width: 100%;
  110. position: relative;
  111. }
  112. .turn {
  113. transform: rotate(90deg);
  114. }
  115. .top {
  116. padding: 20rpx;
  117. }
  118. ::v-deep .hxicon {
  119. color: #1a1a1a !important;
  120. }
  121. // 富文本展示
  122. .ql-editor-box {
  123. text-align: justify;
  124. font-family: auto !important;
  125. ::v-deep .ql-indent-1 {
  126. margin-left: 96rpx;
  127. }
  128. ::v-deep .ql-indent-2 {
  129. margin-left: 192rpx;
  130. }
  131. ::v-deep .ql-indent-3 {
  132. margin-left: 288rpx;
  133. }
  134. ::v-deep .ql-indent-4 {
  135. margin-left: 384rpx;
  136. }
  137. ::v-deep .ql-indent-5 {
  138. margin-left: 480rpx;
  139. }
  140. ::v-deep .ql-indent-6 {
  141. margin-left: 576rpx;
  142. }
  143. ::v-deep .ql-indent-7 {
  144. margin-left: 672rpx;
  145. }
  146. ::v-deep .ql-indent-8 {
  147. margin-left: 768rpx;
  148. }
  149. ::v-deep img {
  150. max-width: 100%;
  151. }
  152. ::v-deep .ql-align-center {
  153. text-align: center;
  154. }
  155. ::v-deep .ql-align-right {
  156. text-align: right;
  157. }
  158. ::v-deep blockquote {
  159. display: block;
  160. border-left: 8px solid #d0e5f2;
  161. padding: 5px 10px;
  162. margin: 10px 0;
  163. line-height: 1.4;
  164. font-size: 100%;
  165. background-color: #f1f1f1;
  166. }
  167. ::v-deep .ql-indent-1 {
  168. margin-left: 60rpx;
  169. }
  170. ::v-deep .ql-indent-2 {
  171. margin-left: 120rpx;
  172. }
  173. ::v-deep .ql-indent-3 {
  174. margin-left: 180rpx;
  175. }
  176. ::v-deep .ql-indent-4 {
  177. margin-left: 240rpx;
  178. }
  179. ::v-deep .ql-indent-5 {
  180. margin-left: 300rpx;
  181. }
  182. ::v-deep .ql-size-huge {
  183. font-size: 80rpx;
  184. display: inline-block;
  185. line-height: 90rpx;
  186. }
  187. ::v-deep .ql-size-large {
  188. font-size: 48rpx;
  189. display: inline-block;
  190. line-height: 50rpx;
  191. }
  192. ::v-deep .ql-size-small {
  193. font-size: 24rpx;
  194. display: inline-block;
  195. line-height: 30rpx;
  196. }
  197. ::v-deep .ql-font-serif {
  198. font-family: Georgia, Times New Roman, serif;
  199. }
  200. ::v-deep .ql-font-monospace {
  201. font-family: Monaco, Courier New, monospace;
  202. }
  203. }
  204. </style>