//生成二维码
function wxLoadPage() {
WXloginDiv();
var url = window.location.pathname + window.location.search;
//编码替换加号
if (url.indexOf("+") > 0)
{
url = url.replace("+", "%2B");
}
var objd = new WxLogin({
id: "wxlogin",
appid: "wxf3de3ade76b72a44",
scope: "snsapi_login",
redirect_uri: "http%3a%2f%2fwww.ansying.com" + url,
state: "STATE",
style: "black",
href: "https://www.ansying.com/css/weixin/weixin.css"
});
}
//扫码登入后跳转
function WX_Login() {
is_weixn();
SetHref();
if (is_weixn() == true) {
$("#wx").css("display", "block");
}
else {
$("#wxpc").css("display", "block");
}
var code = GetRequest()['code'];
var href = window.location.href;
if (code != "undefined" && code != null) {
$.ajax({
type: "Post",
url: "/AnsYingWeiXin/WeChatDev/wxt",
data: { "code": code, "href": href },
success: function (result) {
if (result == "1") {
var h = window.location.href;
var href = h.split("?")[0] + "?" + h.split("?")[1].split("&code")[0];
if (h.split("?")[0] != "http://www.ansying.com/AnsYingWeb/Login/Index") {
//code在前未去除情况,如:http://www.ansying.com/Serach/LawSearch?code=051zxkli2pSqVE0mcgki2Y3lli2zxklo&state=STATE
if (href.indexOf('code') > 0)
{
href = href.split('?')[0];
}
//诚信详情页情况
if (href.split('=')[0] == "http://www.ansying.com/AnsYingCredit/AYZXin/ZXEDetails?CompanyID")
{
href = href + "&Distinguish=0";
}
//中介服务机构情况
if (href.split('=')[0] == "http://www.ansying.com/AnsYingCredit/IntermediaryService/ISEDetails?IntermediaryID")
{
href = href + "&Distinguish=0";
}
window.location.href = href;
}
else {
window.location.href = "http://www.ansying.com/AnsYingWeb/Home/Main";
}
}
else if (result == "NoRegister") {
//window.open("/AnsYingWeb/Login/Register?Register=0");
window.location.href = "/AnsYingWeb/Login/Register?Register=0";
}
},
error: function () {
}
});
}
}
页面加载方法加入WX_Login()方法
后台