From 1a11f7115e61c548f9ffc77d0a9e504307ca71b2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 24 八月 2021 18:37:20 +0800
Subject: [PATCH] 2021-08-24

---
 src/menu/popview/index.jsx |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx
index 55a0f13..bed4339 100644
--- a/src/menu/popview/index.jsx
+++ b/src/menu/popview/index.jsx
@@ -62,6 +62,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('delButtons', this.delButtons)
+    MKEmitter.addListener('triggerMenuSave', this.submitConfig)
     MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
     MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent)
     this.updateCustomComponent()
@@ -79,6 +80,7 @@
       return
     }
     MKEmitter.removeListener('delButtons', this.delButtons)
+    MKEmitter.removeListener('triggerMenuSave', this.submitConfig)
     MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
     MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent)
   }
@@ -422,6 +424,7 @@
           config.open_edition = res.open_edition || ''
 
           this.setState({
+            config,
             oriConfig: fromJS(config).toJS()
           })
 
@@ -447,29 +450,22 @@
         if (!res) return
         
         if (res.status) {
-          this.setState({
-            menuloading: false,
-            config: {...config, components: []}
-          }, () => {
-            this.setState({
-              config: {...this.state.config, components: this.state.oriConfig.components}
-            })
-          })
           notification.success({
             top: 92,
             message: '淇濆瓨鎴愬姛',
             duration: 2
           })
         } else {
-          this.setState({
-            menuloading: false
-          })
           notification.warning({
             top: 92,
             message: res.message,
             duration: 5
           })
         }
+        this.setState({
+          menuloading: false
+        })
+        MKEmitter.emit('completeSave')
       })
     }, 300)
   }

--
Gitblit v1.8.0