From 53b9fb93d0376eb02bb996935f1720b4e95cd897 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 12 十月 2022 14:41:06 +0800 Subject: [PATCH] 2022-10-12 --- src/pc/components/navbar/normal-navbar/index.jsx | 48 ++++++++++++++++++++++-------------------------- 1 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index a1eebd4..18f8e48 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -1,10 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Icon, Popover, Menu, Button } from 'antd' +import { Popover, Menu, Button } from 'antd' +import { EditOutlined, FontColorsOutlined, DeleteOutlined, ToolOutlined } from '@ant-design/icons' import asyncIconComponent from '@/utils/asyncIconComponent' - import MKEmitter from '@/utils/events.js' import getWrapForm from './options' import './index.scss' @@ -34,7 +34,6 @@ let _card = { uuid: card.uuid, type: card.type, - floor: card.floor, dataName: card.dataName || '', name: card.name, subtype: card.subtype, @@ -64,10 +63,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -79,7 +74,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -95,17 +89,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 @@ -117,13 +112,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) + MKEmitter.emit('changeStyle', ['width', 'margin'], card.logoStyle, this.getLogoStyle) } clickComponent = (e) => { @@ -141,7 +136,8 @@ MKEmitter.emit('changeEditMenu', { MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID, copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '', - MenuNo: menu.MenuNo, + clearMenu: menu.clearMenu || 'true', + // MenuNo: menu.MenuNo, MenuName: menu.name, }) } @@ -153,7 +149,7 @@ MKEmitter.emit('changeEditMenu', { MenuID: card.wrap.linkmenu, copyMenuId: '', - MenuNo: '', + // MenuNo: '', MenuName: '' }) } @@ -179,18 +175,18 @@ <MenuComponent config={card} updateConfig={this.updateComponent} /> <LinkComponent config={card} updateConfig={this.updateComponent} /> <NormalForm title="瀵艰埅鏍忚缃�" width={800} update={this.updateWrap} getForms={this.getWrapForms}> - <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/> + <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> - <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> - <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> + <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> </div> } trigger="hover"> - <Icon type="tool" /> + <ToolOutlined /> </Popover> <div className="navbar-wrap" style={{width: card.wrap.width + 'px', height: card.wrap.height + 'px', lineHeight: card.wrap.height + 'px'}}> {card.wrap.logo ? <Popover overlayClassName="mk-popover-control-wrap top-menu-popover" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeLogoStyle} type="font-colors" /> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeLogoStyle}/> </div> } trigger="hover"> <div className={'logo' + (card.wrap.logolink ? ' pointer' : '')} style={card.logoStyle} onDoubleClick={this.changeLogoMenu}><img src={card.wrap.logo} alt=""/></div> -- Gitblit v1.8.0