提交 | 用户 | 时间
|
71e81e
|
1 |
/** |
懒 |
2 |
* 用户详情对话框(可用于添加和修改对话框) |
|
3 |
*/ |
|
4 |
var UserPwdPage = { |
|
5 |
data: { |
|
6 |
oldPassword: "", |
|
7 |
newPassword: "", |
|
8 |
repeatPassword: "" |
|
9 |
} |
|
10 |
}; |
|
11 |
|
|
12 |
/** |
|
13 |
* 重置输入框 |
|
14 |
*/ |
|
15 |
UserPwdPage.reset = function () { |
|
16 |
UserPwdPage.data.oldPassword = ""; |
|
17 |
UserPwdPage.data.newPassword = ""; |
|
18 |
UserPwdPage.data.repeatPassword = ""; |
|
19 |
}; |
|
20 |
|
|
21 |
/** |
|
22 |
* 验证表单 |
|
23 |
*/ |
|
24 |
UserPwdPage.validateForm = function () { |
|
25 |
|
|
26 |
var data = UserPwdPage.data; |
|
27 |
|
|
28 |
if (!data.oldPassword) { |
|
29 |
return "请输入旧密码"; |
|
30 |
} |
|
31 |
if (!data.newPassword) { |
|
32 |
return "请输入新密码"; |
|
33 |
} |
|
34 |
if (!(data.newPassword === data.repeatPassword)) { |
|
35 |
return "两次密码输入不一致"; |
|
36 |
} |
|
37 |
|
|
38 |
return true; |
|
39 |
}; |
|
40 |
|
|
41 |
/** |
|
42 |
* 修改密码 |
|
43 |
*/ |
|
44 |
UserPwdPage.chPwd = function () { |
|
45 |
var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) { |
|
46 |
Feng.success("修改成功!"); |
|
47 |
}, function (data) { |
|
48 |
Feng.error("修改失败!" + data.responseJSON.message + "!"); |
|
49 |
}); |
|
50 |
ajax.setData(UserPwdPage.data); |
|
51 |
ajax.start(); |
|
52 |
}; |
|
53 |
|
|
54 |
$(function () { |
|
55 |
|
|
56 |
UserPwdPage.app = new Vue({ |
|
57 |
el: '#passwordForm', |
|
58 |
data: UserPwdPage.data, |
|
59 |
methods: { |
|
60 |
ensure: function () { |
|
61 |
var validateForm = UserPwdPage.validateForm(); |
|
62 |
if (validateForm === true) { |
|
63 |
UserPwdPage.chPwd(); |
|
64 |
} else { |
|
65 |
Feng.alert(validateForm); |
|
66 |
} |
|
67 |
}, |
|
68 |
reset: function () { |
|
69 |
UserPwdPage.reset(); |
|
70 |
} |
|
71 |
} |
|
72 |
}); |
|
73 |
|
|
74 |
}); |