123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="container main">
- <view class="one">
- <view class="one_1">联系电话</view>
- <view class="one_2">
- <text class="t-icon t-icon-bohao"></text>
- <text :user-select="true"> {{info.Phone||'暂无'}}</text>
- </view>
- </view>
- <view class="one">
- <view class="one_1">电子邮箱</view>
- <view class="one_2">
- <text class="t-icon t-icon-youxiang"></text>
- <text :user-select="true"> {{info.Email||'暂无'}}</text>
- </view>
- </view>
- <view class="one">
- <view class="one_1">公司</view>
- <view class="one_2">
- <text class="t-icon t-icon-gongsi"></text>
- <text :user-select="true"> {{info.Company||'暂无'}}</text>
- </view>
- </view>
- <view class="one">
- <view class="one_1">地址</view>
- <view class="one_2">
- <text class="t-icon t-icon-zuobiao"></text>
- <text :user-select="true"> {{info.Address||'暂无'}}</text>
- </view>
- </view>
- <view class="one">
- <view class="one_1">公众号</view>
- <view class="one_2">
- <image class="image" :show-menu-by-longpress="true" :src="getUrl(info.Code)"></image>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- config: {},
- info: {},
- }
- },
- onLoad: async function(e) {
- const that = this;
- that.searchConfig();
- },
- methods: {
- searchConfig() {
- const that = this;
- try {
- const res = uni.getStorageSync('config');
- if (res) {
- that.$set(that, `config`, res);
- that.$set(that, `info`, res?.footInfo);
- }
- } catch (e) {}
- },
- // 图片处理
- getUrl(e) {
- const that = this;
- if (e && e.length > 0) return that.$config.serverFile + e[0].url
- else return '/static/match.png'
- },
- // 处理富文本
- formatRichText(html) {
- if (html) {
- html = html.replace(/<table[^>]*>/gi, match => {
- // 如果已有 style 属性,替换为新的样式;如果没有,添加新的 style 属性
- return match.replace(/style="[^"]+"/gi,
- `style="border-collapse: collapse; width: 100%;text-align: center;"`)
- .replace(/<table/gi,
- `<table style="border-collapse: collapse; width: 100%;text-align: center;"`);
- });
- html = html.replace(/<th[^>]*>/gi, match => {
- // 如果已有 style 属性,替换为新的样式;如果没有,添加新的 style 属性
- return match.replace(/style="[^"]+"/gi,
- `style="border: 1px solid #ddd; padding: 8px; background-color: #f2f2f2;text-align: center;"`
- )
- .replace(/<table/gi,
- `<table style="border: 1px solid #ddd; padding: 8px; background-color: #f2f2f2;text-align: center;"`
- );
- });
- html = html.replace(/<td[^>]*>/gi, match => {
- // 如果已有 style 属性,替换为新的样式;如果没有,添加新的 style 属性
- return match.replace(/style="[^"]+"/gi,
- `style="border: 1px solid #ddd; padding: 8px;text-align: center;"`)
- .replace(/<table/gi,
- `<table style="border: 1px solid #ddd; padding: 8px;text-align: center;"`);
- });
- // 富文本内容格式化
- 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" scoped>
- .main {
- background-color: var(--f9Color);
- .one {
- padding: 2vw;
- margin: 2vw 0 0 0;
- background-color: var(--mainColor);
- .one_1 {
- text-indent: 10px;
- border-left: 3px solid var(--f3CColor);
- font-weight: bold;
- font-size: var(--font16Size);
- }
- .one_2 {
- padding: 2vw;
- font-size: var(--font14Size);
- color: var(--f69Color);
- display: flex;
- align-items: center;
- .t-icon {
- width: var(--font14Size);
- height: var(--font14Size);
- }
- text {
- margin: 0 0 0 1vw;
- }
- .image {
- width: 150px;
- height: 150px;
- }
- }
- }
- }
- </style>
|