module-menu-vue 0.3.6 → 0.3.7

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.7",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -146,7 +146,7 @@ export default {
146
146
  console.log('开始调用退出接口...')
147
147
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
148
148
  await integrationLogout();
149
- this.logoutUrl()
149
+ await this.logoutUrl()
150
150
  } else {
151
151
  let url = ''
152
152
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
@@ -157,28 +157,40 @@ export default {
157
157
  url = '/auth/token/logout'
158
158
  }
159
159
  const method = ["integration", 'LNRD', 'HBJK'].includes(this.stash) ? 'post' : 'delete'
160
- Axios(url, method).then(() => {
161
- this.logoutUrl();
160
+ Axios(url, method).then(async () => {
161
+ await this.logoutUrl();
162
162
  })
163
163
  .catch((err) => {
164
164
  console.log('err: ', err)
165
165
  });
166
166
  }
167
167
  },
168
- logoutUrl() {
168
+ async logoutUrl() {
169
169
  localStorage.clear();
170
170
  sessionStorage.clear();
171
- let url = ''
172
171
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
173
- url = '/admin-ui/login'
172
+ await getLoginUrl()
173
+ .then((res) => {
174
+ if (res?.data?.data?.loginoutUrl) {
175
+ console.log('Login URL found:', res.data.data.loginoutUrl);
176
+ window.location.replace(res.data.data.loginoutUrl);
177
+ } else {
178
+ console.log('No login URL found, redirect to default login page.');
179
+ window.location.replace('/admin-ui/login');
180
+ }
181
+ })
182
+ .catch((e) => {
183
+ console.log('GetLoginUrl error: ', e);
184
+ window.location.replace('/admin-ui/login');
185
+ });
186
+ return;
174
187
  } else if (this.stash === 'GZW') {
175
- url = '/data-platform/#/login'
188
+ location.href = '/data-platform/#/login'
176
189
  } else if (this.stash === 'PANWEI') {
177
- url = '/bigdata-portal/#/login'
190
+ location.href = '/bigdata-portal/#/login'
178
191
  } else {
179
- url = '/#/login'
192
+ location.href = '/#/login'
180
193
  }
181
- location.href = url
182
194
  },
183
195
  getName () {
184
196
  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
  }