|
@@ -0,0 +1,70 @@
|
|
|
+<template>
|
|
|
+ <mobile-frame>
|
|
|
+ <view class="main">
|
|
|
+ <view class="one">
|
|
|
+ <rich-text :nodes="formatRichText(info.agreement)"></rich-text>
|
|
|
+ <rich-text :nodes="formatRichText(info.secret)"></rich-text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </mobile-frame>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ export default {
|
|
|
+ components: {},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ info: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onShow: function() {
|
|
|
+ const that = this;
|
|
|
+ that.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ search() {
|
|
|
+ const that = this;
|
|
|
+ try {
|
|
|
+ const res = uni.getStorageSync('config');
|
|
|
+ if (res) that.$set(that, `info`, res);
|
|
|
+ } catch (err) {
|
|
|
+ uni.showToast({
|
|
|
+ title: err.errmsg,
|
|
|
+ icon: 'error',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 处理富文本
|
|
|
+ formatRichText(html) {
|
|
|
+ if (html) {
|
|
|
+ // 富文本内容格式化
|
|
|
+ return html && html.replace(/<img[^>]*>/gi, function(match, capture) {
|
|
|
+ // 查找所有的 img 元素
|
|
|
+ return match.replace(/style=".*"/gi, '').replace(/style='.*'/gi,
|
|
|
+ '')
|
|
|
+ // 删除找到的所有 img 元素中的 style 属性
|
|
|
+ }).replace(/\<img/gi, '<img style="width:100%;"') // 对 img 元素增加 style 属性,并设置宽度为 100%
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .main {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+
|
|
|
+ .one {
|
|
|
+ padding: 2vw;
|
|
|
+
|
|
|
+ .rich-img {
|
|
|
+ width: 100% !important;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|