123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- $(function() {
- loginStatus();
- valUser();
-
- $(".times").click(function() {
- $(".cover,.coverset,.cover2").hide();
- });
-
- $(".back-btn").click(function() {
- $(".cover").hide();
- $(".cover2").hide();
- });
-
- $(".replace2").click(function() {
- $(".cover2").show();
- });
-
- $(".replace1").click(function() {
- $(".cover").show();
- });
-
- $(".replace5").click(function() {
- $(".cover").show();
- })
-
- $(".replace6").click(function() {
- $(".cover2").show();
- });
-
- var emailCookie = $.cookie("userEmail");
- var phoneCookie = $.cookie("userMobilePhone");
- if(emailCookie != "" && emailCookie != null && emailCookie != "null") {
-
- emailhome(emailCookie);
- $("#emailShow").text(emailCookieshow);
- $(".replace1").hide();
- $(".replace3").show();
- } else {
- $(".replace1").show();
- $(".replace3").hide();
- }
-
- if(phoneCookie != "" && phoneCookie != null && phoneCookie != "null") {
- $("#phoneShow").text(phoneCookie.substring(0, 3) + "****" + phoneCookie.substring(7, 11));
- $(".replace2").hide();
- $(".replace4").show();
- } else {
- $(".replace2").show();
- $(".replace4").hide();
- }
- })
- function emailhome(emailset) {
-
- var emailq = emailset.replace(/@.*/, "");
- var emailh = emailset.replace(emailq, "");
- if(emailq.length >= 6) {
- emailCookieshow = emailq.substring(emailq.length - 4, 0) + "****" + emailh;
- }
- if(emailq.length == 5) {
- emailCookieshow = emailq.substring(emailq.length - 3, 0) + "***" + emailh;
- }
- if(emailq.length == 4) {
- emailCookieshow = emailq.substring(emailq.length - 2, 0) + "**" + emailh;
- }
- if(emailq.length == 3) {
- emailCookieshow = emailq.substring(emailq.length - 1, 0) + "*" + emailh;
- }
- if(emailq.length < 3) {
- emailCookieshow = emailq + emailh;
- }
- return emailCookieshow;
- }
- var emailPass = false;
- var emailOk = false;
- function valEmail() {
- var email = $("#email").val();
-
- var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
- if(gunf.test(email.trim())) {
- userRegisterOk();
- emailPass = true;
- emailSuccess();
- } else {
-
- $(".msg11 span").text("请输入正确的邮箱地址。");
- emailPass = false;
- }
- }
- function emailSuccess() {
- var mailVal = $('#email').val();
- $(".sett").each(function() {
- var url = mailVal.split('@')[1];
- for(var j in hash) {
- if(hash[url]==undefined){
- $(this).attr("href", "http://mail." + url);
- }else{
- $(this).attr("href", hash[url]);
- }
- }
- });
- }
- function userRegisterOk() {
- var email = $("#email").val();
-
- $.ajax("/ajax/isReg?key=" + email, {
- type: "GET",
- async: false,
- success: function($data) {
-
- if($data.data == true) {
- $(".msg11").text("");
- emailOk = true;
- } else {
- $(".msg11").text("该邮箱已绑定账号,请使用其他邮箱地址。");
- emailOk = false;
- }
- },
- error: function() {
- $.MsgBox.Alert('消息', '服务器请求失败')
- },
- });
- }
- var mailCode = GetQueryString('sc');
- if(mailCode != '') {
- $(".account-set a").eq(1).addClass("bgcolor").siblings().removeClass("bgcolor");
- $(".contentbox .content-set").eq(1).show().siblings().hide();
- $.ajax("/ajax/bindMail/" + mailCode, {
- type: "get",
- async: true,
- success: function(data) {
- userpe();
- },
- error: function() {
- $.MsgBox.Alert('消息提醒', '邮箱绑定失败')
- },
- data: {},
- dataType: 'json'
- });
- }
- function userpe() {
- $.ajax("/ajax/qaUser", {
- type: "get",
- async: true,
- success: function(data) {
-
- $.MsgBox.Alert('消息提醒', '邮箱绑定成功')
- $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
- var emaild = data.data.email;
- emailhome(emaild);
- $.cookie('userEmail', emaild, {
- path: "/"
- });
- $("#emailShow").text(emailCookieshow);
- },
- error: function() {
- $.MsgBox.Alert('消息提醒', '邮箱绑定失败')
- },
- data: {
- "id": $.cookie("userid")
- },
- dataType: 'json'
- });
- }
- function bindEmail() {
- valEmail();
- var email = $("#email").val();
- if(emailPass == true && emailOk == true) {
- $.ajax("/ajax/reqBindMail", {
- type: "GET",
- async: false,
- success: function(data) {
-
- if(data.success) {
-
- if(data.data == true) {
-
- $(".cover").hide();
- $("#vovernext").show();
- $(".emalvel").text(email);
- } else {
- $.MsgBox.Alert("消息提醒", "邮箱发布失败!");
- }
- } else {
- $.MsgBox.Alert("消息提醒", "服务器链接超时!");
- }
- },
- error: function() {
- $.MsgBox.Alert('message', 'fail')
- },
- data: {
- "userid": $.cookie("userid"),
- "mail": $("#email").val()
- },
- dataType: 'json'
- });
- } else {
-
- }
- }
- $("#bindgo").on("click", function() {
- var mailVal = $('.sett').attr("href");
- location.href = mailVal;
- })
- function phoneRegisterOk() {
- var phoneVal = $("#phone").val();
- $.ajax("/ajax/isReg?key=" + phoneVal, {
- type: "GET",
- async: false,
- success: function($data) {
-
- if($data.data == true) {
- $(".msg12").text("");
- phonePass = true;
- } else {
- $(".msg12").text("该手机已绑定账号,请使用其他手机号码。");
- }
- },
- error: function() {
- $.MsgBox.Alert('消息', '服务器请求失败')
- },
- });
- }
- var phonePass = false;
- function valPhone() {
- var phoneVal = $("#phone").val();
- var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
- if(hunPhone.test(phoneVal.trim())) {
- phoneRegisterOk();
- } else {
- phonePass = false;
-
- $(".msg12").text("请输入正确的手机号码");
- }
- }
- var codePass = false;
- function valCode() {
- var phoneCode = $("#phoneCode").val();
- if(phoneCode.length == 0) {
-
- $(".msg13").text("请输入验证码");
- } else {
- if(!isNaN(phoneCode)) {
- codePass = true;
- } else {
- codePass = false;
- $(".msg13").text("请填写数字");
-
- }
- }
- }
- var phoneState;
- function sendPhoneCode() {
- valPhone();
- if(phonePass == true) {
- $.ajax("/ajax/vcWithBind", {
- type: "GET",
- async: false,
- success: function(data) {
-
- if(data.success) {
- if(data.data == null) {
- $(".msg13").text("验证码发送失败,请确认手机号码正确!");
-
- } else {
- phoneState = data.data;
- $(".msg13").text("发送成功,请检查验证码");
- }
- } else {
- $.MsgBox.Alert("消息提醒", "系统异常!");
-
- }
- },
- error: function() {
- $.MsgBox.Alert('message', 'fail')
- },
- data: {
- "userid": $.cookie("userid"),
- "mobilePhone": $("#phone").val()
- },
- dataType: 'json'
- });
- } else {
-
- }
- }
- function bindPhone() {
- valCode();
- if(codePass == true) {
-
- alert($("#phone").val());
- alert(phoneState);
- alert($("#phoneCode").val());*/
- var phoneVal = $("#phone").val();
- $.ajax("/ajax/bindMobilePhone", {
- type: "POST",
- async: false,
- success: function(data) {
- if(data.success) {
-
- if(data.data == true) {
- $.cookie('userMobilePhone', phoneVal, {
- path: "/"
- });
- $(".cover2").hide();
- $.MsgBox.Alert("消息提醒", "手机绑定成功!");
- $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
- location.reload(true);
- } else {
- $.MsgBox.Alert("消息提醒", "短信验证不正确,请检查后重新输入。");
- }
- } else {
- $.MsgBox.Alert("消息提醒", "系统异常!");
-
- }
- },
- error: function() {
- $.MsgBox.Alert('message', 'fail')
- },
- data: {
- "userid": $.cookie("userid"),
- "mobilePhone": $("#phone").val(),
- "validateCode": $("#phoneCode").val(),
- "state": phoneState
- },
- dataType: 'json'
- });
- } else {
-
- }
- }
|