浏览代码

修改密码/学生家长状态隐藏字段

zhuth 6 年之前
父节点
当前提交
b18d339a8e

+ 5 - 0
frontend/pc-web/app/view/basic/student/StudentDetail.js

@@ -193,6 +193,11 @@ Ext.define('school.view.basic.student.StudentDetail', {
                         }),
                         queryMode: 'local'
                     },
+                }, {
+                    text: '状态',
+                    dataIndex: 'parents_status',
+                    hidden: true,
+                    defaultValue: 1
                 }]
             }],
         });

+ 4 - 0
frontend/pc-web/app/view/main/Main.js

@@ -70,6 +70,10 @@ Ext.define('school.view.main.Main', {
                     menu: {
                         cls:'x-main-menu2 sa-nav-menu', 
                         items: [{
+                            text: '修改密码',
+                            iconCls: 'x-fa fa-edit sa-navicon',
+                            handler: 'onResetPassword'
+                        }, {
                             text: '退出',
                             iconCls:'x-fa fa-power-off sa-navicon',
                             handler: 'onLogout'

+ 73 - 0
frontend/pc-web/app/view/main/MainController.js

@@ -58,6 +58,79 @@ Ext.define('school.view.main.MainController', {
         Ext.resumeLayouts(true);
     },
 
+    onResetPassword: function() {
+        var win = Ext.getCmp('resetpassword');
+        if(!win) {
+            win = Ext.create('Ext.window.Window', {
+                title: '修改密码',
+                width: 400,
+                height: 260,
+                padding: 20,
+                modal: true,
+                items: [{
+                    xtype: 'form',
+                    items: [{
+                        xtype: 'textfield',
+                        cls: 'auth-textbox',
+                        fieldLabel: '新密码',
+                        emptyText: '请输入新密码',
+                        inputType: 'password',
+                        name: 'password1',
+                        allowBlank : false,
+                        listeners: {
+                            change: function(field) {
+                                var form = field.up('form'),
+                                field2 = form.getForm().findField('password2');
+
+                                field2.isValid();
+                            }
+                        }
+                    }, {
+                        xtype: 'textfield',
+                        cls: 'auth-textbox',
+                        fieldLabel: '新密码确认',
+                        emptyText: '请再次输入新密码',
+                        inputType: 'password',
+                        name: 'password2',
+                        allowBlank : false,
+                        validator: function (val) {
+                            var field = this,
+                            form = field.up('form'),
+                            field1 = form.getForm().findField('password1'),
+                            value1 = field1.getValue();
+
+                            var errMsg = "两次输入密码不一致";
+                            return (value1 == val) ? true : errMsg;
+                        }
+                    }],
+                    bbar: ['->', {
+                        xtype: 'button',
+                        text: '确认修改',
+                        formBind: true,
+                        handler: function(btn) {
+                            var window = btn.up('window'),
+                            form = window.down('form'),
+                            values = form.getValues();
+    
+                            window.setLoading(true);
+                            school.util.BaseUtil.request({
+                                url: '/api/account/account/password/reset?password=' + values.password1,
+                                method: 'POST',
+                            }).then(function(res) {
+                                window.setLoading(false);
+                                school.util.BaseUtil.showSuccessToast('修改密码成功');
+                            }).catch(function(e) {
+                                window.setLoading(false);
+                                school.util.BaseUtil.showErrorToast('修改密码失败: ' + e.message);
+                            });
+                        }
+                    }, '->']
+                }]
+            });
+        }
+        win.show();
+    },
+
     onLogout: function() {
         this.fireEvent('logout');
     }