From 2e3d8e7d5715862733e43070e7df73b48a81948f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 七月 2021 23:49:55 +0800 Subject: [PATCH] 2021-07-28 --- src/mob/components/topbar/normal-navbar/index.jsx | 57 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index 8637577..59a358e 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -33,9 +33,9 @@ uuid: card.uuid, type: card.type, floor: card.floor, - width: card.width || 24, + width: 24, subtype: card.subtype, - wrap: { height: 50, title: 'NavBar' }, + wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', search: 'false', logout: 'false' }, style: {borderBottomColor: '#bcbcbc', borderBottomWidth: '1px', paddingLeft: '10px', paddingRight: '10px', lineHeight: '2.8', fontSize: '18px' }, } @@ -59,6 +59,7 @@ componentDidMount () { MKEmitter.addListener('submitStyle', this.getStyle) + MKEmitter.addListener('submitSearch', this.getSearch) } shouldComponentUpdate (nextProps, nextState) { @@ -73,6 +74,7 @@ return } MKEmitter.removeListener('submitStyle', this.getStyle) + MKEmitter.removeListener('submitSearch', this.getSearch) } /** @@ -82,9 +84,6 @@ this.setState({ card: component }) - - component.width = component.wrap.width - component.name = component.wrap.name this.props.updateConfig(component) } @@ -121,7 +120,6 @@ window.open(menu.link) } else { MKEmitter.emit('changeEditMenu', { - fixed: menu.property === 'menu', MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID, copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '', MenuNo: menu.MenuNo, @@ -130,17 +128,38 @@ } } + getSearch = (config) => { + const { card } = this.state + + if (card.uuid !== config.uuid) return + + this.setState({ + card: config + }) + + this.props.updateConfig(config) + } + + setSearch = () => { + let card = fromJS(this.state.card).toJS() + + if (!card.search) { + card.search = { + floor: 1, + setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' }, + groups: [], + fields: [] + } + } + this.props.updateConfig(card) + MKEmitter.emit('changeSearch', card) + } + render() { const { card } = this.state - let _style = {...card.style} - if (_style.shadow) { - _style.boxShadow = '0 0 4px ' + _style.shadow - } - _style.height = card.wrap.height - return ( - <div className="normal-topbar-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> + <div className="normal-topbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <WrapComponent config={card} updateConfig={this.updateComponent} /> @@ -152,10 +171,16 @@ </Popover> <div className="am-navbar"> <div className="am-navbar-left"> - <Icon type="left" /> + {card.wrap.back !== 'false' ? <Icon type="left" /> : null} </div> - <div className="am-navbar-title">{card.wrap.title || ''}</div> - <div className="am-navbar-right"></div> + {card.wrap.type !== 'search' ? + <div className="am-navbar-title">{card.wrap.title || ''}</div> : + <div className="am-navbar-search" onDoubleClick={this.setSearch}><div className="search-bar"><Icon type="search" /></div></div> + } + <div className="am-navbar-right"> + {card.wrap.search === 'true' ? <Icon type="search" onDoubleClick={this.setSearch}/> : null} + {card.wrap.logout === 'true' ? <Icon type="ellipsis" /> : null} + </div> </div> </div> ) -- Gitblit v1.8.0