优化详情图片的处理

master
chen 2022-04-28 16:50:21 +08:00
parent 43a6919f78
commit 1df03872a0
2 changed files with 12 additions and 4 deletions

View File

@ -651,10 +651,9 @@ const tools = {
return arrEntities[t]; return arrEntities[t];
}) })
.replace('<section', '<div') .replace('<section', '<div')
// .replace(/\<img/g, '<img style="max-width:100%!important;width:100%!important;height:auto" mode="widthFix" ') .replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
.replace(/\<img/g, '<img mode="widthFix" ') return `<img mode="widthFix" style="max-width:100%!important;height:auto" src='${p1.indexOf('http') > -1 ? p1 : 'https://7and5.cn' + p1}' />`
.replace(/src=\"/g,'src="https://7and5.cn') })
.replace(/style="[^\"]*?"/g,'style="max-width:100%!important;width:100%!important;height:auto" ');
}, },
// 检查网络状态 // 检查网络状态
networkStatus(){ networkStatus(){
@ -864,6 +863,14 @@ const tools = {
}) })
} }
}, },
/**
* @description 自动返回上一页事件
*/
automaticBack() {
setTimeout(()=>{
uni.navigateBack({delta:1})
},2000)
}
} }

View File

@ -272,6 +272,7 @@
this.allPrice = res.data.pay_price;// this.allPrice = res.data.pay_price;//
} else { } else {
this.$toolAll.tools.showToast(res.msg); this.$toolAll.tools.showToast(res.msg);
this.$toolAll.tools.automaticBack();
} }
}) })
}, },