@yeeyoon/library 3.5.1 → 3.5.2

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.
@@ -134,7 +134,11 @@ const Header = (props) => {
134
134
 
135
135
  const backToIam = () => {
136
136
  const { origin, pathname } = window.location;
137
- window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
137
+ if (origin.indexOf('huashan') > -1) {
138
+ window.location.href = 'https://testing-huashan-login.yeeyoon.com/login';
139
+ } else {
140
+ window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
141
+ }
138
142
  };
139
143
 
140
144
  // eslint-disable-next-line no-unused-vars
@@ -44,7 +44,11 @@ rest && ls.set(REST_KEY, JSON.stringify(rest));
44
44
 
45
45
  const backToIam = () => {
46
46
  const { origin, pathname } = window.location;
47
- window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
47
+ if (origin.indexOf('huashan') > -1) {
48
+ window.location.href = 'https://testing-huashan-login.yeeyoon.com/login';
49
+ } else {
50
+ window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
51
+ }
48
52
  };
49
53
 
50
54
  const errorHandler = (error) => {
@@ -78,36 +82,39 @@ const request = extend({
78
82
  },
79
83
  });
80
84
 
81
- request.interceptors.response.use(async (response) => {
82
- const resp = await response.clone().json();
83
- const { data, code, message, msg, errormsg, success } = resp;
84
- if (!data && !code && !message && !msg && !errormsg && !success) {
85
- return response;
86
- }
87
- const m = msg || message || errormsg;
88
- if (code !== 200 && code !== 201 && !success) {
89
- m !== '操作过于频繁' &&
90
- m.indexOf('存在重复的物资') < 0 &&
91
- notification.error({
92
- message: m,
93
- maxCount: 1,
94
- });
95
- if (
96
- code === 401 ||
97
- code === 402 ||
98
- m === 'token验证失败' ||
99
- m === 'token不一致'
100
- ) {
101
- window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
102
- setTimeout(() => {
103
- backToIam();
104
- }, 1000);
85
+ request.interceptors.response.use(
86
+ async (response) => {
87
+ const resp = await response.clone().json();
88
+ const { data, code, message, msg, errormsg, success } = resp;
89
+ if (!data && !code && !message && !msg && !errormsg && !success) {
90
+ return response;
105
91
  }
106
- return resp;
107
- } else if (success && (!code || code === 200)) {
108
- return resp;
109
- }
110
- return data;
111
- }, { global: false });
92
+ const m = msg || message || errormsg;
93
+ if (code !== 200 && code !== 201 && !success) {
94
+ m !== '操作过于频繁' &&
95
+ m.indexOf('存在重复的物资') < 0 &&
96
+ notification.error({
97
+ message: m,
98
+ maxCount: 1,
99
+ });
100
+ if (
101
+ code === 401 ||
102
+ code === 402 ||
103
+ m === 'token验证失败' ||
104
+ m === 'token不一致'
105
+ ) {
106
+ window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
107
+ setTimeout(() => {
108
+ backToIam();
109
+ }, 1000);
110
+ }
111
+ return resp;
112
+ } else if (success && (!code || code === 200)) {
113
+ return resp;
114
+ }
115
+ return data;
116
+ },
117
+ { global: false }
118
+ );
112
119
 
113
120
  export default request;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {
package/src/global.css CHANGED
@@ -4,7 +4,7 @@ html, body, #root {
4
4
 
5
5
  body {
6
6
  margin: 0;
7
- /* background-color: #000 !important; */
7
+ background-color: #000 !important;
8
8
  }
9
9
 
10
10
  body * {