优化代码

This commit is contained in:
java110 2022-08-13 12:52:57 +08:00
parent f2174a990d
commit ad99187b75

View File

@ -1,7 +1,7 @@
/** /**
权限组 权限组
**/ **/
(function (vc) { (function(vc) {
vc.extends({ vc.extends({
data: { data: {
changeStaffPwdInfo: { changeStaffPwdInfo: {
@ -10,40 +10,32 @@
reNewPwd: '' reNewPwd: ''
} }
}, },
_initMethod: function () { _initMethod: function() {},
}, _initEvent: function() {},
_initEvent: function () {
},
methods: { methods: {
assetImportValidate: function () { assetImportValidate: function() {
return vc.validate.validate({ return vc.validate.validate({
changeStaffPwdInfo: vc.component.changeStaffPwdInfo changeStaffPwdInfo: vc.component.changeStaffPwdInfo
}, { }, {
'changeStaffPwdInfo.oldPwd': [ 'changeStaffPwdInfo.oldPwd': [{
{
limit: "required", limit: "required",
param: "", param: "",
errInfo: "原始密码不能为空" errInfo: "原始密码不能为空"
} }],
], 'changeStaffPwdInfo.newPwd': [{
'changeStaffPwdInfo.newPwd': [
{
limit: "required", limit: "required",
param: "", param: "",
errInfo: "新密码不能为空" errInfo: "新密码不能为空"
} }],
], 'changeStaffPwdInfo.reNewPwd': [{
'changeStaffPwdInfo.reNewPwd': [
{
limit: "required", limit: "required",
param: "", param: "",
errInfo: "确认密码不能为空" errInfo: "确认密码不能为空"
} }]
]
}); });
}, },
_changePwd: function () { _changePwd: function() {
if (!vc.component.assetImportValidate()) { if (!vc.component.assetImportValidate()) {
return; return;
} }
@ -52,12 +44,11 @@
return; return;
} }
vc.http.apiPost( vc.http.apiPost(
'/user.changeStaffPwd"', '/user.changeStaffPwd',
JSON.stringify(vc.component.changeStaffPwdInfo), JSON.stringify(vc.component.changeStaffPwdInfo), {
{
emulateJSON: true emulateJSON: true
}, },
function (json, res) { function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0); //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json); let _json = JSON.parse(json);
if (_json.code == 0) { if (_json.code == 0) {
@ -73,7 +64,7 @@
vc.toast(_json.msg); vc.toast(_json.msg);
} }
}, },
function (errInfo, error) { function(errInfo, error) {
console.log('请求失败处理'); console.log('请求失败处理');
vc.toast(errInfo); vc.toast(errInfo);
}); });