Commit 9d3e271d authored by Mac's avatar Mac

甲鹤商品详情的显示

parent c0ac8733
......@@ -511,6 +511,8 @@ export default {
//当传过来有主播名称的时候 存入缓存
uni.setStorageSync("AnchorName", { AnchorName: option.AnchorName });
}
let basedata =uni.getStorageSync("basedata")?uni.getStorageSync("basedata"):'';
this.AppletID = basedata.home_pages.id?basedata.home_pages.id:0;
this.u = uni.getStorageSync("mall_UserInfo");
// if (!this.u) {
// this.u = {
......@@ -603,8 +605,8 @@ export default {
setTimeout(() => {
this.initImages();
}, 3000);
let basedata =uni.getStorageSync("basedata")?uni.getStorageSync("basedata"):'';
this.AppletID = basedata.home_pages.id?basedata.home_pages.id:0;
},
methods: {
clickDescription(e) {
......@@ -730,7 +732,11 @@ export default {
// /<img/g,
// '< img style="margin-top:-4px;width:100%"'
// );
this.detailContent = richtext;
this.detailContent = richtext;
if(this.AppletID==5){
this.detailContent = this.formatRichText(richtext)
}
this.loading = false;
//登录在调用评论接口
......@@ -745,6 +751,22 @@ export default {
}
);
},
formatRichText(html) {// 甲鹤小程序的时候 图片超出的处理
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
previewImage(i) {
uni.previewImage({
urls: this.imgs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment