From 944730f2794b87aa053f53084f0d082d4af6fd41 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 29 十月 2020 19:03:30 +0800 Subject: [PATCH] 2020-10-29 --- src/menu/components/card/cardcellcomponent/index.jsx | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 0c8d9f2..b7e64eb 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -102,10 +102,9 @@ const { cards, cardCell } = this.props let _style = element.style ? fromJS(element.style).toJS() : {} - let options = ['font', 'border', 'padding', 'margin'] + let options = ['font', 'border', 'padding', 'margin', 'backgroundColor'] if (element.eleType === 'button') { - options.push('background') if (element.btnstyle) { _style = {..._style, ...element.btnstyle} } @@ -132,7 +131,22 @@ let _card = fromJS(card).toJS() - if (card.eleType === 'button') { // 鎷嗗垎style + if (_card.eleType === 'text' || _card.eleType === 'number' || _card.eleType === 'link') { + _card.style = style + + let fontSize = 14 + let lineHeight = 1.5 + let line = _card.height || 1 + + if (_card.style.fontSize) { + fontSize = parseInt(_card.style.fontSize) + } + if (_card.style.lineHeight) { + lineHeight = parseFloat(_card.style.lineHeight) + } + + _card.innerHeight = fontSize * lineHeight * line + } else if (_card.eleType === 'button') { // 鎷嗗垎style let _style = fromJS(style).toJS() _card.style = {} @@ -376,16 +390,32 @@ handleSubmit = () => { const { elements } = this.state - this.elementFormRef.handleConfirm().then(ele => { + this.elementFormRef.handleConfirm().then(res => { let _elements = elements.map(cell => { - if (cell.uuid === ele.uuid) { - ele.style = cell.style || {} - if (ele.eleType === 'splitline' && cell.eleType !== 'splitline') { - ele.style.paddingTop = '5px' - ele.style.paddingBottom = '5px' + if (cell.uuid === res.uuid) { + res.style = cell.style || {} + if (res.eleType === 'splitline' && cell.eleType !== 'splitline') { + res.style.paddingTop = '5px' + res.style.paddingBottom = '5px' + } else if (res.eleType === 'text' || res.eleType === 'number' || res.eleType === 'link') { + let fontSize = 14 + let lineHeight = 1.5 + let line = res.height || 1 + + if (res.style && res.style.fontSize) { + fontSize = parseInt(res.style.fontSize) + } + if (res.style && res.style.lineHeight) { + lineHeight = parseFloat(res.style.lineHeight) + } + res.innerHeight = fontSize * lineHeight * line + + if (res.eleType === 'link' && !res.style.color) { + res.style.color = 'rgba(24, 144, 255, 1)' + } } - return ele + return res } return cell }) @@ -410,10 +440,8 @@ if (cell.uuid === res.uuid) { res = {...cell, ...res} delete res.focus - return res } - return cell }) -- Gitblit v1.8.0