king
2022-03-24 26d0fa42ea8c63a87e8ef93d0915f75f46fb1f9c
src/pc/components/navbar/normal-navbar/index.jsx
@@ -1,16 +1,15 @@
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 zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import getWrapForm from './options'
import './index.scss'
const WrapComponent = asyncIconComponent(() => import('./wrapsetting'))
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
const MenuComponent = asyncIconComponent(() => import('./menusetting'))
const LinkComponent = asyncIconComponent(() => import('./linksetting'))
@@ -24,7 +23,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    card: null,
    back: false
  }
@@ -36,12 +34,10 @@
      let _card = {
        uuid: card.uuid,
        type: card.type,
        floor: card.floor,
        dataName: card.dataName || '',
        width: card.width || 24,
        name: card.name,
        subtype: card.subtype,
        wrap: { name: card.name, width: card.width || 1200 },
        wrap: { name: card.name, width: card.width || 1200, height: 50 },
        logoStyle: { width: '100px' },
        style: { },
        links: [],
@@ -93,7 +89,6 @@
      card: component
    })
    component.width = component.wrap.width
    component.name = component.wrap.name
    this.props.updateConfig(component)
@@ -145,6 +140,7 @@
    MKEmitter.emit('changeEditMenu', {
      MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID,
      copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '',
      clearMenu: menu.clearMenu || 'true',
      MenuNo: menu.MenuNo,
      MenuName: menu.name,
    })
@@ -163,6 +159,16 @@
    }
  }
  getWrapForms = () => {
    const { wrap } = this.state.card
    return getWrapForm(wrap)
  }
  updateWrap = (res) => {
    this.updateComponent({...this.state.card, wrap: res})
  }
  render() {
    const { card } = this.state
@@ -172,17 +178,19 @@
          <div className="mk-popover-control">
            <MenuComponent config={card} updateConfig={this.updateComponent} />
            <LinkComponent config={card} updateConfig={this.updateComponent} />
            <WrapComponent config={card} updateConfig={this.updateComponent} />
            <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" />
            <Icon className="close" title="删除组件" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
            <NormalForm title="导航栏设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
              <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
            <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>