From e36eb1999794bd71e76482b92a0b0b20f49d0032 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 05 三月 2021 19:37:03 +0800 Subject: [PATCH] 2021-03-05 --- src/pc/components/navbar/normal-navbar/index.jsx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index a67fe8e..35ef413 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Icon, Popover } from 'antd' +import { Icon, Popover, Menu } from 'antd' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -18,6 +18,7 @@ const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) // const { confirm } = Modal +const { SubMenu } = Menu class NormalNavbar extends Component { static propTpyes = { @@ -140,7 +141,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'shadow'], card.style) + MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'shadow'], card.style) } changeLogoStyle = () => { @@ -154,6 +155,18 @@ e.stopPropagation() MKEmitter.emit('clickComponent', this.state.card) } + } + + changeMenu = (menu) => { + MKEmitter.emit('changeEditMenu', menu) + } + + changeLogoMenu = () => { + const { card } = this.state + + if (!card.wrap.logolink) return + + MKEmitter.emit('changeEditMenu', {MenuID: card.wrap.logolink}) } render() { @@ -184,9 +197,47 @@ <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeLogoStyle} type="font-colors" /> </div> } trigger="hover"> - <div className="logo" style={card.logoStyle}><img src={card.wrap.logo} alt=""/></div> + <div className={'logo' + (card.wrap.logolink ? ' pointer' : '')} style={card.logoStyle} onDoubleClick={this.changeLogoMenu}><img src={card.wrap.logo} alt=""/></div> </Popover> : null} - <div className="menu">sdf</div> + <div className="menu"> + <Menu mode="horizontal"> + {card.menus.map(fst => { + if (fst.property === 'classify' && fst.sublist.length > 0) { + return ( + <SubMenu title={fst.name} key={fst.MenuID} popupClassName="normal-navbar-submenu"> + {fst.sublist.map(scd => { + if (scd.property === 'classify' && scd.sublist.length > 0) { + return ( + <Menu.ItemGroup key={scd.MenuID} title={scd.name}> + {scd.sublist.map(thd => { + return ( + <Menu.Item key={thd.MenuID} > + <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(thd)}>{thd.name}</span> + </Menu.Item> + ) + })} + </Menu.ItemGroup> + ) + } else { + return ( + <Menu.Item key={scd.MenuID} onClick={(e) => e.stopPropagation()}> + <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(scd)}>{scd.name}</span> + </Menu.Item> + ) + } + })} + </SubMenu> + ) + } else { + return ( + <Menu.Item key={fst.MenuID} onClick={(e) => e.stopPropagation()}> + <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(fst)}>{fst.name}</span> + </Menu.Item> + ) + } + })} + </Menu> + </div> <div className="link">asdfds</div> </div> </div> -- Gitblit v1.8.0