module-menu-vue 0.0.54 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -60,26 +60,25 @@ export default {
|
|
|
60
60
|
let url = ''
|
|
61
61
|
if (flag === 'single') {
|
|
62
62
|
url = this.stash === "integration" ? '/admin-ui/user/profile' : '/#/info/index'
|
|
63
|
+
location.href = url;
|
|
63
64
|
} else if (flag === 'systerm') {
|
|
64
65
|
url = this.stash === "integration" ? '/admin-ui/bpm/manager/user-group' : '/#/admin/user/index'
|
|
66
|
+
location.href = url;
|
|
65
67
|
} else if (flag === 'logout') {
|
|
66
68
|
this.logoutFunc()
|
|
67
69
|
}
|
|
68
|
-
location.href = url;
|
|
69
70
|
},
|
|
70
71
|
async logoutFunc () {
|
|
71
72
|
console.log('开始调用退出接口...')
|
|
72
73
|
if (this.stash === 'integration') {
|
|
73
|
-
|
|
74
|
+
// this.$emit('logout')
|
|
75
|
+
await integrationLogout();
|
|
74
76
|
this.logoutUrl()
|
|
75
77
|
} else {
|
|
76
|
-
// await compactLogout()
|
|
77
78
|
const url = this.stash === 'integration' ? '/admin-api/system/auth/logout' : '/auth/token/logout'
|
|
78
79
|
const method = this.stash === 'integration'? 'post' : 'delete'
|
|
79
80
|
Axios(url, method).then(() => {
|
|
80
|
-
|
|
81
|
-
sessionStorage.clear();
|
|
82
|
-
location.href = this.stash === "integration" ? '/admin-ui/login' : '/#/login'
|
|
81
|
+
this.logoutUrl();
|
|
83
82
|
})
|
|
84
83
|
.catch((err) => {
|
|
85
84
|
console.log('err: ', err)
|
|
@@ -6,7 +6,7 @@ axios.interceptors.response.use(
|
|
|
6
6
|
(response) => {
|
|
7
7
|
if (response.status === 200) {
|
|
8
8
|
return response;
|
|
9
|
-
} else if (response.status === 401 || response.status === 302 || response.status === 403) {
|
|
9
|
+
} else if (response.data.code === 401 || response.status === 401 || response.status === 302 || response.status === 403) {
|
|
10
10
|
console.log('response env: ', process.env.NODE_ENV)
|
|
11
11
|
if (process.env.NODE_ENV === 'production') {
|
|
12
12
|
tokenValue = getStore({ name: 'access_token' });
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import Axios from './axios';
|
|
2
|
-
const
|
|
3
|
-
const DEFAULT_LOGOUT_URL =
|
|
2
|
+
const localStorageToken = localStorage.getItem('ACCESS_TOKEN')
|
|
3
|
+
const DEFAULT_LOGOUT_URL = localStorageToken ? '/admin-ui/login' : '/#/login'
|
|
4
|
+
import { integrationLogout } from '../User/service.js'
|
|
4
5
|
// 校验token是否失效
|
|
5
|
-
export const checkToken = (token) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
6
|
+
export const checkToken = async (token) => {
|
|
7
|
+
if (localStorageToken) {
|
|
8
|
+
integrationLogout()
|
|
9
|
+
this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
|
|
10
|
+
localStorage.clear();
|
|
11
|
+
sessionStorage.clear();
|
|
12
|
+
location.href = DEFAULT_LOGOUT_URL;
|
|
13
|
+
}});
|
|
14
|
+
} else {
|
|
15
|
+
Axios('get',`/auth/oauth/check_token?token=${token}`, '', {} )
|
|
16
|
+
.then().catch(() =>{
|
|
17
|
+
this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
|
|
18
|
+
localStorage.clear();
|
|
19
|
+
sessionStorage.clear();
|
|
20
|
+
location.href = DEFAULT_LOGOUT_URL;
|
|
21
|
+
}});
|
|
22
|
+
})
|
|
23
|
+
}
|
|
14
24
|
}
|