UU.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.UU', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.BaseUtil'],
  5. views: ['common.init.UU'],
  6. init: function(){
  7. var me = this;
  8. me.BaseUtil = Ext.create('erp.util.BaseUtil');
  9. this.control({
  10. 'button[id=prev]': {
  11. click: function(btn){
  12. var bt = parent.Ext.ComponentQuery.query('button[step=1]')[0];
  13. bt.fireEvent('click', bt);
  14. }
  15. },
  16. 'button[id=next]': {
  17. click: function(btn){
  18. var bt = parent.Ext.ComponentQuery.query('button[step=3]')[0];
  19. bt.fireEvent('click', bt);
  20. }
  21. },
  22. 'button[id=confirm]': {
  23. click: function(btn){
  24. var form = btn.ownerCt.ownerCt;
  25. if(form.getForm().isValid()){
  26. me.uulogin(form);
  27. } else {
  28. alert("请正确输入您的uu信息!");
  29. }
  30. }
  31. }
  32. });
  33. },
  34. uulogin: function(form){
  35. Ext.Ajax.request({
  36. url : basePath + 'system/uulogin.action',
  37. params : {
  38. em_uu : form.down('#em_uu').value.toString(),
  39. em_password : form.down('#em_password').value.toString(),
  40. en_uu : form.down('#en_uu').value.toString()
  41. },
  42. method : 'post',
  43. callback : function(options,success,response){
  44. var res = Ext.JSON.decode(response.responseText);
  45. if(res.success){
  46. var r = Ext.decode(res.data);
  47. if(r){
  48. if (r.success) {
  49. var bt = parent.Ext.ComponentQuery.query('button[step=3]')[0];
  50. bt.fireEvent('click', bt);
  51. } else {
  52. if(r.loginStatus == 'noexit'){
  53. alert("您输入的企业UU不存在,请仔细核对后再重新输入!");
  54. form.down('#en_uu').focus(false, 100);
  55. } else if(r.loginStatus =='noactive' ) {
  56. alert("您输入的企业UU尚未激活,请先激活后再登录本系统!");
  57. } else if(r.loginStatus == 'loginerror') {
  58. alert("您输入的用户名或密码错误!");
  59. form.down('#em_password').focus(false, 100);
  60. } else {
  61. alert("您输入的用户名或密码错误!");
  62. form.down('#em_password').focus(false, 100);
  63. }
  64. }
  65. } else {
  66. var bt = parent.Ext.ComponentQuery.query('button[step=3]')[0];
  67. bt.fireEvent('click', bt);
  68. }
  69. }
  70. }
  71. });
  72. }
  73. });