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

fix(*): 跳转问题处理

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