cookie存储中文会出问题
js在存入cookie时,利用escape() 函数可对字符串进行编码,
用unescape进行解码
document.cookie="menu1="+ escape(me.parentElement.parentElement.previousElementSibling.innerText);
getCookie("menu1");
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
if(cookieHandler.get('logoInfo.rdid') != null || cookieHandler.get('logoInfo.pwd') != null || cookieHandler.get('logoInfo.displayname') != null ||cookieHandler.get('logoInfo.time') != null){
let rdidCookie = cookieHandler.get('logoInfo.pwd')
let pwdCookie = cookieHandler.get('logoInfo.rdid')
let displaynameCookie = this.getCookie('logoInfo.displayname')
BASE.data.cookieName = displaynameCookie
let timeCookie = cookieHandler.get('logoInfo.time')
$('.user_name').text(displaynameCookie)
$('.head_user_name').text(displaynameCookie)
$('.personal').attr('href','https://opac.tzlib.cn:8182/opac/websearch/commonlogin?rdid='+ pwdCookie +'&passwd='+rdidCookie+'&time='+timeCookie+'&method=2&furl=https://opac.tzlib.cn:8182/opac/index')
$('.TzLogin').hide()
$('.photo_icon').addClass('cuccess_icon')
$('.TzLoginText').show()
$('.main_header .header .user_wrap').show()
}else{
$('.TzLogin').show()
$('.photo_icon').removeClass('cuccess_icon')
$('.TzLoginText').hide()
$('.user_wrap').hide()
}