module-menu-vue 0.3.6 → 0.3.8

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "module-menu-vue",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -33,6 +33,8 @@ import { userMenuIcon } from './constant.js'
33
33
  import { getUserName, getIsHaveSystemManagementPermissionFlag } from './../Util/userInfo.js'
34
34
  import { integrationLogout, getSysUrl } from './service.js'
35
35
  import {getMenuList} from '../Menu/service.js'
36
+ import { getLoginUrl } from '../Util/permessionUtils.js';
37
+
36
38
  export default {
37
39
  name: 'UserInfo',
38
40
  data () {
@@ -146,7 +148,7 @@ export default {
146
148
  console.log('开始调用退出接口...')
147
149
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
148
150
  await integrationLogout();
149
- this.logoutUrl()
151
+ await this.logoutUrl()
150
152
  } else {
151
153
  let url = ''
152
154
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
@@ -157,28 +159,40 @@ export default {
157
159
  url = '/auth/token/logout'
158
160
  }
159
161
  const method = ["integration", 'LNRD', 'HBJK'].includes(this.stash) ? 'post' : 'delete'
160
- Axios(url, method).then(() => {
161
- this.logoutUrl();
162
+ Axios(url, method).then(async () => {
163
+ await this.logoutUrl();
162
164
  })
163
165
  .catch((err) => {
164
166
  console.log('err: ', err)
165
167
  });
166
168
  }
167
169
  },
168
- logoutUrl() {
170
+ async logoutUrl() {
169
171
  localStorage.clear();
170
172
  sessionStorage.clear();
171
- let url = ''
172
173
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
173
- url = '/admin-ui/login'
174
+ await getLoginUrl()
175
+ .then((res) => {
176
+ if (res?.data?.data?.loginoutUrl) {
177
+ console.log('Login URL found:', res.data.data.loginoutUrl);
178
+ window.location.replace(res.data.data.loginoutUrl);
179
+ } else {
180
+ console.log('No login URL found, redirect to default login page.');
181
+ window.location.replace('/admin-ui/login');
182
+ }
183
+ })
184
+ .catch((e) => {
185
+ console.log('GetLoginUrl error: ', e);
186
+ window.location.replace('/admin-ui/login');
187
+ });
188
+ return;
174
189
  } else if (this.stash === 'GZW') {
175
- url = '/data-platform/#/login'
190
+ location.href = '/data-platform/#/login'
176
191
  } else if (this.stash === 'PANWEI') {
177
- url = '/bigdata-portal/#/login'
192
+ location.href = '/bigdata-portal/#/login'
178
193
  } else {
179
- url = '/#/login'
194
+ location.href = '/#/login'
180
195
  }
181
- location.href = url
182
196
  },
183
197
  getName () {
184
198
  return getUserName()
@@ -10,7 +10,20 @@ export const checkToken = async (token) => {
10
10
  this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
11
11
  localStorage.clear();
12
12
  sessionStorage.clear();
13
- location.href = DEFAULT_LOGOUT_URL;
13
+ getLoginUrl()
14
+ .then((res) => {
15
+ if (res?.data?.data?.loginoutUrl) {
16
+ console.log('Login URL found:', res.data.data.loginoutUrl);
17
+ window.location.replace(res.data.data.loginoutUrl);
18
+ } else {
19
+ console.log('No login URL found, redirect to default login page.');
20
+ window.location.replace('/admin-ui/login');
21
+ }
22
+ })
23
+ .catch((e) => {
24
+ console.log('GetLoginUrl error: ', e);
25
+ window.location.replace('/admin-ui/login');
26
+ });
14
27
  }});
15
28
  } else {
16
29
  const url = stash === 'GZW' ? `/data-platform/auth/oauth/check_token?token=${token}` : `/auth/oauth/check_token?token=${token}`
@@ -23,4 +36,12 @@ export const checkToken = async (token) => {
23
36
  }});
24
37
  })
25
38
  }
39
+ }
40
+
41
+ // 获取登录地址信息
42
+ export function getLoginUrl() {
43
+ return Axios(
44
+ 'get',
45
+ '/admin-api/system/auth/getCodeUrl',
46
+ )
26
47
  }