代码更新
This commit is contained in:
@@ -32,6 +32,12 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-dao-redis</artifactId>
|
||||
<version>1.31.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--工具包-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
|
||||
@@ -19,6 +19,7 @@ import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
@@ -160,7 +161,10 @@ public class AuthorizationController {
|
||||
@ApiOperation("退出登录")
|
||||
@DeleteMapping(value = "/logout")
|
||||
public ResponseEntity<Object> logout(HttpServletRequest request) {
|
||||
onlineUserService.logout(StpUtil.getTokenValue());
|
||||
if (ObjectUtil.isNotEmpty(StpUtil.getTokenValue())){
|
||||
onlineUserService.logout(StpUtil.getTokenValue());
|
||||
}
|
||||
|
||||
StpUtil.logout();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ NProgress.configure({ showSpinner: false })// NProgress Configuration
|
||||
const whiteList = ['/login', '/expand']// no redirect whitelist
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
||||
if (to.meta.title) {
|
||||
// document.title = to.meta.title + ' - ' + Config.title
|
||||
document.title = to.meta.title
|
||||
}
|
||||
NProgress.start()
|
||||
NProgress.start() //https://www.jianshu.com/p/346c05d4d9d8
|
||||
if (getToken()) {
|
||||
// debugger
|
||||
// 已登录且要跳转的页面是登录页
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
@@ -46,7 +46,7 @@ router.beforeEach((to, from, next) => {
|
||||
if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
next(`/login?redirect=www.baidu.com`) // 否则全部重定向到登录页
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ router.beforeEach((to, from, next) => {
|
||||
|
||||
export const loadMenus = (next, to) => {
|
||||
buildMenus().then(res => {
|
||||
debugger
|
||||
const sdata = JSON.parse(JSON.stringify(res))
|
||||
const rdata = JSON.parse(JSON.stringify(res))
|
||||
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||
|
||||
@@ -12,17 +12,17 @@ export const constantRouterMap = [
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
path: '/401',
|
||||
component: (resolve) => require(['@/views/features/404'], resolve),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
path: '/404',
|
||||
component: (resolve) => require(['@/views/features/401'], resolve),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/redirect',
|
||||
path: '/redirect', // 重定向从上到下找路由,不存在则走404
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user