mrzcc
2020-02-10 4f9c122f237fbee16d5ef9c602b6db95d28ed7b0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
 权限组
 **/
(function (vc) {
 
    vc.extends({
        data: {
            changeStaffPwdInfo: {
                communityId: vc.getCurrentCommunity().communityId,
                oldPwd: '',
                newPwd: '',
                reNewPwd:''
            }
        },
 
        _initMethod: function () {
 
        },
        _initEvent: function () {
 
        },
        methods: {
            assetImportValidate: function () {
                return vc.validate.validate({
                    changeStaffPwdInfo: vc.component.changeStaffPwdInfo
                }, {
 
                    'changeStaffPwdInfo.oldPwd': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "原始密码不能为空"
                        }
                    ],
                    'changeStaffPwdInfo.newPwd': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "新密码不能为空"
                        }
                    ],
                    'changeStaffPwdInfo.reNewPwd': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "确认密码不能为空"
                        }
                    ],
                    'changeStaffPwdInfo.communityId': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "还未入驻小区,请先入驻小区"
                        }
                    ]
                });
            },
            _changePwd: function () {
 
                if (!vc.component.assetImportValidate()) {
                    return;
                }
 
                var _userInfo = vc.getData("/nav/getUserInfo");
 
                if(_userInfo.name == 'wuxw' || _userInfo.name == 'dev' || _userInfo.name == 'dails' || _userInfo.name == 'admin'){
                    vc.toast("演示环境密码,不允许修改");
                    return ;
                }
 
 
                if(vc.component.changeStaffPwdInfo.newPwd != vc.component.changeStaffPwdInfo.reNewPwd){
                    vc.toast('两次密码不一致');
                    return ;
                }
 
                vc.http.post(
                    'changeStaffPwd',
                    'change',
                    JSON.stringify(vc.component.changeStaffPwdInfo),
                    {
                        emulateJSON:true
                     },
                     function(json,res){
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        if(res.status == 200){
                            //关闭model
                            vc.toast("修改成功");
                            vc.component.changeStaffPwdInfo.oldPwd = '';
                            vc.component.changeStaffPwdInfo.newPwd = '';
                            vc.component.changeStaffPwdInfo.reNewPwd = '';
                            return ;
                        }
                        vc.toast(json);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');
                        vc.toast(errInfo);
                     });
 
            }
        }
    });
 
})(window.vc);