vue2-client 1.8.282 → 1.8.284

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.8.282",
3
+ "version": "1.8.284",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -12,17 +12,52 @@ export const indexedDB = {
12
12
  // 建立或打开数据库,建立对象存储空间(ObjectStore)
13
13
  const self = this
14
14
  if (self.db) {
15
- callback(self.db)
15
+ // 尝试开启
16
+ try {
17
+ const request = self.db.transaction('metaCache', 'readwrite').objectStore('metaCache').add({
18
+ key: 'alive',
19
+ data: true
20
+ })
21
+ request.onerror = function (e) {
22
+ self.openDatabase().then(db => {
23
+ self.db = db
24
+ callback(db)
25
+ }).catch(e => {
26
+ console.error(e)
27
+ })
28
+ }
29
+ request.onsuccess = function () {
30
+ callback(self.db)
31
+ }
32
+ } catch (e) {
33
+ self.openDatabase().then(db => {
34
+ self.db = db
35
+ callback(db)
36
+ }).catch(e => {
37
+ console.error(e)
38
+ })
39
+ }
16
40
  } else {
41
+ self.openDatabase().then(db => {
42
+ self.db = db
43
+ callback(self.db)
44
+ }).catch(e => {
45
+ console.error('打开数据库失败:' + e.message)
46
+ })
47
+ }
48
+ },
49
+ openDatabase () {
50
+ const self = this
51
+ return new Promise((resolve, reject) => {
17
52
  const version = 1
18
53
  const request = self.indexedDB.open('view', version)
19
54
 
20
55
  request.onerror = function (e) {
21
- console.error('打开数据库失败:' + e.currentTarget.error.message)
56
+ reject(e.currentTarget.error)
22
57
  }
23
58
  request.onsuccess = function (e) {
24
- self.db = e.target.result
25
- callback(self.db)
59
+ const db = e.target.result
60
+ resolve(db)
26
61
  }
27
62
  request.onupgradeneeded = function (e) {
28
63
  const db = e.target.result
@@ -33,7 +68,7 @@ export const indexedDB = {
33
68
  })
34
69
  }
35
70
  }
36
- }
71
+ })
37
72
  },
38
73
  deleteDB: function (dbname) {
39
74
  // 删除数据库
@@ -184,6 +219,7 @@ export const indexedDB = {
184
219
 
185
220
  request.onerror = function () {
186
221
  console.error('数据删除失败')
222
+ callback()
187
223
  }
188
224
  request.onsuccess = function (event) {
189
225
  console.log('已删除存储空间' + 'metaCache' + '中所有记录')
@@ -194,8 +230,12 @@ export const indexedDB = {
194
230
  })
195
231
  },
196
232
  clearCache () {
197
- indexedDB.clear(() => {
233
+ if (this.indexedDB) {
234
+ this.clear(() => {
235
+ location.reload()
236
+ })
237
+ } else {
198
238
  location.reload()
199
- })
239
+ }
200
240
  }
201
241
  }
@@ -5,7 +5,7 @@ import notification from 'ant-design-vue/es/notification'
5
5
  import errorCode from '@vue2-client/utils/errorCode'
6
6
  import qs from 'qs'
7
7
  import { logout } from '@vue2-client/services/user'
8
- import { V4_LOGIN } from '@vue2-client/services/apiService'
8
+ import { LOGIN, SEARCH, V4_LOGIN } from '@vue2-client/services/apiService'
9
9
 
10
10
  // 是否显示重新登录
11
11
  let isReloginShow
@@ -153,6 +153,10 @@ function loadInterceptors () {
153
153
  } else {
154
154
  config.headers[ACCESS_TOKEN] = token
155
155
  }
156
+ // 请求v3 时,添加X-Skip-Lua头 避免地方项目 nginx 加密导致请求 不同
157
+ if ([LOGIN, SEARCH].includes(config.url) || config.url.startsWith('/rs/user')) {
158
+ config.headers['X-Skip-Lua'] = 1
159
+ }
156
160
  }
157
161
  }
158
162
  if (!config.headers['Content-Type']) {
package/vue.config.js CHANGED
@@ -89,6 +89,7 @@ module.exports = {
89
89
  }
90
90
  },
91
91
  configureWebpack: config => {
92
+ config.devtool = 'source-map'
92
93
  // 忽略.md文件
93
94
  config.module.rules.push(
94
95
  {