From f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 六月 2023 18:17:09 +0800
Subject: [PATCH] 2023-06-28

---
 src/menu/components/share/normalheader/index.jsx |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/src/menu/components/share/normalheader/index.jsx b/src/menu/components/share/normalheader/index.jsx
index e5345f5..acc4e22 100644
--- a/src/menu/components/share/normalheader/index.jsx
+++ b/src/menu/components/share/normalheader/index.jsx
@@ -22,10 +22,6 @@
     appType: sessionStorage.getItem('appType')
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.props.config), fromJS(nextProps.config))
   }
@@ -37,15 +33,14 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { config } = this.props
+  getStyle = (style) => {
+    if (!style.borderBottomWidth) {
+      style.borderBottomWidth = '0px'
+    }
 
-    if (comIds[0] !== config.uuid || comIds[1] !== 'header') return
-
-    let _config = {...config, headerStyle: style}
+    let _config = {...this.props.config, headerStyle: style}
     
     this.props.updateComponent(_config)
   }
@@ -53,24 +48,24 @@
   changeStyle = () => {
     const { config } = this.props
 
-    let options = ['font', 'border', 'background']
-    if (config.type === 'menubar') {
-      options.push('padding')
-    }
+    let options = ['font', 'border', 'background', 'padding']
 
-    MKEmitter.emit('changeStyle', [config.uuid, 'header'], options, config.headerStyle)
+    MKEmitter.emit('changeStyle', options, config.headerStyle, this.getStyle)
   }
 
   render() {
     const { config, hideSearch } = this.props
-    // const { appType } = this.state
 
-    let title = config.plot ? config.plot.title : config.wrap.title
+    let title = ''
     let show = true
 
-    // if (!title && appType === 'mob' && config.type === 'card' && config.subtype === 'datacard' && config.action && config.action.length) {
-    //   title = ' '
-    // }
+    if (config.plot) {
+      title = config.plot.title
+    } else if (config.type === 'group') {
+      title = config.setting.title || ''
+    } else if (config.wrap) {
+      title = config.wrap.title || ''
+    }
 
     if (!title && (!config.search || config.search.length === 0 || hideSearch === 'true')) {
       show = false

--
Gitblit v1.8.0