退出登录
This commit is contained in:
		
							parent
							
								
									afb4daf19d
								
							
						
					
					
						commit
						3c0491662d
					
				@ -51,9 +51,12 @@ export default {
 | 
			
		||||
    toggleSideBar() {
 | 
			
		||||
      this.$store.dispatch('app/toggleSideBar')
 | 
			
		||||
    },
 | 
			
		||||
    // 退出登录
 | 
			
		||||
    async logout() {
 | 
			
		||||
      // 在vuex中删除token, userinfo
 | 
			
		||||
      await this.$store.dispatch('user/logout')
 | 
			
		||||
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
 | 
			
		||||
      // 调整登录页
 | 
			
		||||
      this.$router.push('/login')
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -150,6 +150,11 @@ const actions = {
 | 
			
		||||
    }
 | 
			
		||||
    commit('setUserInfo', totalInfo)
 | 
			
		||||
    return totalInfo
 | 
			
		||||
  },
 | 
			
		||||
  // 退出登录
 | 
			
		||||
  logout(contex) {
 | 
			
		||||
    contex.commit('removeToken')
 | 
			
		||||
    contex.commit('removeUserInfo')
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user