Commit 79b5ea76 authored by Cai Wei's avatar Cai Wei

fix(*): 跳转问题处理

parent 8ec91a09
......@@ -66,7 +66,7 @@ const router = useRouter();
const { sidebar } = storeToRefs(menuStore());
const routerList = routes[0].children;
const menuListData = ref(JSON.parse(sessionStorage.getItem("menuList")) || []);
const menuListData = ref(JSON.parse(localStorage.getItem("menuList")) || []);
const getIcon = (iconName) => {
switch (iconName) {
......
......@@ -143,7 +143,7 @@ router.beforeEach((to, from, next) => {
}
// 获取存储的菜单列表
const menuList = JSON.parse(sessionStorage.getItem('menuList') || '[]');
const menuList = JSON.parse(localStorage.getItem('menuList') || '[]');
// 如果没有菜单列表且不是登录页,跳转到登录页
if (!menuList.length) {
......
......@@ -19,5 +19,6 @@ export function setToken(name,token) {
}
export function removeToken(TokenKey) {
localStorage.removeItem('menuList');
return Cookies.remove(TokenKey)
}
......@@ -76,7 +76,7 @@ async function checkUserPermission() {
*/
function logout() {
// 清除所有相关的存储数据
sessionStorage.removeItem('menuList');
localStorage.removeItem('menuList');
sessionStorage.removeItem('userPermission');
// 可能还有其他需要清除的数据,如 token 等
......
......@@ -1073,7 +1073,7 @@ export default {
true
)
.then((result) => {
sessionStorage.setItem("menuList", JSON.stringify(result.data));
localStorage.setItem("menuList", JSON.stringify(result.data));
this.$router.push('/dashboard');
})
.catch((e) => {
......
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