退出登录清除localstorage

This commit is contained in:
zhujiyan
2024-08-16 14:28:57 +08:00
parent 66a50043bc
commit d63bca7abe
2 changed files with 43 additions and 1 deletions

View File

@@ -51,7 +51,6 @@
<PopupPwd ref="popupPwd" /> <PopupPwd ref="popupPwd" />
<AdminInfo ref="popupAdminInfo" /> <AdminInfo ref="popupAdminInfo" />
<!-- <TerminalVue /> --> <!-- <TerminalVue /> -->
</div> </div>
</template> </template>
@@ -69,6 +68,7 @@ import html2canvas from 'html2canvas'
import PopupPwd from './popup/password.vue' import PopupPwd from './popup/password.vue'
import AdminInfo from './popup/adminInfo.vue' import AdminInfo from './popup/adminInfo.vue'
import { useNavTabs } from '@/stores/navTabs' import { useNavTabs } from '@/stores/navTabs'
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
const navTabs = useNavTabs() const navTabs = useNavTabs()
const configStore = useConfig() const configStore = useConfig()
@@ -114,6 +114,8 @@ const handleCommand = (key: string) => {
break break
case 'layout': case 'layout':
navTabs.closeTabs() navTabs.closeTabs()
window.localStorage.clear()
adminInfo.reset()
router.push({ name: 'login' }) router.push({ name: 'login' })
break break
default: default:

View File

@@ -47,6 +47,46 @@ export const useAdminInfo = defineStore('adminInfo', {
dataFill(state: AdminInfo) { dataFill(state: AdminInfo) {
this.$state = { ...this.$state, ...state } this.$state = { ...this.$state, ...state }
}, },
reset() {
this.$state = {
access_token: '',
token_type: '',
refresh_token: '',
expires_in: 0,
scope: '',
nickname: '',
userType: 0,
deptIndex: '',
userIndex: '',
client_id: '',
headSculpture: '',
jti: '',
name: '',
deptId: '',
phone: '',
email: '',
limitIpStart: '',
limitIpEnd: '',
limitTime: '',
casualUser: 0,
type: 0,
smsNotice: 0,
emailNotice: 0,
role: [],
devCode: '',
id: '',
loginName: '',
state: 0,
registerTime: '',
loginTime: '',
deptName: '',
areaId: '',
areaName: '',
deptLevel: 0,
roleList: [],
roleCode: []
}
},
removeToken() { removeToken() {
this.access_token = '' this.access_token = ''
this.refresh_token = '' this.refresh_token = ''