mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-06-12 10:00:56 +08:00
优化调整代码
This commit is contained in:
parent
ab0c4f8a64
commit
5da76009e6
@ -10,22 +10,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_initMethod: function() {
|
_initMethod: function() {
|
||||||
vc.component.clearCacheData();
|
$that.clearCacheData();
|
||||||
vc.component._loadSysInfo();
|
$that._loadSysInfo();
|
||||||
},
|
},
|
||||||
_initEvent: function() {
|
_initEvent: function() {
|
||||||
vc.component.$on('errorInfoEvent', function(_errorInfo) {
|
$that.$on('errorInfoEvent', function(_errorInfo) {
|
||||||
vc.component.loginInfo.errorInfo = _errorInfo;
|
$that.loginInfo.errorInfo = _errorInfo;
|
||||||
console.log('errorInfoEvent 事件被监听', _errorInfo)
|
console.log('errorInfoEvent 事件被监听', _errorInfo)
|
||||||
});
|
});
|
||||||
vc.component.$on('validate_code_component_param_change_event', function(params) {
|
$that.$on('validate_code_component_param_change_event', function(params) {
|
||||||
for (var tmpAttr in params) {
|
for (var tmpAttr in params) {
|
||||||
vc.component.loginInfo[tmpAttr] = params[tmpAttr];
|
$that.loginInfo[tmpAttr] = params[tmpAttr];
|
||||||
}
|
}
|
||||||
console.log('errorInfoEvent 事件被监听', params)
|
console.log('errorInfoEvent 事件被监听', params)
|
||||||
});
|
});
|
||||||
vc.on('login', 'doLogin', function() {
|
vc.on('login', 'doLogin', function() {
|
||||||
vc.component.doLogin();
|
$that.doLogin();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -47,37 +47,37 @@
|
|||||||
if (res.status != 200) {
|
if (res.status != 200) {
|
||||||
console.log("加载系统信息失败");
|
console.log("加载系统信息失败");
|
||||||
vc.saveData("_sysInfo", { logo: 'HC' });
|
vc.saveData("_sysInfo", { logo: 'HC' });
|
||||||
vc.copyObject(json, vc.component.loginInfo);
|
vc.copyObject(json, $that.loginInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vc.copyObject(JSON.parse(json), vc.component.loginInfo);
|
vc.copyObject(JSON.parse(json), $that.loginInfo);
|
||||||
//保存到浏览器
|
//保存到浏览器
|
||||||
vc.saveData("_sysInfo", JSON.parse(json));
|
vc.saveData("_sysInfo", JSON.parse(json));
|
||||||
},
|
},
|
||||||
function(errInfo, error) {
|
function(errInfo, error) {
|
||||||
console.log('请求失败处理');
|
console.log('请求失败处理');
|
||||||
vc.saveData("_sysInfo", { logo: 'HC' });
|
vc.saveData("_sysInfo", { logo: 'HC' });
|
||||||
vc.copyObject(json, vc.component.loginInfo);
|
vc.copyObject(json, $that.loginInfo);
|
||||||
vc.component.loginInfo.errorInfo = errInfo;
|
$that.loginInfo.errorInfo = errInfo;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
doLogin: function() {
|
doLogin: function() {
|
||||||
if (!vc.notNull(vc.component.loginInfo.username)) {
|
if (!vc.notNull($that.loginInfo.username)) {
|
||||||
vc.toast('用户名不能为空');
|
vc.toast('用户名不能为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!vc.notNull(vc.component.loginInfo.passwd)) {
|
if (!vc.notNull($that.loginInfo.passwd)) {
|
||||||
vc.toast('密码不能为空');
|
vc.toast('密码不能为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!vc.notNull(vc.component.loginInfo.validateCode)) {
|
if (!vc.notNull($that.loginInfo.validateCode)) {
|
||||||
vc.toast('验证码不能为空');
|
vc.toast('验证码不能为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vc.http.post(
|
vc.http.post(
|
||||||
'login',
|
'login',
|
||||||
'doLogin?version=2.0',
|
'doLogin?version=2.0',
|
||||||
JSON.stringify(vc.component.loginInfo), {
|
JSON.stringify($that.loginInfo), {
|
||||||
emulateJSON: true
|
emulateJSON: true
|
||||||
},
|
},
|
||||||
function(json, res) {
|
function(json, res) {
|
||||||
@ -94,12 +94,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vc.toast(json);
|
vc.toast(json);
|
||||||
vc.component.loginInfo.errorInfo = json;
|
$that.loginInfo.errorInfo = json;
|
||||||
},
|
},
|
||||||
function(errInfo, error) {
|
function(errInfo, error) {
|
||||||
console.log('请求失败处理');
|
console.log('请求失败处理');
|
||||||
vc.toast(errInfo);
|
vc.toast(errInfo);
|
||||||
vc.component.loginInfo.errorInfo = errInfo;
|
$that.loginInfo.errorInfo = errInfo;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_doRegister: function() {
|
_doRegister: function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user