a54552239/pearProject

Version 2.8.2 登录提示success后页面无跳转。首页白屏无内容。控制台报错。

hVenus opened this issue · 2 comments

使用Version 2.8.2版本。开发环境运行。
第一次访问自动跳转到登录页。使用123456/123456登录,提示success.但是页面无跳转。未转到程序主页面。
人工切换到首页,白屏,控制台报错。内容如下:

VM9926:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at getStore (storage.js?68fe:38)
at eval (state.js?fcc2:3)
at Module../src/store/state.js (app.js:14687)
at webpack_require (app.js:767)
at fn (app.js:130)
at eval (index.js?4360:1)
at Module../src/store/index.js (app.js:14639)
at webpack_require (app.js:767)
at fn (app.js:130)

试试看修改src/assets/js/storage.js里面的

export const getStore = (name, parse = false) => {
if (!name) return false;
name = PREFIX + name;
if (parse) {
if (typeof(window.localStorage.getItem(name)) == "string" && window.localStorage.getItem(name) != "undefined") {
return JSON.parse(window.localStorage.getItem(name))
}
}
return window.localStorage.getItem(name)
};

这个函数,parse之前加一个判断,我们这边就是这个问题,改了之后就可以用了

@a54552239 后续版本最好加个容错