tianheng-ui 0.1.82 → 0.1.84
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +72 -72
- package/lib/theme-chalk/fonts/formMaking-iconfont.svg +155 -155
- package/lib/theme-chalk/fonts/th-iconfont.css +2402 -2402
- package/lib/theme-chalk/js/axios.js +87 -87
- package/lib/tianheng-ui.js +4 -4
- package/package.json +87 -86
- package/packages/FormMaking/GenerateForm.vue +392 -392
- package/packages/FormMaking/Upload/index.vue +571 -571
- package/packages/FormMaking/WidgetForm.vue +145 -145
- package/packages/FormMaking/custom/register.js +43 -43
- package/packages/FormMaking/iconfont/demo.css +539 -539
- package/packages/FormMaking/iconfont/demo_index.html +1159 -1159
- package/packages/FormMaking/iconfont/formMaking-iconfont.css +189 -189
- package/packages/FormMaking/iconfont/formMaking-iconfont.svg +155 -155
- package/packages/FormMaking/index.js +33 -33
- package/packages/FormMaking/lang/en-US.js +187 -187
- package/packages/FormMaking/lang/zh-CN.js +187 -187
- package/packages/FormMaking/network/axios.js +88 -88
- package/packages/FormMaking/styles/index.scss +216 -216
- package/packages/FormMaking/util/index.js +98 -98
- package/packages/TableMaking/network/axios.js +88 -88
@@ -1,87 +1,87 @@
|
|
1
|
-
import axios from "axios";
|
2
|
-
import Log from "./Log";
|
3
|
-
import { Notification } from "element-ui";
|
4
|
-
|
5
|
-
export const init = baseConfig => {
|
6
|
-
// 创建axios实例
|
7
|
-
const Axios = axios.create({
|
8
|
-
baseURL: baseConfig.baseUrl,
|
9
|
-
timeout: 60000 // 请求超时时间
|
10
|
-
// withCredentials: true, //允许携带cookie
|
11
|
-
});
|
12
|
-
|
13
|
-
// 添加请求拦截器
|
14
|
-
Axios.interceptors.request.use(
|
15
|
-
config => {
|
16
|
-
const info = sessionStorage.getItem("_TH_OauthConfig");
|
17
|
-
if (info) {
|
18
|
-
const oauthInfo = JSON.parse(info)
|
19
|
-
config.baseURL = oauthInfo.baseUrl
|
20
|
-
config.headers["Authorization"] = oauthInfo.token;
|
21
|
-
}
|
22
|
-
if (baseConfig.headers) {
|
23
|
-
config.headers = Object.assign(config.headers, baseConfig.headers);
|
24
|
-
}
|
25
|
-
return config;
|
26
|
-
},
|
27
|
-
error => {
|
28
|
-
Promise.reject(error);
|
29
|
-
}
|
30
|
-
);
|
31
|
-
|
32
|
-
// 添加响应拦截器
|
33
|
-
Axios.interceptors.response.use(
|
34
|
-
response => {
|
35
|
-
const code = response.status;
|
36
|
-
if (code < 200 || code > 300) {
|
37
|
-
Notification.error({
|
38
|
-
title: response.message
|
39
|
-
});
|
40
|
-
return Promise.reject("error");
|
41
|
-
}
|
42
|
-
|
43
|
-
const dataCode = response.data.code;
|
44
|
-
if (dataCode && dataCode !== 200) {
|
45
|
-
Notification.error({
|
46
|
-
title: response.data.message
|
47
|
-
});
|
48
|
-
return Promise.reject("error");
|
49
|
-
}
|
50
|
-
|
51
|
-
if (baseConfig.debug) {
|
52
|
-
Log.prettyPrimary("Request Url:", response.request.responseURL);
|
53
|
-
Log.prettySuccess("Request Res:", response);
|
54
|
-
}
|
55
|
-
|
56
|
-
return response.data;
|
57
|
-
},
|
58
|
-
error => {
|
59
|
-
let code = 0;
|
60
|
-
try {
|
61
|
-
code = error.response.data.status;
|
62
|
-
} catch (e) {
|
63
|
-
if (error.toString().indexOf("Error: timeout") !== -1) {
|
64
|
-
Notification.error({
|
65
|
-
title: "网络请求超时",
|
66
|
-
duration: 5000
|
67
|
-
});
|
68
|
-
return Promise.reject(error);
|
69
|
-
}
|
70
|
-
}
|
71
|
-
if (code) {
|
72
|
-
const errorMsg = error.response.data.message;
|
73
|
-
Notification.error({
|
74
|
-
title: errorMsg || "未知错误",
|
75
|
-
duration: 5000
|
76
|
-
});
|
77
|
-
} else {
|
78
|
-
Notification.error({
|
79
|
-
title: "接口请求失败",
|
80
|
-
duration: 5000
|
81
|
-
});
|
82
|
-
}
|
83
|
-
return Promise.reject(error);
|
84
|
-
}
|
85
|
-
);
|
86
|
-
return Axios;
|
87
|
-
};
|
1
|
+
import axios from "axios";
|
2
|
+
import Log from "./Log";
|
3
|
+
import { Notification } from "element-ui";
|
4
|
+
|
5
|
+
export const init = baseConfig => {
|
6
|
+
// 创建axios实例
|
7
|
+
const Axios = axios.create({
|
8
|
+
baseURL: baseConfig.baseUrl,
|
9
|
+
timeout: 60000 // 请求超时时间
|
10
|
+
// withCredentials: true, //允许携带cookie
|
11
|
+
});
|
12
|
+
|
13
|
+
// 添加请求拦截器
|
14
|
+
Axios.interceptors.request.use(
|
15
|
+
config => {
|
16
|
+
const info = sessionStorage.getItem("_TH_OauthConfig");
|
17
|
+
if (info) {
|
18
|
+
const oauthInfo = JSON.parse(info)
|
19
|
+
config.baseURL = oauthInfo.baseUrl
|
20
|
+
config.headers["Authorization"] = oauthInfo.token;
|
21
|
+
}
|
22
|
+
if (baseConfig.headers) {
|
23
|
+
config.headers = Object.assign(config.headers, baseConfig.headers);
|
24
|
+
}
|
25
|
+
return config;
|
26
|
+
},
|
27
|
+
error => {
|
28
|
+
Promise.reject(error);
|
29
|
+
}
|
30
|
+
);
|
31
|
+
|
32
|
+
// 添加响应拦截器
|
33
|
+
Axios.interceptors.response.use(
|
34
|
+
response => {
|
35
|
+
const code = response.status;
|
36
|
+
if (code < 200 || code > 300) {
|
37
|
+
Notification.error({
|
38
|
+
title: response.message
|
39
|
+
});
|
40
|
+
return Promise.reject("error");
|
41
|
+
}
|
42
|
+
|
43
|
+
const dataCode = response.data.code;
|
44
|
+
if (dataCode && dataCode !== 200) {
|
45
|
+
Notification.error({
|
46
|
+
title: response.data.message
|
47
|
+
});
|
48
|
+
return Promise.reject("error");
|
49
|
+
}
|
50
|
+
|
51
|
+
if (baseConfig.debug) {
|
52
|
+
Log.prettyPrimary("Request Url:", response.request.responseURL);
|
53
|
+
Log.prettySuccess("Request Res:", response);
|
54
|
+
}
|
55
|
+
|
56
|
+
return response.data;
|
57
|
+
},
|
58
|
+
error => {
|
59
|
+
let code = 0;
|
60
|
+
try {
|
61
|
+
code = error.response.data.status;
|
62
|
+
} catch (e) {
|
63
|
+
if (error.toString().indexOf("Error: timeout") !== -1) {
|
64
|
+
Notification.error({
|
65
|
+
title: "网络请求超时",
|
66
|
+
duration: 5000
|
67
|
+
});
|
68
|
+
return Promise.reject(error);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
if (code) {
|
72
|
+
const errorMsg = error.response.data.message;
|
73
|
+
Notification.error({
|
74
|
+
title: errorMsg || "未知错误",
|
75
|
+
duration: 5000
|
76
|
+
});
|
77
|
+
} else {
|
78
|
+
Notification.error({
|
79
|
+
title: "接口请求失败",
|
80
|
+
duration: 5000
|
81
|
+
});
|
82
|
+
}
|
83
|
+
return Promise.reject(error);
|
84
|
+
}
|
85
|
+
);
|
86
|
+
return Axios;
|
87
|
+
};
|