Browse Source

v1.0.15 update

yee 8 years ago
parent
commit
53dfed56dd
2 changed files with 22 additions and 3 deletions
  1. 21 2
      js/component/manageCenter/set/modal.jsx
  2. 1 1
      package.json

+ 21 - 2
js/component/manageCenter/set/modal.jsx

@@ -80,18 +80,37 @@ export default class TheModal extends React.Component {
             });
         })
     }
+    loadBindRoles(uid) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/admin/role',
+            cache: false,
+            data: {
+                "uid": uid
+            }
+        }).done((data) => {
+            this.setState({
+                bindroles: data.data || [],
+                loading: false
+            });
+        })
+    }
     componentWillReceiveProps(nextProps) {
         if (nextProps.show && !this.state.roles.length) {
             this.loadInitialData();
         };
+        if (!this.state.visible && nextProps.show) {
+            this.loadBindRoles(nextProps.data.id);
+        };
         let nextState = {
             visible: nextProps.show,
             id: nextProps.data ? nextProps.data.id : '',
             name: nextProps.data ? nextProps.data.name : '',
             email: nextProps.data ? nextProps.data.email : '',
             mobile: nextProps.data ? nextProps.data.mobile : '',
-            province: nextProps.data ? nextProps.data.province : '',
-            bindroles: nextProps.data && nextProps.data.roles ? nextProps.data.roles.map((role) => { return String(role.id); }) : []
+            province: nextProps.data ? nextProps.data.province : ''
         };
         this.setState(nextState)
     }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.0.14",
+  "version": "1.0.15",
   "description": "",
   "main": "index.js",
   "scripts": {