| | |
| | | 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 { |
| | |
| | | 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 |
| | | |
| | |
| | | } |
| | | |
| | | 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 = () => { |
| | |
| | | <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"> |
| | |
| | | ) |
| | | } 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> |
| | | ) |
| | |
| | | })} |
| | | </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> |
| | | ) |