Login.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // JavaScript Document
  2. function OpenLoad() {
  3. $('#Dialog-Load').dialog({
  4. width: 90,
  5. height: 37,
  6. border: false,
  7. noheader: true,
  8. modal: true,
  9. content: '<div class="easyui-panel" style="width:90px; height:37px; padding:5px;">\n' +
  10. '<img src="Image/loading.gif" width="16" height="16" style="position: absolute; top: 10px;" />\n' +
  11. '<span style="position: absolute; top: 11px; left: 32px;">请稍等...</span>\n' +
  12. '</div>',
  13. })
  14. }
  15. function CloseLoad() {
  16. $('#Dialog-Load').dialog('close');
  17. }
  18. function Login() {
  19. var n = $("#name").val();
  20. var p = $("#pass").val();
  21. if (n.length < 3) {
  22. $.messager.alert('警告', '非法的用户名称...', 'error');
  23. return;
  24. }
  25. if (p.length < 3) {
  26. $.messager.alert('警告', '非法的用户密码...', 'error');
  27. return;
  28. }
  29. var json = {
  30. "username": n,
  31. "password": p,
  32. }
  33. var aj = $.ajax({
  34. beforeSend: function () {
  35. OpenLoad();
  36. },
  37. success: function () {
  38. CloseLoad();
  39. if (json.username != "admin" && json.password != "admin") {
  40. $.messager.alert('警告', 'error');
  41. } else {
  42. window.location.href = "/web/main/";
  43. }
  44. },
  45. error: function () {
  46. CloseLoad();
  47. $.messager.alert('警告', '与服务器通讯失败...', 'error');
  48. }
  49. })
  50. }