1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- /*12软件沈俊坚 ------用户操作页*/
- Namespace.register("UJ.User");
- /*文本框获取到焦点*/
- UJ.User.onfocuText = function () {
- for (var i = 0; i < $("input@type=text").length; i++) {
- $("input@type=text")[i].onfocus = function () {
- UJ.User.write(this);
- }
- }
- for (var i = 0; i < $("input@type=password").length; i++) {
- $("input@type=password")[i].onfocus = function () {
- UJ.User.write(this);
- }
- }
- }
- /*用户是否修改*/
- UJ.User.isWrite = function (a, b) {
- for (var i = 64; i < 71; i++) {
- if (a == JBOX_arr[i][b]) {
- return JBOX_arr[i][1];
- }
- }
- return false;
- }
- /*判断用户有没有在用户框内写东西*/
- UJ.User.write = function (a) {
- var c = a.value;
- a.style.color = "#000";
- if (a.id != "input_Text") {
- a.style.border = "1px solid #9c9c9c ";
- }
- if (false != UJ.User.isWrite(c, 1)) { a.value = ""; }
- a.onblur = function () { UJ.User.unblurText(a, c); }
- }
- /*用户输入完毕,或者用户未输入*/
- UJ.User.unblurText = function (a, b, c) {// 0 本身开始为空 1 输入后取消为空
- if (a.value == "") {
- if (a.value == "") { var o = UJ.User.isWrite(a.id, 0); }
- else { var o = UJ.User.isWrite(b, 1); }
- a.value = o;
- a.style.color = "#ccc";
- }
- }
- /*登录*/
- UJ.User.login = function (a) {
- var name = $("#login_user")[0];
- var pass = $("#login_pass")[0];
- if (name.value == "请输入用户名/手机/邮箱") { name.style.border = "2px solid red"; U.Alert("帐号未输入哦"); }
- else if (pass.value == "请输入用户密码") { pass.style.border = "2px solid red"; U.Alert("密码未输入哦"); }
- else {
- var o = U.A.Request("UseStudioManage.uploadUserinfo", ([name.value, pass.value, "", U.MS.produceGuid()]));
- if (o.value == false) { pass.style.border = "2px solid red"; U.Alert("用户名密码错误"); }
- else { U.Alert("正在登录中", 50); UJ.User.RemUser(name, a); }
- //获取cooikes
- }
- }
- /*注册*/
- UJ.User.reg = function (a) {
- var name = $("#reg_user")[0]; var pass = $("#reg_pass")[0]; var repass = $("#reg_repass")[0];
- var email = $("#reg_email")[0]; var Ver = $("#Ver")[0];
- if (name.value == "请输入用户名/手机/邮箱") { name.style.border = "2px solid red"; U.Alert("帐号未填写哦"); }
- else if (pass.value == "请输入用户密码") { pass.style.border = "2px solid red"; U.Alert("密码未填写哦"); }
- else if (pass.value != repass.value) { repass.style.border = "2px solid red"; U.Alert("密码输入的不一致哦"); }
- else if (email.value == "方便找回密码") { pass.style.border = "2px solid red"; U.Alert("邮箱未填写哦"); }
- else if (Ver.value == "") { pass.style.border = "2px solid red"; U.Alert("验证码未填写哦"); }
- else if (!U.A.Request("UseStudioManage.GetCheckCodeAjax", ([Ver.value]))) { U.Alert("验证码不正确哦"); }
- else {
- var o = U.A.Request("UseStudioManage.uploadUserinfo", ([name.value, pass.value, "", U.MS.produceGuid()]));
- if (o.value != false) {
- U.Alert("注册成功啦", 50);
- UJ.User.RemUser(name, a);
- U.A.Request("UseStudioManage.userregisterAjax", ([name.value, pass.value, email.value, "", U.MS.produceGuid(), ""]));
- } else {
- U.Alert("服务器繁忙或者帐号已被注册");
- }
- }
- }
- /*已登录的退出*/
- UJ.User.out = function (a) {
- U.Alert("退出成功");
- $("#" + a)[0].style.display = "block";
- UJ.Fnx.ExHs(["out", "Hello", "mybaby"], "none"); //这里后面要添加删除cookies
- }
- /*退出后的样式*/
- UJ.User.RemUser = function (name, a) {
- UJ.Fnx.showHide("", "", 1);
- $("#" + a)[0].style.display = "none";
- $$("div", { "id": "Hello", "className": "Hello", "innerHTML": "你好, " + name.value + "先生" }, $("#UJ_T_B_H_Content")[0]);
- if ($("#out")[0]) { $("#out")[0].style.display == "block"; }
- else {
- $$("div", { "id": "out", "innerHTML": "[退出]", "className": "Out UJ_left", "onclick": [[UJ.User.out, ([a])]] }, $("#UJ_T_B_H_Content")[0]);
- }
- $$("div", { "id": "mybaby", "className": "mybaby UJ_left", "id": "mybaby", "innerHTML": "我的订单" }, $("#UJ_T_B_H_Content")[0]);
- }
|