魏超 пре 5 година
родитељ
комит
99d12ae728

+ 14
- 1
src/components/GlobalHeader/AvatarDropdown.jsx Прегледај датотеку

@@ -18,6 +18,7 @@ class AvatarDropdown extends React.Component {
18 18
     const { key } = event;
19 19
 
20 20
     if (key === 'logout') {
21
+      console.log(this.props)
21 22
       const { dispatch } = this.props;
22 23
 
23 24
       if (dispatch) {
@@ -40,6 +41,18 @@ class AvatarDropdown extends React.Component {
40 41
   onCancel = (e) => {
41 42
     this.setState({ visible: false })
42 43
   }
44
+
45
+  onReset = (e) => {
46
+    const { dispatch } = this.props;
47
+
48
+      if (dispatch) {
49
+        dispatch({
50
+          type: 'login/logout',
51
+        });
52
+      }
53
+
54
+      return;
55
+  }
43 56
   
44 57
   render() {
45 58
     const {
@@ -82,7 +95,7 @@ class AvatarDropdown extends React.Component {
82 95
             <span className={styles.name}>{currentUser.userName}</span>
83 96
           </span>
84 97
         </HeaderDropdown>
85
-        <ShowPassword visible={this.state.visible} onCancel={(e) => this.onCancel(e)} />
98
+        <ShowPassword visible={this.state.visible} onCancel={(e) => this.onCancel(e)} onReset={(e => this.onReset(e))} />
86 99
       </>  
87 100
     ) : (
88 101
       <Spin

+ 4
- 9
src/components/GlobalHeader/ShowPassword.jsx Прегледај датотеку

@@ -26,11 +26,6 @@ function passwodForm(props) {
26 26
       if (!err) {
27 27
         request({ ...apis.user.changePassword, params: { ...values } }).then(() => {
28 28
           openNotificationWithIcon('success', '操作成功!')
29
-          window.localStorage.removeItem('test-foobar-center')      
30
-          router.push({
31
-            pathname: '/user/login',
32
-          });
33
-          props.form.resetFields()
34 29
           props.onSuccess()
35 30
         }).catch(error => {
36 31
           // openNotificationWithIcon('error', error.message)
@@ -41,7 +36,7 @@ function passwodForm(props) {
41 36
 
42 37
   // 弹框取消按钮
43 38
   function handlePopCancel(e) {
44
-    props.onSuccess()
39
+    props.onCancel()
45 40
   }
46 41
 
47 42
   const { getFieldDecorator } = props.form
@@ -111,8 +106,8 @@ export default class ShowPassword extends Component {
111 106
   }
112 107
 
113 108
   handleOk = e => {
114
-    console.log('关闭了')
115
-    this.props.onCancel()
109
+    console.log('修改密码成功')
110
+    this.props.onReset()
116 111
   };
117 112
 
118 113
   handleCancel = e => {
@@ -128,7 +123,7 @@ export default class ShowPassword extends Component {
128 123
           visible={this.state.visible}
129 124
           onCancel={this.handleCancel}
130 125
           footer={null}>
131
-          <WrappedShowPasswordForm onSuccess={(e) => this.handleCancel(e)} />
126
+          <WrappedShowPasswordForm onSuccess={(e) => this.handleOk(e)} onCancel={(e) => this.handleCancel(e)}/>
132 127
         </Modal>
133 128
       </>
134 129
     );

+ 4
- 2
src/pages/UserManage/Editor/User.jsx Прегледај датотеку

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Button, notification, Tree, message } from 'antd';
2
+import { Button, notification, Tree, message, Spin } from 'antd';
3 3
 import md5 from 'md5';
4 4
 import moment from 'moment';
5 5
 import router from 'umi/router';
@@ -177,6 +177,7 @@ export default props => {
177 177
       message.error('维护项目数量必须大于0')
178 178
       return
179 179
     }
180
+    
180 181
     setSubmitting(true)
181 182
     if (user && user.userId) {
182 183
       updateUser({ urlData: { id: user.userId }, data }).then((user) => {
@@ -203,5 +204,6 @@ export default props => {
203 204
     }
204 205
   }
205 206
 
206
-  return (<XForm onSubmit={handleSubmit} onCancel={handleCancel} fields={fields} submitting={submitting}></XForm>)
207
+  return (
208
+  <><Spin spinning={ submitting } size="large"><XForm onSubmit={handleSubmit} onCancel={handleCancel} fields={fields} submitting={submitting}></XForm></Spin></>)
207 209
 }

+ 1
- 1
src/utils/request.js Прегледај датотеку

@@ -92,7 +92,7 @@ request.interceptors.response.use(async (response, options) => {
92 92
           throw new Error('请登录系统');
93 93
         } else {
94 94
           notification.error({
95
-            message: `请登录系统`,
95
+            message: message,
96 96
             // description: message,
97 97
           });
98 98
           throw new Error(message);