From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/menu/components/card/cardcomponent/index.jsx | 39 +++++++-------------------------------- 1 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 5554b8f..f418268 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -47,10 +47,6 @@ }) } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { const { cards } = this.props @@ -64,14 +60,10 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } - getStyle = (comIds, style) => { - const { cards } = this.props + getStyle = (style) => { const { card, side } = this.state - - if (comIds.length !== 2 || comIds[0] !== cards.uuid || comIds[1] !== card.uuid) return let _card = fromJS(card).toJS() if (side === 'back') { @@ -127,7 +119,6 @@ } addElement = () => { - const { cards } = this.props const { card } = this.state let newcard = {} @@ -139,11 +130,10 @@ newcard.height = 1 // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } addButton = () => { - const { cards } = this.props const { card } = this.state let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'} @@ -151,11 +141,10 @@ newcard.focus = true // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } changeStyle = () => { - const { cards } = this.props const { card, side } = this.state let _style = null @@ -167,7 +156,7 @@ options = ['background', 'padding'] } - MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } getSettingForms = () => { @@ -244,19 +233,12 @@ } paste = (element, resolve) => { - const { cards } = this.props const { card } = this.state let _uuid = Utils.getuuid() if (element.copyType === 'action') { element.eleType = 'button' - if (element.OpenType === 'popview') { // 寮圭獥鏍囩澶嶅埗 - let _cell = fromJS(element).toJS() - _cell.$originUuid = element.uuid - _cell.uuid = _uuid - MKEmitter.emit('copyButtons', [_cell]) - } } element.uuid = _uuid @@ -265,14 +247,7 @@ resolve({status: true}) // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], element) - } - - clickComponent = (e) => { - if ((sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'propcard') && this.props.cards.subtype === 'propcard') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card, this.props.cards, 'propcard') - } + MKEmitter.emit('cardAddElement', card.uuid, element) } doubleClickCard = () => { @@ -338,14 +313,14 @@ return ( <Col span={card.setting.width || 6}> - <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onClick={this.clickComponent} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> + <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> <CardCellComponent cards={cards} cardCell={card} side={side} elements={elements} updateElement={this.updateCard}/> <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={this.addElement} /> <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} /> - <NormalForm title="鍗$墖璁剧疆" width={800} update={this.updateSetting} getForms={this.getSettingForms}> + <NormalForm title="鍗$墖璁剧疆" width={950} update={this.updateSetting} getForms={this.getSettingForms}> <EditOutlined className="edit" title="缂栬緫"/> </NormalForm> <CopyComponent type="cardcell" card={card}/> -- Gitblit v1.8.0