123456789101112131415161718192021222324252627 |
- Ext.define('saas.view.auth.LoginController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.login',
- init: function () {
- this.callParent(arguments);
- },
- onLoginButton: function () {
- var me = this,
- view = me.getView(),
- form = me.lookup('authdialog'),
- values = form.getValues();
- view.mask('请稍等...');
- saas.model.Session.login(values.username, values.password)
- .then(function (session) {
- view.isMasked() && view.unmask();
- me.getViewModel().set('session', session);
- me.fireEvent('login', session);
- })
- .catch(function (error) {
- view.isMasked() && view.unmask();
- saas.util.BaseUtil.showErrorToast('登录失败: ' + error.message);
- });
- }
- });
|