From 2e3d8e7d5715862733e43070e7df73b48a81948f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 七月 2021 23:49:55 +0800
Subject: [PATCH] 2021-07-28

---
 src/mob/components/topbar/normal-navbar/index.jsx |   41 ++++++++++++++++++++++++++++-------------
 1 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx
index 6f0a585..59a358e 100644
--- a/src/mob/components/topbar/normal-navbar/index.jsx
+++ b/src/mob/components/topbar/normal-navbar/index.jsx
@@ -33,7 +33,7 @@
         uuid: card.uuid,
         type: card.type,
         floor: card.floor,
-        width: card.width || 24,
+        width: 24,
         subtype: card.subtype,
         wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', search: 'false', logout: 'false' },
         style: {borderBottomColor: '#bcbcbc', borderBottomWidth: '1px', paddingLeft: '10px', paddingRight: '10px', lineHeight: '2.8', fontSize: '18px' },
@@ -59,6 +59,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('submitStyle', this.getStyle)
+    MKEmitter.addListener('submitSearch', this.getSearch)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -73,6 +74,7 @@
       return
     }
     MKEmitter.removeListener('submitStyle', this.getStyle)
+    MKEmitter.removeListener('submitSearch', this.getSearch)
   }
   
   /**
@@ -82,9 +84,6 @@
     this.setState({
       card: component
     })
-
-    component.width = component.wrap.width
-    component.name = component.wrap.name
 
     this.props.updateConfig(component)
   }
@@ -121,7 +120,6 @@
       window.open(menu.link)
     } else {
       MKEmitter.emit('changeEditMenu', {
-        fixed: menu.property === 'menu',
         MenuID: menu.property === 'linkmenu' ? menu.linkMenuId : menu.MenuID,
         copyMenuId: menu.property === 'menu' ? menu.copyMenuId : '',
         MenuNo: menu.MenuNo,
@@ -130,21 +128,38 @@
     }
   }
 
-  setSearch = () => {
+  getSearch = (config) => {
+    const { card } = this.state
 
+    if (card.uuid !== config.uuid) return
+
+    this.setState({
+      card: config
+    })
+    
+    this.props.updateConfig(config)
+  }
+
+  setSearch = () => {
+    let card = fromJS(this.state.card).toJS()
+
+    if (!card.search) {
+      card.search = {
+        floor: 1,
+        setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' },
+        groups: [],
+        fields: []
+      }
+    }
+    this.props.updateConfig(card)
+    MKEmitter.emit('changeSearch', card)
   }
 
   render() {
     const { card } = this.state
 
-    let _style = {...card.style}
-    if (_style.shadow) {
-      _style.boxShadow = '0 0 4px ' + _style.shadow
-    }
-    _style.height = card.wrap.height
-
     return (
-      <div className="normal-topbar-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}>
+      <div className="normal-topbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
             <WrapComponent config={card} updateConfig={this.updateComponent} />

--
Gitblit v1.8.0