From 3b103caa6bfc9ed410e67156c3ca1785bf1cecc9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 19 八月 2022 01:15:31 +0800
Subject: [PATCH] 2022-08-19

---
 src/pc/components/navbar/normal-navbar/index.jsx |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx
index 7a3868e..18f8e48 100644
--- a/src/pc/components/navbar/normal-navbar/index.jsx
+++ b/src/pc/components/navbar/normal-navbar/index.jsx
@@ -63,10 +63,6 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -78,7 +74,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
   
   /**
@@ -94,17 +89,18 @@
     this.props.updateConfig(component)
   }
 
-  getStyle = (comIds, style) => {
-    const { card } = this.state
+  getStyle = (style) => {
+    let _card = {...this.state.card, style}
 
-    if (comIds[0] !== card.uuid) return
+    this.setState({
+      card: _card
+    })
+    
+    this.props.updateConfig(_card)
+  }
 
-    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
@@ -116,13 +112,13 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['font', '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) => {

--
Gitblit v1.8.0