Commit cf1de2c7 authored by zhangyanni's avatar zhangyanni

实时保存用户认证状态

parent e9042e0c
......@@ -78,8 +78,20 @@ const i18n = new VueI18n({
}
})();
// if(document.cookie.indexOf('rfreshShiro=')!=-1){
// console.log(document.cookie.split('rfreshShiro=')[1])
// }
if (document.cookie.length > 0) {
var arr = document.cookie.split('; '); //这里显示的格式需要切割一下自己可输出看下
for (var i = 0; i < arr.length; i++) {
var arr2 = arr[i].split('='); //再次切割
//判断查找相对应的值
if (arr2[0] == 'refreshShiro') {
var userInfo = Base64.encode(decodeURIComponent(arr2[1]));
window.localStorage.setItem("userInfo",userInfo)
}
}
}
router.beforeEach((to, from, next) => {
// console.log(window.__asxiosPromiseArr)
if (window.__asxiosPromiseArr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment