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/lib/super-ui.css +1 -1
- package/lib/super-ui.umd.min.js +3 -3
- package/package.json +1 -1
- package/src/utils/common-util.js +17 -0
- package/src/utils/request.js +4 -1
package/package.json
CHANGED
package/src/utils/common-util.js
CHANGED
|
@@ -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
|
+
}
|
package/src/utils/request.js
CHANGED
|
@@ -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 请根据实际情况自行修改
|