UJ.User.js 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*12软件沈俊坚 ------用户操作页*/
  2. Namespace.register("UJ.User");
  3. /*文本框获取到焦点*/
  4. UJ.User.onfocuText = function () {
  5. for (var i = 0; i < $("input@type=text").length; i++) {
  6. $("input@type=text")[i].onfocus = function () {
  7. UJ.User.write(this);
  8. }
  9. }
  10. for (var i = 0; i < $("input@type=password").length; i++) {
  11. $("input@type=password")[i].onfocus = function () {
  12. UJ.User.write(this);
  13. }
  14. }
  15. }
  16. /*用户是否修改*/
  17. UJ.User.isWrite = function (a, b) {
  18. for (var i = 64; i < 71; i++) {
  19. if (a == JBOX_arr[i][b]) {
  20. return JBOX_arr[i][1];
  21. }
  22. }
  23. return false;
  24. }
  25. /*判断用户有没有在用户框内写东西*/
  26. UJ.User.write = function (a) {
  27. var c = a.value;
  28. a.style.color = "#000";
  29. if (a.id != "input_Text") {
  30. a.style.border = "1px solid #9c9c9c ";
  31. }
  32. if (false != UJ.User.isWrite(c, 1)) { a.value = ""; }
  33. a.onblur = function () { UJ.User.unblurText(a, c); }
  34. }
  35. /*用户输入完毕,或者用户未输入*/
  36. UJ.User.unblurText = function (a, b, c) {// 0 本身开始为空 1 输入后取消为空
  37. if (a.value == "") {
  38. if (a.value == "") { var o = UJ.User.isWrite(a.id, 0); }
  39. else { var o = UJ.User.isWrite(b, 1); }
  40. a.value = o;
  41. a.style.color = "#ccc";
  42. }
  43. }
  44. /*登录*/
  45. UJ.User.login = function (a) {
  46. var name = $("#login_user")[0];
  47. var pass = $("#login_pass")[0];
  48. if (name.value == "请输入用户名/手机/邮箱") { name.style.border = "2px solid red"; U.Alert("帐号未输入哦"); }
  49. else if (pass.value == "请输入用户密码") { pass.style.border = "2px solid red"; U.Alert("密码未输入哦"); }
  50. else {
  51. var o = U.A.Request("UseStudioManage.uploadUserinfo", ([name.value, pass.value, "", U.MS.produceGuid()]));
  52. if (o.value == false) { pass.style.border = "2px solid red"; U.Alert("用户名密码错误"); }
  53. else { U.Alert("正在登录中", 50); UJ.User.RemUser(name, a); }
  54. //获取cooikes
  55. }
  56. }
  57. /*注册*/
  58. UJ.User.reg = function (a) {
  59. var name = $("#reg_user")[0]; var pass = $("#reg_pass")[0]; var repass = $("#reg_repass")[0];
  60. var email = $("#reg_email")[0]; var Ver = $("#Ver")[0];
  61. if (name.value == "请输入用户名/手机/邮箱") { name.style.border = "2px solid red"; U.Alert("帐号未填写哦"); }
  62. else if (pass.value == "请输入用户密码") { pass.style.border = "2px solid red"; U.Alert("密码未填写哦"); }
  63. else if (pass.value != repass.value) { repass.style.border = "2px solid red"; U.Alert("密码输入的不一致哦"); }
  64. else if (email.value == "方便找回密码") { pass.style.border = "2px solid red"; U.Alert("邮箱未填写哦"); }
  65. else if (Ver.value == "") { pass.style.border = "2px solid red"; U.Alert("验证码未填写哦"); }
  66. else if (!U.A.Request("UseStudioManage.GetCheckCodeAjax", ([Ver.value]))) { U.Alert("验证码不正确哦"); }
  67. else {
  68. var o = U.A.Request("UseStudioManage.uploadUserinfo", ([name.value, pass.value, "", U.MS.produceGuid()]));
  69. if (o.value != false) {
  70. U.Alert("注册成功啦", 50);
  71. UJ.User.RemUser(name, a);
  72. U.A.Request("UseStudioManage.userregisterAjax", ([name.value, pass.value, email.value, "", U.MS.produceGuid(), ""]));
  73. } else {
  74. U.Alert("服务器繁忙或者帐号已被注册");
  75. }
  76. }
  77. }
  78. /*已登录的退出*/
  79. UJ.User.out = function (a) {
  80. U.Alert("退出成功");
  81. $("#" + a)[0].style.display = "block";
  82. UJ.Fnx.ExHs(["out", "Hello", "mybaby"], "none"); //这里后面要添加删除cookies
  83. }
  84. /*退出后的样式*/
  85. UJ.User.RemUser = function (name, a) {
  86. UJ.Fnx.showHide("", "", 1);
  87. $("#" + a)[0].style.display = "none";
  88. $$("div", { "id": "Hello", "className": "Hello", "innerHTML": "你好, " + name.value + "先生" }, $("#UJ_T_B_H_Content")[0]);
  89. if ($("#out")[0]) { $("#out")[0].style.display == "block"; }
  90. else {
  91. $$("div", { "id": "out", "innerHTML": "[退出]", "className": "Out UJ_left", "onclick": [[UJ.User.out, ([a])]] }, $("#UJ_T_B_H_Content")[0]);
  92. }
  93. $$("div", { "id": "mybaby", "className": "mybaby UJ_left", "id": "mybaby", "innerHTML": "我的订单" }, $("#UJ_T_B_H_Content")[0]);
  94. }