byt-ui 0.1.10 → 0.1.11

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": "byt-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "private": false,
5
5
  "description": "byt组件库",
6
6
  "author": {
@@ -43,9 +43,8 @@ class Request {
43
43
  if (token && !isToken) {
44
44
  config.headers['Authorization'] = `Bearer ${token}`// token
45
45
  }
46
- if (TENANT_ID) {
47
- config.headers['TENANT-ID'] = TENANT_ID // 租户ID
48
- }
46
+ config.headers['TENANT-ID'] = TENANT_ID || this.getQueryString('TENANT-ID') || '' // 租户ID
47
+
49
48
  return config
50
49
  }, error => {
51
50
  return Promise.reject(error)
@@ -94,6 +93,14 @@ class Request {
94
93
  })
95
94
  }
96
95
 
96
+ getQueryString(name) {
97
+ const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i')
98
+ const r = window.location.search.substr(1).match(reg)
99
+ if (r != null) {
100
+ return decodeURIComponent(r[2])
101
+ }
102
+ return null
103
+ }
97
104
  setMethods() {
98
105
  this._methods.forEach(v => {
99
106
  this.request[v] = ({