Commit 931751ba by 前端

bug修复

1 parent 4065af51
......@@ -389,12 +389,12 @@ export default {
// })
console.log(this.previewList)
if (this.previewList.length) {
this.updateList(this.previewList, 1)
// this.previewList.map((item) => {
// if (item.materialType == ATT_TYPE.TEXT) {
// // this.textValue = item.materialContent
// }
// })
// this.updateList(this.previewList, 1)
this.previewList.map((item) => {
if (item.materialType == ATT_TYPE.TEXT) {
this.textValue = this.changeText(item.materialContent)
}
})
}
},
computed: {
......@@ -485,6 +485,24 @@ export default {
)
})
},
// 表情转换
changeText(val) {
let htm = val.replace(
/\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi,
function (res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
}
)
return htm
},
// 上传图片
handleImgChange(e) {
let imgFlag = false
......@@ -870,6 +888,7 @@ export default {
this.previewList = utils.deepClone(val)
const obj = val.find((item) => item.materialType == this.ATT_TYPE.TEXT)
if (obj) {
console.log(obj, 'obj')
let materialContent
if (status) {
materialContent = obj.materialContent.replace(
......@@ -910,6 +929,7 @@ export default {
document.querySelector('.w-textarea_input').innerHTML = htm
}, 100)
} else {
console.log(343434343333)
this.textValue = ''
}
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!