Commit e12ac8fb by 杨明

fixed

1 parent 946aac4d
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-08-30 18:10:31
* @LastEditTime: 2023-08-31 11:00:31
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -474,23 +474,29 @@ export default {
}
Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, width: this.detail.marketingTitle.length * (style1.size * fontObj[style1.font]), color: style1.style.color, font: style1.font, height: 'auto', shadow: style1.style['text-shadow'] })
Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style2, width: this.detail.marketingSubtitle.length * (style2.size * fontObj[style2.font]), color: style2.style.color, font: style2.font, height: 'auto', shadow: style2.style['text-shadow'] })
console.log(this.draggableList[0])
setTimeout(() => {
const textDom = document.querySelectorAll('.img_cl')
textDom.forEach(item => {
let fontSize = this.getPropSize(item, 'font-size')
let height = this.getPropSize(item, 'height')
let content = item.textContent.trim()
let len = parseInt(content.length)
if (height > fontSize + 5) {
fontSize -= len
}
if (content == this.detail.marketingTitle) {
Object.assign(this.draggableList[0], { size: fontSize, height: 'auto', width: content.length * (fontSize * fontObj[this.draggableList[0].font]) })
}
if (content == this.detail.marketingSubtitle) {
Object.assign(this.draggableList[1], { size: fontSize, height: 'auto', width: content.length * (fontSize * fontObj[this.draggableList[1].font]) })
textDom.forEach(async item => {
const reduceSize = () => {
let fontSize = this.getPropSize(item, 'font-size')
let height = this.getPropSize(item, 'height')
let content = item.textContent.trim()
if (height > fontSize + 5) {
fontSize -= 3
}
if (content == this.detail.marketingTitle) {
Object.assign(this.draggableList[0], { size: fontSize, height: 'auto', width: content.length * (fontSize * fontObj[this.draggableList[0].font]) })
}
if (content == this.detail.marketingSubtitle) {
Object.assign(this.draggableList[1], { size: fontSize, height: 'auto', width: content.length * (fontSize * fontObj[this.draggableList[1].font]) })
}
setTimeout(() => {
if (this.getPropSize(item, 'height') > this.getPropSize(item, 'font-size') + 5) {
reduceSize()
}
}, 300)
}
reduceSize()
})
}, 300)
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!