king
2021-06-02 e543372cc70a19ff2630c79d8421c2c593e54e5f
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>
    )