fixbug: 修改实名认证&咨询的bug
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
<view class="title_">{{ newsDetail.title }}</view>
|
||||
<view class="avatar_">
|
||||
<view>
|
||||
<up-image :src="newsDetail.avatar_url" width="40" height="40" bgColor="#f1f6ff00" shape="circle"></up-image>
|
||||
<up-image :src="newsDetail.avatar_url" width="40" height="40" bgColor="#f1f6ff00"
|
||||
shape="circle"></up-image>
|
||||
</view>
|
||||
<view style="margin-left: 12rpx;">{{ newsDetail.name }}</view>
|
||||
</view>
|
||||
@@ -14,14 +15,17 @@
|
||||
<view>{{ formatDate(newsDetail.ctdate) }}</view>
|
||||
<view class="browses_">
|
||||
<view>
|
||||
<up-image src="/pages/login_package/static/login/show.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
|
||||
<up-image src="/pages/login_package/static/login/show.png" width="20" height="20"
|
||||
bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
<view style="margin-left: 8rpx;">{{ newsDetail.browses }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="news_info_fg_warp"></view>
|
||||
<view class="news_info_content_warp" v-html="newsDetail.content"></view>
|
||||
<view class="news_info_content_warp">
|
||||
<up-parse :content="formattedContent" :tagStyle="{ img: 'max-width:100% !important;height:auto !important;display:block;margin:10rpx auto;' }"></up-parse>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -38,6 +42,23 @@ export default {
|
||||
newsDetail: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formattedContent() {
|
||||
if (!this.newsDetail || !this.newsDetail.content) return '';
|
||||
let content = this.newsDetail.content;
|
||||
// 兼容小程序富文本:给所有 img 注入自适应宽度样式,避免原图过大导致横向滚动
|
||||
content = content.replace(/<img[^>]*>/gi, (match) => {
|
||||
if (/style\s*=\s*["'][^"']*["']/i.test(match)) {
|
||||
return match.replace(/style\s*=\s*(["'])([^"']*)\1/i, (m, quote, val) => {
|
||||
return `style=${quote}${val};max-width:100% !important;height:auto !important;display:block;margin:10rpx auto;${quote}`;
|
||||
});
|
||||
} else {
|
||||
return match.replace(/<img/i, '<img style="max-width:100% !important;height:auto !important;display:block;margin:10rpx auto;"');
|
||||
}
|
||||
});
|
||||
return content;
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
const id = option.id;
|
||||
if (id && id !== "null") {
|
||||
@@ -104,7 +125,10 @@ export default {
|
||||
.news_info_content_warp {
|
||||
padding: 30rpx;
|
||||
height: calc(100vh - 524rpx);
|
||||
overflow: auto;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
box-sizing: border-box;
|
||||
word-break: break-all;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user