imatrix-ui 2.8.85-dwtmp1 → 2.8.86-dwtmp1

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": "imatrix-ui",
3
- "version": "2.8.85-dwtmp1",
3
+ "version": "2.8.86-dwtmp1",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -206,3 +206,20 @@ export function getOrignUrl() {
206
206
  export function isPromise(p) {
207
207
  return p && Object.prototype.toString.call(p) === '[object Promise]'
208
208
  }
209
+ /**
210
+ * 获得UTC时区
211
+ * @returns 时区
212
+ */
213
+ export function getTimeZone() {
214
+ const dateStr = new Date() + ''
215
+ let timeZone = ''
216
+ if (dateStr.indexOf('GMT') > 0) {
217
+ const timeZoneSuffix = dateStr.substring(dateStr.indexOf('GMT') + 3, dateStr.indexOf('(')).trim()
218
+ const partPrefix = timeZoneSuffix.substring(0, timeZoneSuffix.length - 2)
219
+ const partSuffix = timeZoneSuffix.substring(timeZoneSuffix.length - 2)
220
+ timeZone = 'UTC' + partPrefix + ':' + partSuffix
221
+ } else if (dateStr.indexOf('UTC') > 0) {
222
+ timeZone = 'UTC' + dateStr.substring(dateStr.indexOf('UTC') + 3, dateStr.indexOf('(')).trim()
223
+ }
224
+ return timeZone
225
+ }
@@ -13,7 +13,8 @@ import {
13
13
  getI18n
14
14
  } from './util'
15
15
  import {
16
- getRelativeBaseUrl
16
+ getRelativeBaseUrl,
17
+ getTimeZone
17
18
  } from './common-util'
18
19
  // 创建axios实例
19
20
  const service = axios.create({
@@ -27,6 +28,8 @@ service.interceptors.request.use(
27
28
  config => {
28
29
  // 防止重复发送ajax请求
29
30
  store.commit('togglePreventReclick', true)
31
+ const timeZone = getTimeZone()
32
+ config.headers['timeZone'] = timeZone
30
33
  const token = getToken()
31
34
  if (token) {
32
35
  config.headers['Authorization'] = token // 让每个请求携带自定义token 请根据实际情况自行修改
@@ -61,7 +64,6 @@ service.interceptors.response.use(
61
64
  // 出错了之后允许再次提交
62
65
  store.commit('togglePreventReclick', false)
63
66
  if (error.response) {
64
- console.log('请求返回不为空---', error)
65
67
  if (error.response.status === 401) {
66
68
  // LoginException(401)
67
69
  // 清除sessionStorage中的jwt,否则无法转到login页面
@@ -130,15 +132,14 @@ service.interceptors.response.use(
130
132
  return Promise.reject(error)
131
133
  }
132
134
  } else {
133
- console.log('请求返回空---', error)
134
- // const errorMsg = getI18n().t('imatrixUIMessage.internalServerError')
135
- // Message({
136
- // showClose: true,
137
- // message: errorMsg,
138
- // type: 'error',
139
- // duration: 5 * 1000
140
- // })
141
- // return Promise.reject(error)
135
+ const errorMsg = getI18n().t('imatrixUIMessage.internalServerError')
136
+ Message({
137
+ showClose: true,
138
+ message: errorMsg,
139
+ type: 'error',
140
+ duration: 5 * 1000
141
+ })
142
+ return Promise.reject(error)
142
143
  }
143
144
  }
144
145
  )