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/pc/components/navbar/normal-navbar/index.jsx | 42 +++++++++++++++--------------------------- 1 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index 0c8d24e..f14e91b 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -34,7 +34,6 @@ let _card = { uuid: card.uuid, type: card.type, - dataName: card.dataName || '', name: card.name, subtype: card.subtype, wrap: { name: card.name, width: card.width || 1200, height: 50 }, @@ -63,10 +62,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -78,7 +73,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -94,17 +88,18 @@ this.props.updateConfig(component) } - getStyle = (comIds, style) => { - const { card } = this.state + getStyle = (style) => { + let _card = {...this.state.card, style} - if (comIds[0] !== card.uuid) return + this.setState({ + card: _card + }) + + this.props.updateConfig(_card) + } - let _card = {...card} - if (comIds.length === 1) { - _card = {...card, style} - } else if (comIds[1] === 'logo') { - _card = {...card, logoStyle: style} - } + getLogoStyle = (style) => { + let _card = {...this.state.card, logoStyle: style} this.setState({ card: _card @@ -116,20 +111,13 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['font', 'background', 'shadow'], card.style, this.getStyle) } changeLogoStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid, 'logo'], ['width', 'margin'], card.logoStyle) - } - - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) - } + MKEmitter.emit('changeStyle', ['width', 'margin'], card.logoStyle, this.getLogoStyle) } changeMenu = (menu) => { @@ -141,7 +129,7 @@ MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID, copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '', clearMenu: menu.clearMenu || 'true', - MenuNo: menu.MenuNo, + // MenuNo: menu.MenuNo, MenuName: menu.name, }) } @@ -153,7 +141,7 @@ MKEmitter.emit('changeEditMenu', { MenuID: card.wrap.linkmenu, copyMenuId: '', - MenuNo: '', + // MenuNo: '', MenuName: '' }) } @@ -173,7 +161,7 @@ const { card } = this.state return ( - <div className="normal-navbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}> + <div className="normal-navbar-edit-box" style={card.style} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <MenuComponent config={card} updateConfig={this.updateComponent} /> -- Gitblit v1.8.0