vue2-client 1.22.4 → 1.22.5

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": "vue2-client",
3
- "version": "1.22.4",
3
+ "version": "1.22.5",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -160,9 +160,10 @@ export default {
160
160
  const encrypt = new JSEncrypt()
161
161
  encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
162
162
  const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
163
+ const jwt = res.jwtNew
163
164
  // 获取路由配置
164
165
  getRoutesConfig(data, this.routeName).then(result => {
165
- this.$login.login(result).then(() => {
166
+ this.$login.login(result, jwt).then(() => {
166
167
  // V3任何情况首位加入资源管理
167
168
  const resourceManageMain = {
168
169
  name: '资源管理',
@@ -172,7 +173,7 @@ export default {
172
173
  }
173
174
  result.functions.unshift(resourceManageMain)
174
175
  this.afterGeneral(result)
175
- this.setAccessToken(data)
176
+ this.setAccessToken(data, jwt)
176
177
  if (result.deps === '用户工单登记') {
177
178
  this.$router.push(this.ticketPage).catch(() => {})
178
179
  } else {
@@ -216,14 +217,15 @@ export default {
216
217
  indexedDB.clear()
217
218
  this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
218
219
  },
219
- setAccessToken (data) {
220
- if (data) {
221
- localStorage.setItem(ACCESS_TOKEN, data)
222
- let timestamp = new Date().getTime()// 当前的时间戳
220
+ setAccessToken (data, jwt) {
221
+ const token = jwt || data
222
+ if (token) {
223
+ localStorage.setItem(ACCESS_TOKEN, token)
224
+ let timestamp = new Date().getTime() // 当前的时间戳
223
225
  timestamp = timestamp + 12 * 60 * 60 * 1000
224
226
  // 格式化时间获取年月日, 登陆过期时间
225
227
  const dateAfter = new Date(timestamp)
226
- setAuthorization({ token: data, expireAt: dateAfter })
228
+ setAuthorization({ token: token, expireAt: dateAfter })
227
229
  }
228
230
  }
229
231
  }
@@ -159,9 +159,10 @@ export default {
159
159
  const encrypt = new JSEncrypt()
160
160
  encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
161
161
  const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
162
+ const jwt = res.jwtNew
162
163
  // 获取路由配置
163
164
  getRoutesConfig(data, this.routeName).then(result => {
164
- this.$login.login(result).then(() => {
165
+ this.$login.login(result, jwt).then(() => {
165
166
  // V3任何情况首位加入资源管理
166
167
  const resourceManageMain = {
167
168
  name: '资源管理',
@@ -171,7 +172,7 @@ export default {
171
172
  }
172
173
  result.functions.unshift(resourceManageMain)
173
174
  this.afterGeneral(result)
174
- this.setAccessToken(data)
175
+ this.setAccessToken(data, jwt)
175
176
  if (result.deps === '用户工单登记') {
176
177
  this.$router.push(this.ticketPage).catch(() => {})
177
178
  } else {
@@ -215,14 +216,15 @@ export default {
215
216
  indexedDB.clear()
216
217
  this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
217
218
  },
218
- setAccessToken (data) {
219
- if (data) {
220
- localStorage.setItem(ACCESS_TOKEN, data)
221
- let timestamp = new Date().getTime()// 当前的时间戳
219
+ setAccessToken (data, jwt) {
220
+ const token = jwt || data
221
+ if (token) {
222
+ localStorage.setItem(ACCESS_TOKEN, token)
223
+ let timestamp = new Date().getTime() // 当前的时间戳
222
224
  timestamp = timestamp + 12 * 60 * 60 * 1000
223
225
  // 格式化时间获取年月日, 登陆过期时间
224
226
  const dateAfter = new Date(timestamp)
225
- setAuthorization({ token: data, expireAt: dateAfter })
227
+ setAuthorization({ token: token, expireAt: dateAfter })
226
228
  }
227
229
  }
228
230
  }
@@ -42,27 +42,16 @@ export function checkSingleAuthorization(authType = AUTH_TYPE.BEARER, token) {
42
42
  return false
43
43
  }
44
44
 
45
- function setSingleAuthorization(auth, authType = AUTH_TYPE.BEARER) {
46
- switch (authType) {
47
- case AUTH_TYPE.BEARER:
48
- localStorage.setItem(V4_ACCESS_TOKEN, 'Bearer ' + auth.token)
49
- break
50
- case AUTH_TYPE.BASIC:
51
- case AUTH_TYPE.AUTH1:
52
- case AUTH_TYPE.AUTH2:
53
- default:
54
- break
55
- }
56
- }
57
-
58
45
  function setAccessToken(data, jwt) {
59
46
  const token = jwt || data
60
- localStorage.setItem(ACCESS_TOKEN, token)
61
- let timestamp = new Date().getTime() // 当前的时间戳
62
- timestamp = timestamp + 12 * 60 * 60 * 1000
63
- // 格式化时间获取年月日, 登陆过期时间
64
- const dateAfter = new Date(timestamp)
65
- setSingleAuthorization({ token: token, expireAt: dateAfter })
47
+ if (token) {
48
+ localStorage.setItem(ACCESS_TOKEN, token)
49
+ let timestamp = new Date().getTime() // 当前的时间戳
50
+ timestamp = timestamp + 12 * 60 * 60 * 1000
51
+ // 格式化时间获取年月日, 登陆过期时间
52
+ const dateAfter = new Date(timestamp)
53
+ setAuthorization({ token: token, expireAt: dateAfter })
54
+ }
66
55
  }
67
56
 
68
57
  function afterGeneral(result, options) {