|
|
@ -65,9 +65,9 @@ |
|
|
|
const newStyle = 'width: 85% !important; height: auto;'; |
|
|
|
const newStyle = 'width: 85% !important; height: auto;'; |
|
|
|
const regex = /(<img[^>]*?\s+style=")([^"]*)("[^>]*?>)/g; |
|
|
|
const regex = /(<img[^>]*?\s+style=")([^"]*)("[^>]*?>)/g; |
|
|
|
const newStr = str.replace(regex, `$1${newStyle}$3`); |
|
|
|
const newStr = str.replace(regex, `$1${newStyle}$3`); |
|
|
|
const videoStr = this.replaceAllVideoTagStyles(str, "width: 95%; height: 450rpx;display: block;margin:0 auto") |
|
|
|
// const brStr = str.replace(/\r\n/g,"<br />") |
|
|
|
// const imgStr = videoStr.replace(regex, `$1${newStyle}$3`); |
|
|
|
const videoStr = this.replaceAllVideoTagStyles(newStr, "width: 95%; height: 450rpx;display: block;margin:0 auto") |
|
|
|
const imgStr = this.addImgStyle(videoStr) |
|
|
|
const imgStr = videoStr.replace(regex, `$1${newStyle}$3`); |
|
|
|
message.mainBody = imgStr |
|
|
|
message.mainBody = imgStr |
|
|
|
this.form = message |
|
|
|
this.form = message |
|
|
|
uni.hideLoading() |
|
|
|
uni.hideLoading() |
|
|
@ -103,17 +103,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
return newStr; |
|
|
|
return newStr; |
|
|
|
}, |
|
|
|
}, |
|
|
|
addImgStyle(str) { |
|
|
|
|
|
|
|
return str.replace(/<(img).*?(\/>|<\/img>)/g, function (a) { |
|
|
|
|
|
|
|
if (a.indexOf('style') < 0) { |
|
|
|
|
|
|
|
// 字符串中没有style |
|
|
|
|
|
|
|
return a.replace(/<\s*img/, '< img style="width:100%"'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 字符串中有style |
|
|
|
|
|
|
|
return a.replace(/style=("|')/, 'style=$1width: 85% !important; height: auto;') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 下载附件 |
|
|
|
// 下载附件 |
|
|
|
download(item) { |
|
|
|
download(item) { |
|
|
|
this.$util.to(`../send/send?url=${item.filePath}©Writing=${item.fileName}`) |
|
|
|
this.$util.to(`../send/send?url=${item.filePath}©Writing=${item.fileName}`) |
|
|
@ -199,9 +188,6 @@ |
|
|
|
img,image{ |
|
|
|
img,image{ |
|
|
|
width: 100% !important; |
|
|
|
width: 100% !important; |
|
|
|
} |
|
|
|
} |
|
|
|
/deep/ image,img { |
|
|
|
|
|
|
|
margin: 0 auto; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.files { |
|
|
|
.files { |
|
|
|
margin-top: 20rpx; |
|
|
|
margin-top: 20rpx; |
|
|
|