var paramValue="" var addscript=0 var scripts = document.querySelectorAll('script'); for (var i = 0; i < scripts.length; i++) { if(scripts[i].src && scripts[i].src.indexOf("jquery")>0){ addscript=1; } } console.log(addscript) if(addscript==0) { var clipboard_script = document.createElement("script"); clipboard_script.src = "https://control.ttkefu.com/js/jquery1.7.js"; document.getElementsByTagName("HEAD")[0].appendChild(clipboard_script); } var yan_zheng = document.createElement("script"); yan_zheng.src = "https://control.ttkefu.com/js/yan_zheng.js"; document.getElementsByTagName("HEAD")[0].appendChild(yan_zheng); var area = document.createElement("script"); area.src = "https://control.ttkefu.com/js/area.js"; document.getElementsByTagName("HEAD")[0].appendChild(area); var jqr = document.createElement("script"); jqr.src = "https://control.ttkefu.com/js/jquery.qrcode.min.js"; document.getElementsByTagName("HEAD")[0].appendChild(jqr); var pt_register = document.createElement("link"); pt_register.rel="stylesheet"; pt_register.href ="https://www.ttkefu.com/m/login/denglu1_css/pt_register.css"; document.getElementsByTagName("HEAD")[0].appendChild(pt_register); /*地址参数*/ window.success_goUrl=""; //window.findpwd="findpwd"; function GetSuccessGoUrl(){ var item=document.getElementById("kefusoft"); var iParas=item.src.substring(item.src.indexOf("?")+1); var iAry=iParas.split("&loginok="); window.success_goUrl=iAry[1]; } GetSuccessGoUrl(); app_count = 0; var appinterval; function cAppInterval() { clearInterval(appinterval); } //去掉alert里的网址 js中的alert提示框去掉ip地址或域名 window.alert = function(msg, callback) { var div = document.createElement("div"); div.innerHTML = "" + "
账密登录
APP登录
微信登录
")
cAppInterval();
}
}else{
var ret=data.split("?");
if(ret.length==2){
if(ret[1]!=""){
var iPstParas="https://control.ttkefu.com/dailireg/dl_login_savereg.jsp?a=1&ll=&bs=app&tiao=0";
iPstParas=iPstParas+"&zh="+ret[0];
iPstParas=iPstParas+"&password="+ret[1];
iPstParas=iPstParas+"&autologin=0";
if (document.getElementById("wxoid")){
iPstParas=iPstParas+"&wxoid="+document.getElementById("wxoid").value;
}else{
iPstParas=iPstParas+"&wxoid=";
}
var new_script = document.createElement("script");
new_script.src =iPstParas;
document.getElementsByTagName("HEAD")[0].appendChild(new_script);
cAppInterval();
}else{
$("#apperweimasm").show();
}
}
}
}, error: function () {
}
});
}
var openid = "";
var opt_sms = 0;
interval_count = 0;
var interval;
function cInterval() {
clearInterval(interval);
}
function wxLogin(scene_id) {
$.ajax({
type: "POST", cache: false, timeout: 5000, url: "https://www.ttkefu.com/login/TtkefuWxHandler.ashx",
data: { "act": "WxLogin", "scene_id": scene_id }, dataType: "json",
success: function (Json) {
console.log(Json)
interval_count = interval_count + 1;
if (Json.Code == "0" || Json.Code == 0) {
if (interval_count > 60) {
$("#gzh").text("请点击刷新二维码");
$("#refresh").show();
$("#gzh").show();
$("#erweimasm").hide();
$("#erweima").css("opacity",0.2);
cInterval();
}
//未扫码进行关注公众号
} if (Json.Code == "1" || Json.Code == 1) {
cInterval();
document.getElementById("erweima_content").style.display = "none";
document.getElementById("shouji").style.display = "block";
openid = Json.openid;
$("#nickname").text(Json.nickname);
$("#headimgurl").attr('src', Json.headimgurl);
$("#wxdivc").css("height","316px");
}
if (Json.Code == "2" || Json.Code == 2) {
//直接登录
wxopenidlogo(Json.openid)
cInterval();
}
if (Json.Code == "3" || Json.Code == 3) {
//已经扫码进行关注公众号,但未操作完成
$("#gzh").text("请点击公众号链接");
$("#erweimasm").show();
$("#gzh").show();
$("#refresh").hide();
}
}, error: function () {
}
});
}
function geterweima() {
$.ajax({
type: "GET", cache: false, timeout: 5000, url: "https://www.ttkefu.com/login/TtkefuWxHandler.ashx",
data: { "act": "GetErweima" }, dataType: "json",
success: function (Json) {
if(Json.imgUrl!=""){
$("#erweima").attr('src', Json.imgUrl);
$("#refresh").hide();
$("#gzh").hide();
$("#erweima").css("opacity",1);
interval_count = 0;
interval = setInterval(function () { wxLogin(Json.scene_id) }, 2000);
}else{
$("#erweima").attr('src', "https://www.ttkefu.com/images/wxewm.png");
$("#gzh").text("请点击刷新二维码");
$("#gzh").show();
$("#refresh").show();
$("#erweima").css("opacity",0.2);
}
}, error: function () {
$("#erweima").attr('src', "https://www.ttkefu.com/images/wxewm.png");
$("#gzh").text("请点击刷新二维码");
$("#gzh").show();
$("#refresh").show();
$("#erweima").css("opacity",0.2);
}
});
}
function hqyz(){
//验证码按钮
var phone = $.trim($("#mphone").val());
if (phone == "") {
$("#error").text("请输入手机号码");
$("#error").show();
document.getElementById("mphone").focus();
return false;
}
if (phone.length != 11) {
$("#error").text("请输入正确的手机号码");
$("#error").show();
document.getElementById("mphone").focus();
return false;
}
//发送验证码
SendRegCodeNum();
}
/*倒计时*/
var SendTimeTi = 0;
function SendTime(i, btnCodeId) {
document.getElementById('hqyz').style.background = "#478BFF";
document.getElementById('hqyz').style.borderColor = "#478BFF";
var vGetCodeTxt = "获取验证码";
if (i > 0) {
document.getElementById('hqyz').style.background = "#a0cfff";
document.getElementById('hqyz').style.borderColor = "#a0cfff";
vGetCodeTxt = "重新发送(" + i + ")";
clearTimeout(SendTimeTi);
setTimeout(function () {
SendTime(i - 1, btnCodeId);
}, 1000);
$("#" + btnCodeId).attr("disable",true);
} else {
$("#" + btnCodeId).removeAttr("disable");
}
$("#" + btnCodeId).text(vGetCodeTxt);
}
//更新新手机号-发送验证码
function SendRegCodeNum() {
$.ajax({
type: "POST", cache: false, timeout: 5000, url: "https://www.ttkefu.com/login/TtkefuWxHandler.ashx",
data: { "act": "WxBindPhoneCode", "PhoneNumbers": $("#mphone").val() }, dataType: "json",
success: function (Json) {
opt_sms = 1;
if (Json.Code == "2" || Json.Code == "1" || Json.Code == 2 || Json.Code == 1) {
if (Json.Code == "2" || Json.Code == 2) {
$('#reg_exist').val(1);
}else{
$("#email_div").css("display","block");
$("#wxdivc").css("height","316px");
}
//倒计时
SendTime(60, 'hqyz');
} else {
$("#error").text(Json.Msg);
}
}, error: function () {
}
});
}
function wxbind(){
if(openid=="" || typeof openid === "undefined"){
return false;
}
//验证码按钮
var m = $.trim($("#mphone").val());
var email=$.trim($("#email").val());
var gw=$.trim($("#gw").val());
var uname=$.trim($("#uname").val());
if (m == "") {
$("#error").text("请输入手机号码");
$("#error").show();
document.getElementById('mphone').focus();
return false;
}
if (m.length != 11) {
$("#error").text("请输入正确的手机号码");
$("#error").show();
document.getElementById('mphone').focus();
return false;
}
if (opt_sms == 0) {
$("#error").text("请发送验证码");
$("#error").show();
return false;
}
var CodeNum = $("#yzm").val();
if (CodeNum == "") {
$("#error").text("请输入验证码");
$("#error").show();
return false;
}
var city1 = $("#city1").val();
var post_url = "https://control.ttkefu.com/dailireg/savereg.jsp";
var reg_exist = $("#reg_exist").val();
if (reg_exist == "1" || reg_exist == 1) {
post_url = "https://www.ttkefu.com/login/TtkefuWxHandler.ashx";
}else{
if(email == "") {
$("#error").text("请输入登录邮箱");
$("#error").show();
document.getElementById('email').focus();
return false;
}else{
var emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
if(!emailRegex.test(email)){
$("#error").text("登录邮箱格式不正确");
$("#error").show();
return false;
}
}
$.ajax({
type: "POST", cache: false, timeout: 2000, url: "https://www.ttkefu.com/login/TtkefuWxHandler.ashx",
data: { "act": "WxPass", "mobile": m, "openid": openid }, dataType: "json",
success: function (Json) { }
});
}
var cpt=0;
if ($("#cpt").attr("checked") == "checked" || $("#cpt").attr("checked") || $('#cpt').is(':checked')) {
cpt=1;
} else {
$("#error").text("请勾选隐私政策,信息");
$("#error").show();
return false;
}
$.ajax({
type: "POST", cache: false, timeout: 5000, url: post_url,
data: { "act": "WxBindPhone", "mobile": m, "CodeNum": CodeNum, "openid": openid, "city": city1,"email":email,"cpt":cpt,"gw":gw,"uname":uname }, dataType: "json",
success: function (Json) {
console.log(Json);
if (Json.err == "0" || Json.Code == 0) {
//登录
wxopenidlogo(openid)
}
if (Json.err == "1" || Json.Code == 1) {
$("#error").text("手机号码错误");
$("#error").show();
}
if (Json.err == "2" || Json.Code == 2) {
$("#error").text("手机号验证码错误");
$("#error").show();
}
if ( Json.Code == 7 || Json.Code == 8) {
$("#error").text("邮箱已经被注册");
$("#error").show();
}
if (Json.Code == 4 || Json.Code == 3) {
$("#error").text("数据错误");
$("#error").show();
}
if (Json.Code == 6) {
$("#error").text("服务器错误");
$("#error").show();
}
if (Json.Code == 10) {
$("#error").text("请勾选协议");
$("#error").show();
}
if (Json.Code ==9) {
$("#error").text("顾问检测失败");
$("#error").show();
}
}, error: function () {
}
});
}
function wxopenidlogo(openid){
var iPstParas="https://control.ttkefu.com/dailireg/dl_login_savereg.jsp?a=1&ll=&bs=app&tiao=0";
iPstParas=iPstParas+"&zh=";
iPstParas=iPstParas+"&password=";
iPstParas=iPstParas+"&autologin=0";
iPstParas=iPstParas+"&openid="+openid;
if (document.getElementById("wxoid")){
iPstParas=iPstParas+"&wxoid="+document.getElementById("wxoid").value;
}else{
iPstParas=iPstParas+"&wxoid=";
}
var new_script = document.createElement("script");
new_script.src =iPstParas;
document.getElementsByTagName("HEAD")[0].appendChild(new_script);
}