From c06e58c80240afd703d289bb1c584e08b9783383 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 六月 2025 20:24:25 +0800
Subject: [PATCH] 2025-06-13

---
 src/pc/components/navbar/normal-navbar/index.jsx |  173 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 107 insertions(+), 66 deletions(-)

diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx
index a67fe8e..c25dd43 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 } 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 Utils from '@/utils/utils.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 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 {
   static propTpyes = {
@@ -27,7 +23,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,
     back: false
   }
@@ -39,12 +34,9 @@
       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: [],
@@ -70,10 +62,6 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -85,7 +73,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
   
   /**
@@ -96,39 +83,23 @@
       card: component
     })
 
-    component.width = component.wrap.width
     component.name = component.wrap.name
 
     this.props.updateConfig(component)
   }
 
-  /**
-   * @description 鍗曚釜鍗$墖淇℃伅鏇存柊
-   */
-  updateCard = (cell) => {
-    let card = fromJS(this.state.card).toJS()
+  getStyle = (style) => {
+    let _card = {...this.state.card, style}
 
-    card.subcards = card.subcards.map(item => {
-      if (item.uuid === cell.uuid) return cell
-      return item
+    this.setState({
+      card: _card
     })
-
-    this.setState({card})
-
-    this.props.updateConfig(card)
+    
+    this.props.updateConfig(_card)
   }
 
-  getStyle = (comIds, style) => {
-    const { card } = this.state
-
-    if (comIds[0] !== card.uuid) return
-
-    let _card = {...card}
-    if (comIds.length === 1) {
-      _card = {...card, style}
-    } else if (comIds[1] === 'logo') {
-      _card = {...card, logoStyle: style}
-    }
+  getLogoStyle = (style) => {
+    let _card = {...this.state.card, logoStyle: style}
 
     this.setState({
       card: _card
@@ -140,54 +111,124 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'shadow'], card.style)
+    MKEmitter.emit('changeStyle', ['font', 'background', 'shadow'], card.style, this.getStyle)
   }
 
   changeLogoStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid, 'logo'], ['width', 'margin'], card.logoStyle)
+    MKEmitter.emit('changeStyle', ['width', 'margin'], card.logoStyle, this.getLogoStyle)
   }
 
-  clickComponent = (e) => {
-    if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
-      e.stopPropagation()
-      MKEmitter.emit('clickComponent', this.state.card)
+  changeMenu = (menu) => {
+    if (menu.property === 'text') {
+      return
+    } else if (menu.property === 'link') {
+      window.open(menu.link)
+      return
     }
+    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,
+    })
+  }
+
+  changeLogoMenu = () => {
+    const { card } = this.state
+  
+    if (card.wrap.property === 'linkmenu') {
+      MKEmitter.emit('changeEditMenu', {
+        MenuID: card.wrap.linkmenu,
+        copyMenuId: '',
+        // MenuNo: '',
+        MenuName: ''
+      })
+    }
+  }
+
+  getWrapForms = () => {
+    const { wrap } = this.state.card
+
+    return getWrapForm(wrap)
+  }
+
+  updateWrap = (res) => {
+    this.updateComponent({...this.state.card, wrap: res})
   }
 
   render() {
     const { card } = this.state
 
-    let _style = {...card.style}
-    if (_style.shadow) {
-      _style.boxShadow = '0 0 4px ' + _style.shadow
-    }
-
     return (
-      <div className="normal-navbar-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}>
+      <div className="normal-navbar-edit-box" style={card.style} id={card.uuid}>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
             <MenuComponent 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)} />
+            <LinkComponent config={card} updateConfig={this.updateComponent} />
+            <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" 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="link">asdfds</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}>
+                      <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(fst)}>{fst.name}</span>
+                    </Menu.Item>
+                  )
+                }
+              })}
+            </Menu>
+          </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