fix(#606): guanyu (文件合入)

This commit is contained in:
2026-06-15 08:18:15 +08:00
committed by 华佗
parent 60c84b5a8c
commit e877dfd259
3 changed files with 12 additions and 11 deletions

View File

@@ -20,13 +20,13 @@ const useAppStore = defineStore(
this.sidebar.opened = !this.sidebar.opened this.sidebar.opened = !this.sidebar.opened
this.sidebar.withoutAnimation = withoutAnimation this.sidebar.withoutAnimation = withoutAnimation
if (this.sidebar.opened) { if (this.sidebar.opened) {
Cookies.set('sidebarStatus', 1) Cookies.set('sidebarStatus', 1, { path: '/' })
} else { } else {
Cookies.set('sidebarStatus', 0) Cookies.set('sidebarStatus', 0, { path: '/' })
} }
}, },
closeSideBar({ withoutAnimation }) { closeSideBar({ withoutAnimation }) {
Cookies.set('sidebarStatus', 0) Cookies.set('sidebarStatus', 0, { path: '/' })
this.sidebar.opened = false this.sidebar.opened = false
this.sidebar.withoutAnimation = withoutAnimation this.sidebar.withoutAnimation = withoutAnimation
}, },
@@ -35,7 +35,7 @@ const useAppStore = defineStore(
}, },
setSize(size) { setSize(size) {
this.size = size; this.size = size;
Cookies.set('size', size) Cookies.set('size', size, { path: '/' })
}, },
toggleSideBarHide(status) { toggleSideBarHide(status) {
this.sidebar.hide = status this.sidebar.hide = status

View File

@@ -7,9 +7,9 @@ export function getToken() {
} }
export function setToken(token) { export function setToken(token) {
return Cookies.set(TokenKey, token) return Cookies.set(TokenKey, token, { path: '/' })
} }
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) return Cookies.remove(TokenKey, { path: '/' })
} }

View File

@@ -321,16 +321,17 @@ function handleLogin() {
loading.value = true; loading.value = true;
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码 // 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
if (loginForm.value.rememberMe) { if (loginForm.value.rememberMe) {
Cookies.set('username', loginForm.value.username, { expires: 30 }); Cookies.set('username', loginForm.value.username, { expires: 30, path: '/' });
Cookies.set('password', encrypt(loginForm.value.password), { Cookies.set('password', encrypt(loginForm.value.password), {
expires: 30, expires: 30,
path: '/',
}); });
Cookies.set('rememberMe', loginForm.value.rememberMe, { expires: 30 }); Cookies.set('rememberMe', loginForm.value.rememberMe, { expires: 30, path: '/' });
} else { } else {
// 否则移除 // 否则移除
Cookies.remove('username'); Cookies.remove('username', { path: '/' });
Cookies.remove('password'); Cookies.remove('password', { path: '/' });
Cookies.remove('rememberMe'); Cookies.remove('rememberMe', { path: '/' });
} }
// 调用action的登录方法 // 调用action的登录方法
userStore userStore