Commit b22ebbc0 by 杨明

fixed

1 parent eb3ecee4
...@@ -345,8 +345,11 @@ export default { ...@@ -345,8 +345,11 @@ export default {
return return
} }
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const arrBase64 = imgFile.split(',')
this.imageList.uploadApi({ file: base64 }).then(res => { const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
// const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.imageList.uploadApi({ file: fileUrl }).then(res => {
if (res) { if (res) {
let len = this.previewList.length - 1 let len = this.previewList.length - 1
this.previewList[len].attContent = res this.previewList[len].attContent = res
...@@ -371,8 +374,11 @@ export default { ...@@ -371,8 +374,11 @@ export default {
reader.readAsDataURL(file) reader.readAsDataURL(file)
reader.onload = e => { reader.onload = e => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const arrBase64 = imgFile.split(',')
this.videoList.uploadApi({ file: base64 }).then(res => { const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
// const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.videoList.uploadApi({ file: fileUrl }).then(res => {
if (res) { if (res) {
this.previewList.push({ this.previewList.push({
attType: this.ATT_TYPE.VEDIO, attType: this.ATT_TYPE.VEDIO,
...@@ -502,17 +508,28 @@ export default { ...@@ -502,17 +508,28 @@ export default {
}) })
}) })
} }
console.log(html)
const idx = this.previewList.findIndex(item => item.attType == this.ATT_TYPE.TEXT) const idx = this.previewList.findIndex(item => item.attType == this.ATT_TYPE.TEXT)
if (idx !== -1) { if (idx !== -1) {
if (!this.previewList[idx].attContent) { if (!this.previewList[idx].attContent) {
html = html.replace('\n', '').replace(/<br\/>/g, '') html = html
.replace('\n', '')
.replace(/<br\/>/g, '')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
} }
this.$set(this.previewList, 0, { this.$set(this.previewList, 0, {
attContent: (this.previewList[idx].attContent + html).substring(0, 600), attContent: (this.previewList[idx].attContent + html).substring(0, 600),
attType: this.ATT_TYPE.TEXT attType: this.ATT_TYPE.TEXT
}) })
} else { } else {
html = html.replace('\n', '').replace(/<br\/>/g, '') html = html
.replace('\n', '')
.replace(/<br\/>/g, '')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
this.previewList.unshift({ this.previewList.unshift({
attContent: html.substring(0, 600), attContent: html.substring(0, 600),
attType: this.ATT_TYPE.TEXT attType: this.ATT_TYPE.TEXT
......
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
} }
} }
this.$set(item, 'htmlText', html.replace(/<p>/, '<p style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;word-break: break-all;-webkit-box-orient: vertical;">')) this.$set(item, 'htmlText', html.replace(/<p>/, '<p style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;word-break: break-all;-webkit-box-orient: vertical;">'))
html = html.replace(/<p><\/p>/g, '').replace(/<p>([\s\S]+?)<\/p>/, '\n$1') html = html.replace(/<p><\/p>/g, '').replace(/<p>([\s\S]+?)<\/p>/g, '\n$1')
if (materialUrl) { if (materialUrl) {
this.$set(item, 'materialContent', { materialUrl, imgCount, urlType, imgSrc, videoSrc, html }) this.$set(item, 'materialContent', { materialUrl, imgCount, urlType, imgSrc, videoSrc, html })
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!