|
function login() {
var key = $("#key").val();
if (key != "") {
$.post("/admin/login/XY2/1.0", {
key : key
}, function(data) {
if (data.status == 0) {
layer.msg(data.msg, {
icon : 2
});
} else {
layer.msg(data.msg, {
icon : 1
});
SetCookie("logincode",data.cookie);
var test = window.location.href;
if(key != "")
setTimeout(function() {
window.open("/cdkcode/view/list/XY2/1.0",'_self')
},
500);
} else if(test.indexOf("title/view/list") != -1){
setTimeout(function() {
window.open("/title/view/list/XY2/1.0",'_self')
},
500);
} else {
setTimeout(function() {
window.open("/admin/index/v1",'_self')
},
500);
}
}
});
}
}
function SetCookie(name, value) {
console.log(name, value)
var str = name + "=" + escape(value) + ";path=/";
var date = new Date();
date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000);
str += ";expires=" + date.toGMTString();
console.log(str)
document.cookie = str;
}
谁能看明白啊,哈哈,判断语句。
|
|