Commit 931751ba by 前端

bug修复

1 parent 4065af51
...@@ -389,12 +389,12 @@ export default { ...@@ -389,12 +389,12 @@ export default {
// }) // })
console.log(this.previewList) console.log(this.previewList)
if (this.previewList.length) { if (this.previewList.length) {
this.updateList(this.previewList, 1) // this.updateList(this.previewList, 1)
// this.previewList.map((item) => { this.previewList.map((item) => {
// if (item.materialType == ATT_TYPE.TEXT) { if (item.materialType == ATT_TYPE.TEXT) {
// // this.textValue = item.materialContent this.textValue = this.changeText(item.materialContent)
// } }
// }) })
} }
}, },
computed: { computed: {
...@@ -485,6 +485,24 @@ export default { ...@@ -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) { handleImgChange(e) {
let imgFlag = false let imgFlag = false
...@@ -870,6 +888,7 @@ export default { ...@@ -870,6 +888,7 @@ export default {
this.previewList = utils.deepClone(val) this.previewList = utils.deepClone(val)
const obj = val.find((item) => item.materialType == this.ATT_TYPE.TEXT) const obj = val.find((item) => item.materialType == this.ATT_TYPE.TEXT)
if (obj) { if (obj) {
console.log(obj, 'obj')
let materialContent let materialContent
if (status) { if (status) {
materialContent = obj.materialContent.replace( materialContent = obj.materialContent.replace(
...@@ -910,6 +929,7 @@ export default { ...@@ -910,6 +929,7 @@ export default {
document.querySelector('.w-textarea_input').innerHTML = htm document.querySelector('.w-textarea_input').innerHTML = htm
}, 100) }, 100)
} else { } else {
console.log(343434343333)
this.textValue = '' this.textValue = ''
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!