imatrix-ui 2.8.12 → 2.8.13

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.12",
3
+ "version": "2.8.13",
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 请根据实际情况自行修改