|
|
|
@ -1,7 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by ljx on 2019/4/25.
|
|
|
|
|
*/
|
|
|
|
|
$(function () {
|
|
|
|
|
$(function(){
|
|
|
|
|
//cookie数据保存格式是key=value;key=value;形式,loginInfo为保存在cookie中的key值,具体看controller代码
|
|
|
|
|
/*if(str != ""){
|
|
|
|
|
var userName = str.split("#")[0];
|
|
|
|
@ -12,7 +15,7 @@ $(function () {
|
|
|
|
|
//并且选中复选框
|
|
|
|
|
$("#rememberMe").attr("checked", true);
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取cookie
|
|
|
|
|
/*function getCookie(cname) {
|
|
|
|
|
var name = cname + "=";
|
|
|
|
@ -25,38 +28,38 @@ $(function () {
|
|
|
|
|
return "";
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
$("#forgetPwd").on("click", function () {
|
|
|
|
|
$("#forgetPwd").on("click",function(){
|
|
|
|
|
alert("请联系管理员进行修改密码!");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function login() {
|
|
|
|
|
function login(){
|
|
|
|
|
var userName = $("#userName").val();
|
|
|
|
|
var userPwd = $("#userPwd").val();
|
|
|
|
|
userPwd = hex_hmac_md5(userPwd, userPwd);
|
|
|
|
|
userPwd = hex_hmac_md5(userPwd,userPwd);
|
|
|
|
|
var rememberMeChecked = $("input[type='checkbox']").is(':checked');
|
|
|
|
|
var rememberMe = '';
|
|
|
|
|
if (rememberMeChecked) {
|
|
|
|
|
if(rememberMeChecked){
|
|
|
|
|
rememberMe = 'yes';
|
|
|
|
|
}
|
|
|
|
|
if (userName == '') {
|
|
|
|
|
if(userName == ''){
|
|
|
|
|
toastr.warning("用户名不能为空!");
|
|
|
|
|
} else {
|
|
|
|
|
if (userPwd == '') {
|
|
|
|
|
}else{
|
|
|
|
|
if(userPwd == ''){
|
|
|
|
|
toastr.warning("密码不能为空!");
|
|
|
|
|
} else {
|
|
|
|
|
}else{
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: path + "/login",
|
|
|
|
|
data: {userName: userName, userPwd: userPwd, rememberMe: rememberMe},
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.code == 100) {
|
|
|
|
|
type : "POST",
|
|
|
|
|
url : path+"/login",
|
|
|
|
|
data: {userName:userName, userPwd:userPwd,rememberMe:rememberMe},
|
|
|
|
|
dataType:'json',
|
|
|
|
|
success : function(data) {
|
|
|
|
|
if(data.code == 100){
|
|
|
|
|
window.location.href = data.extend.url;
|
|
|
|
|
} else {
|
|
|
|
|
alert(data.msg)
|
|
|
|
|
}else{
|
|
|
|
|
$("#msg").text(data.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -65,62 +68,58 @@ function login() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var interval = "";
|
|
|
|
|
var qrCodeIdentity = "";
|
|
|
|
|
|
|
|
|
|
//获取扫码登录二维码
|
|
|
|
|
function handoffLogin() {
|
|
|
|
|
var interval ="";
|
|
|
|
|
var qrCodeIdentity ="";
|
|
|
|
|
function handoffLogin(){
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
data: {loginTypeBitValue: 16, type: 3, projectUid: "cloudkey-fstth", ApplicationId: "fstth-wzh"},
|
|
|
|
|
url: path + '/font/getQRcode',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
qrCodeIdentity = data.qrCodeIdentity;
|
|
|
|
|
$("#QRcordImg").prop("src", "data:image/jpeg;base64," + data.qrCodeBase64);
|
|
|
|
|
//轮询监听用户扫码
|
|
|
|
|
interval = setInterval(scanCodeLogin, 1000, qrCodeIdentity);
|
|
|
|
|
type : "POST",
|
|
|
|
|
data:{loginTypeBitValue:16,type:3,projectUid:"cloudkey-fstth",ApplicationId:"fstth-wzh"},
|
|
|
|
|
url : path+'/font/getQRcode',
|
|
|
|
|
success : function(data) {
|
|
|
|
|
qrCodeIdentity = data.qrCodeIdentity;
|
|
|
|
|
$("#QRcordImg").prop("src","data:image/jpeg;base64,"+data.qrCodeBase64);
|
|
|
|
|
interval = setInterval(scanCodeLogin, 1000,qrCodeIdentity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
$("#switchHandoff").css("display", "none");
|
|
|
|
|
$("#switchHandoff2").css("display", "block");
|
|
|
|
|
$("#switchHandoff").css("display","none");
|
|
|
|
|
$("#switchHandoff2").css("display","block");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scanCodeLogin() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
data: {qrCodeIdentity: qrCodeIdentity},
|
|
|
|
|
url: path + '/font/getScanCode',
|
|
|
|
|
success: function (body) {
|
|
|
|
|
if (body.verifyStatus == 0) {
|
|
|
|
|
//扫码认证成功后撤销监听
|
|
|
|
|
type:"POST",
|
|
|
|
|
data:{qrCodeIdentity:qrCodeIdentity},
|
|
|
|
|
url : path+'/font/getScanCode',
|
|
|
|
|
success : function (body) {
|
|
|
|
|
if (body.verifyStatus ==0) {
|
|
|
|
|
clearInterval(interval);
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
data: {userToken: body.userToken},
|
|
|
|
|
url: path + '/font/getUserInfo',
|
|
|
|
|
success: function (tlte) {
|
|
|
|
|
if (tlte.msgType == 1) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
data: {userName: tlte.uid},
|
|
|
|
|
url: path + '/font/qRCodeLogin',
|
|
|
|
|
success: function (tltel) {
|
|
|
|
|
if (tltel.code == 100) {
|
|
|
|
|
|
|
|
|
|
window.location.href = tltel.extend.url;
|
|
|
|
|
} else {
|
|
|
|
|
$("#msg").text(tltel.msg);
|
|
|
|
|
$.ajax({
|
|
|
|
|
type:"POST",
|
|
|
|
|
data:{userToken:body.userToken},
|
|
|
|
|
url : path+'/font/getUserInfo',
|
|
|
|
|
success : function (tlte) {
|
|
|
|
|
if (tlte.msgType==1){
|
|
|
|
|
$.ajax({
|
|
|
|
|
type:"POST",
|
|
|
|
|
data:{userName:tlte.uid },
|
|
|
|
|
url : path+'/font/qRCodeLogin',
|
|
|
|
|
success:function (tltel) {
|
|
|
|
|
if(tltel.code == 100){
|
|
|
|
|
|
|
|
|
|
window.location.href = tltel.extend.url;
|
|
|
|
|
}else{
|
|
|
|
|
$("#msg").text(tltel.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
alert("登录失败请重新登录")
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
alert("登录失败请重新登录")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -128,24 +127,27 @@ function scanCodeLogin() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handoffLogin2() {
|
|
|
|
|
|
|
|
|
|
$("#switchHandoff").css("display", "block");
|
|
|
|
|
$("#switchHandoff2").css("display", "none");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handoffLogin2(){
|
|
|
|
|
|
|
|
|
|
$("#switchHandoff").css("display","block");
|
|
|
|
|
$("#switchHandoff2").css("display","none");
|
|
|
|
|
clearInterval(interval);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('body').keydown(function () {
|
|
|
|
|
if (event.keyCode == '13') {
|
|
|
|
|
if(event.keyCode == '13'){
|
|
|
|
|
login();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
/**
|
|
|
|
|
* 判断是iframe框架跳出iframe框架使用top链接
|
|
|
|
|
*/
|
|
|
|
|
if (top.location != location) {
|
|
|
|
|
if (top.location != location){
|
|
|
|
|
top.location.href = location.href;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|