From e543372cc70a19ff2630c79d8421c2c593e54e5f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 六月 2021 17:15:21 +0800 Subject: [PATCH] 2021-06-02 --- src/pc/components/navbar/normal-navbar/index.jsx | 47 ++++++++++++++++++++--------------------------- 1 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index 35ef413..6978c0b 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -1,23 +1,19 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Icon, Popover, Menu } from 'antd' +import { Icon, Popover, Menu, Button } from 'antd' import asyncIconComponent from '@/utils/asyncIconComponent' import MKEmitter from '@/utils/events.js' -// import Utils from '@/utils/utils.js' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' import './index.scss' const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) const MenuComponent = asyncIconComponent(() => import('./menusetting')) -// const CardComponent = asyncComponent(() => import('../cardcomponent')) -const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) +const LinkComponent = asyncIconComponent(() => import('./linksetting')) -// const { confirm } = Modal const { SubMenu } = Menu class NormalNavbar extends Component { @@ -103,22 +99,6 @@ this.props.updateConfig(component) } - /** - * @description 鍗曚釜鍗$墖淇℃伅鏇存柊 - */ - updateCard = (cell) => { - let card = fromJS(this.state.card).toJS() - - card.subcards = card.subcards.map(item => { - if (item.uuid === cell.uuid) return cell - return item - }) - - this.setState({card}) - - this.props.updateConfig(card) - } - getStyle = (comIds, style) => { const { card } = this.state @@ -158,7 +138,17 @@ } changeMenu = (menu) => { - MKEmitter.emit('changeEditMenu', menu) + if (menu.property === 'link') { + window.open(menu.link) + return + } + MKEmitter.emit('changeEditMenu', { + fixed: menu.property === 'menu', + MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID, + copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '', + MenuNo: menu.MenuNo, + MenuName: menu.name, + }) } changeLogoMenu = () => { @@ -182,10 +172,9 @@ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <MenuComponent config={card} updateConfig={this.updateComponent} /> + <LinkComponent config={card} updateConfig={this.updateComponent} /> <WrapComponent config={card} updateConfig={this.updateComponent} /> - <CopyComponent type="normalnarbar" card={card}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> - <UserComponent config={card}/> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> </div> } trigger="hover"> @@ -230,7 +219,7 @@ ) } else { return ( - <Menu.Item key={fst.MenuID} onClick={(e) => e.stopPropagation()}> + <Menu.Item key={fst.MenuID}> <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(fst)}>{fst.name}</span> </Menu.Item> ) @@ -238,7 +227,11 @@ })} </Menu> </div> - <div className="link">asdfds</div> + <div className="link"> + {card.links.map(link => { + return <Button type="link" key={link.MenuID} onDoubleClick={() => this.changeMenu(link)}>{link.name}</Button> + })} + </div> </div> </div> ) -- Gitblit v1.8.0