getCookie (name) { // 获取cookie
const cookieContent = '; ' + document.cookie
const cookies = cookieContent.split(`; ${name}=`)
return cookies.length - 1 ? cookies.pop().split(';').shift() : ''
},
setCookie (name, val, days) { // 设置cookie
let expires = ''
if (days) {
const date = new Date()
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
expires = `; expires=${date.toUTCString()}`
}
document.cookie = `${name}=${val}${expires}; path=/`
},
delCookie (name) {
var exp = new Date()
exp.setTime(exp.getTime() - 1)
var cval = this.getCookie(name)
if (cval != null) {
document.cookie = name + '=' + cval + ';expires=' + exp.toGMTString() + ';path=/;domain = .zhaopin.com'
}
},
//退出系统时调用
deleteSession () {
const env = process.env.NODE_ENV
const empId = Common.getCookie('xxx')
sessionStorage.removeItem(`${env}${empId}leftMenu`)
},