aldehyde 0.1.75 → 0.1.77
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/layout/header/index.css +8 -1
- package/lib/layout/menu/user-bar.d.ts.map +1 -1
- package/lib/layout/menu/user-bar.js +2 -3
- package/lib/layout/menu/user-bar.js.map +1 -1
- package/lib/tmpl/superagent.d.ts.map +1 -1
- package/lib/tmpl/superagent.js +54 -40
- package/lib/tmpl/superagent.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/layout/header/index.css +8 -1
- package/src/aldehyde/layout/menu/user-bar.tsx +6 -3
- package/src/aldehyde/tmpl/superagent.js +83 -71
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
width:auto;
|
|
42
42
|
text-align:center;
|
|
43
43
|
cursor: pointer;
|
|
44
|
-
font-size: 14px!important;
|
|
45
44
|
}
|
|
46
45
|
.userLogin i{
|
|
47
46
|
font-size: 24px!important;
|
|
@@ -51,6 +50,14 @@
|
|
|
51
50
|
color:#000;
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
.loginAvatar{
|
|
54
|
+
background: #4a5f74;
|
|
55
|
+
font-size:20px;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
line-height: 46px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
54
61
|
.ant-dropdown-menu-item:hover, .ant-dropdown-menu-submenu-title:hover{
|
|
55
62
|
color:#1890FF;
|
|
56
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-bar.d.ts","sourceRoot":"","sources":["../../../../../src/aldehyde/layout/menu/user-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAO9C,UAAU,YAAY;CAErB;AAGD,UAAU,YAAa,SAAQ,QAAQ;CAEtC;AAGD,cAAM,OAAQ,SAAQ,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC;IACjE,KAAK;;;;MAIJ;IAEK,iBAAiB;IAOvB,UAAU,aAMT;IAGD,MAAM;
|
|
1
|
+
{"version":3,"file":"user-bar.d.ts","sourceRoot":"","sources":["../../../../../src/aldehyde/layout/menu/user-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAO9C,UAAU,YAAY;CAErB;AAGD,UAAU,YAAa,SAAQ,QAAQ;CAEtC;AAGD,cAAM,OAAQ,SAAQ,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC;IACjE,KAAK;;;;MAIJ;IAEK,iBAAiB;IAOvB,UAAU,aAMT;IAGD,MAAM;CAwCT;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import { Dropdown, Menu, Tooltip } from 'antd';
|
|
11
|
+
import { Dropdown, Menu, Tooltip, Avatar } from 'antd';
|
|
12
12
|
import { UserOutlined, LogoutOutlined, ClearOutlined } from '@ant-design/icons';
|
|
13
13
|
import HcserviceV3 from '../../tmpl/hcservice-v3';
|
|
14
14
|
import HCDataSource from "../../tmpl/hc-data-source";
|
|
@@ -54,9 +54,8 @@ class UserBar extends React.PureComponent {
|
|
|
54
54
|
return (React.createElement(React.Fragment, null,
|
|
55
55
|
React.createElement(Dropdown, { overlay: menu, placement: "bottomRight", trigger: ['click'] },
|
|
56
56
|
React.createElement("div", { className: "userLogin" },
|
|
57
|
-
React.createElement(UserOutlined, null),
|
|
58
57
|
React.createElement(Tooltip, { placement: "left", title: name },
|
|
59
|
-
React.createElement(
|
|
58
|
+
React.createElement(Avatar, { className: 'loginAvatar', icon: React.createElement(UserOutlined, null), size: "large" }))))));
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
export default UserBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-bar.js","sourceRoot":"","sources":["../../../../../src/aldehyde/layout/menu/user-bar.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"user-bar.js","sourceRoot":"","sources":["../../../../../src/aldehyde/layout/menu/user-bar.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AACnD,OAAO,EAAC,YAAY,EAAC,cAAc,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAE5E,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,WAAW,MAAM,gBAAgB,CAAA;AACxC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAa7C,MAAM,OAAQ,SAAQ,KAAK,CAAC,aAAyC;IAArE;;QACI,UAAK,GAAC;YACH,EAAE,EAAC,SAAS;YACZ,IAAI,EAAC,SAAS;YACb,KAAK,EAAC,EAAE;SACX,CAAA;QASD,eAAU,GAAC,GAAE,EAAE;YACX,IAAI,EAAC,KAAK,EAAC,GAAC,IAAI,CAAC,KAAK,CAAC;YACvB,IAAI,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YACrD,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAChC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QACnC,CAAC,CAAA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
|
|
1
|
+
{"version":3,"file":"superagent.d.ts","sourceRoot":"","sources":["../../../../src/aldehyde/tmpl/superagent.js"],"names":[],"mappings":"AAIA;IACI,+DA6DC;IAED,uCA4BC;IAED;;;MAMC;CAGJ"}
|
package/lib/tmpl/superagent.js
CHANGED
|
@@ -28,35 +28,42 @@ export default class Superagent {
|
|
|
28
28
|
.query(options.query || '')
|
|
29
29
|
.send(options.data)
|
|
30
30
|
.end((req, res) => {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
if (res.status === 200) {
|
|
36
|
-
Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken);
|
|
37
|
-
let result = res.body;
|
|
38
|
-
if (result && result.status === 'error') {
|
|
39
|
-
message.error("错误消息:" + result.message);
|
|
40
|
-
}
|
|
41
|
-
resolve(result);
|
|
42
|
-
}
|
|
43
|
-
if (res.status === 201) {
|
|
44
|
-
Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken);
|
|
45
|
-
resolve(res);
|
|
46
|
-
}
|
|
47
|
-
else if (res.status === 403) {
|
|
48
|
-
//message.info("请求权限不足,可能是token已经超时")
|
|
49
|
-
//console.log('权限不足或登录超时',options);
|
|
50
|
-
window.location.hash = "/login";
|
|
51
|
-
}
|
|
52
|
-
else if (res.status === 404 || res.status === 504) {
|
|
53
|
-
message.info("服务器连接失败!");
|
|
54
|
-
}
|
|
55
|
-
else if (res.status === 500) {
|
|
56
|
-
message.info("后台处理错误。");
|
|
31
|
+
if (!res) {
|
|
32
|
+
message.error("服务器连接失败");
|
|
33
|
+
reject(res.body);
|
|
57
34
|
}
|
|
58
35
|
else {
|
|
59
|
-
|
|
36
|
+
if (options.data && options.data.isShowLoading !== false) {
|
|
37
|
+
loading = document.getElementById('ajaxLoading');
|
|
38
|
+
loading.style.display = "none";
|
|
39
|
+
}
|
|
40
|
+
if (res.status === 200) {
|
|
41
|
+
Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken);
|
|
42
|
+
let result = res.body;
|
|
43
|
+
if (result && result.status === 'error') {
|
|
44
|
+
message.error("错误消息:" + result.message);
|
|
45
|
+
}
|
|
46
|
+
resolve(result);
|
|
47
|
+
}
|
|
48
|
+
else if (res.status === 201) {
|
|
49
|
+
Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken);
|
|
50
|
+
resolve(res);
|
|
51
|
+
}
|
|
52
|
+
else if (res.status === 403) {
|
|
53
|
+
//message.info("请求权限不足,可能是token已经超时")
|
|
54
|
+
//console.log('权限不足或登录超时',options);
|
|
55
|
+
window.location.hash = "/login";
|
|
56
|
+
}
|
|
57
|
+
else if (res.status === 404 || res.status === 504) {
|
|
58
|
+
message.info("服务资源未找到(" + res.status + ")");
|
|
59
|
+
}
|
|
60
|
+
else if (res.status === 500) {
|
|
61
|
+
message.info("后台处理错误(" + res.status + ")");
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
message.error("服务资源请求失败!");
|
|
65
|
+
reject(res.body);
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
});
|
|
62
69
|
});
|
|
@@ -68,21 +75,28 @@ export default class Superagent {
|
|
|
68
75
|
.get(Units.joinPath(server, options.url))
|
|
69
76
|
.query(options.query || '')
|
|
70
77
|
.end((req, res) => {
|
|
71
|
-
if (res
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
else if (res.status === 403) {
|
|
75
|
-
//message.info("请求权限不足,可能是token已经超时")
|
|
76
|
-
window.location.hash = "#/login";
|
|
77
|
-
}
|
|
78
|
-
else if (res.status === 404 || res.status === 504) {
|
|
79
|
-
message.info("服务器连接失败!");
|
|
80
|
-
}
|
|
81
|
-
else if (res.status === 500) {
|
|
82
|
-
message.info("后台处理错误。");
|
|
78
|
+
if (!res) {
|
|
79
|
+
message.error("服务器连接失败");
|
|
80
|
+
reject(res.body);
|
|
83
81
|
}
|
|
84
82
|
else {
|
|
85
|
-
|
|
83
|
+
if (res.status === 200) {
|
|
84
|
+
resolve(res.body);
|
|
85
|
+
}
|
|
86
|
+
else if (res.status === 403) {
|
|
87
|
+
//message.info("请求权限不足,可能是token已经超时")
|
|
88
|
+
window.location.hash = "#/login";
|
|
89
|
+
}
|
|
90
|
+
else if (res.status === 404 || res.status === 504) {
|
|
91
|
+
message.info("服务资源未找到(" + res.status + ")");
|
|
92
|
+
}
|
|
93
|
+
else if (res.status === 500) {
|
|
94
|
+
message.info("后台处理错误(" + res.status + ")");
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
message.error("服务资源请求失败!");
|
|
98
|
+
reject(res.body);
|
|
99
|
+
}
|
|
86
100
|
}
|
|
87
101
|
});
|
|
88
102
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"superagent.js","sourceRoot":"","sources":["../../../../src/aldehyde/tmpl/superagent.js"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"superagent.js","sourceRoot":"","sources":["../../../../src/aldehyde/tmpl/superagent.js"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,UAAU,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,UAAU;IAC3B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI;QAC5B,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC;YACxG,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACjD,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/C,IAAI,OAAO,CAAC;QACZ,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CA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AAC,GAAG,CAAC,CAAA;qBACzC;yBAAM;wBACH,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;wBAC3B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;qBACnB;iBACJ;YACL,CAAC,CAAC,CAAA;QACV,CAAC,CAAC,CAAA;IACN,CAAC;IAED,MAAM,CAAC,YAAY;QACf,OAAO;YACH,mBAAmB,EAAE,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC;YAC7D,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC;SAC5D,CAAA;IAEL,CAAC;CAGJ"}
|
package/package.json
CHANGED
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
width:auto;
|
|
42
42
|
text-align:center;
|
|
43
43
|
cursor: pointer;
|
|
44
|
-
font-size: 14px!important;
|
|
45
44
|
}
|
|
46
45
|
.userLogin i{
|
|
47
46
|
font-size: 24px!important;
|
|
@@ -51,6 +50,14 @@
|
|
|
51
50
|
color:#000;
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
.loginAvatar{
|
|
54
|
+
background: #4a5f74;
|
|
55
|
+
font-size:20px;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
line-height: 46px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
54
61
|
.ant-dropdown-menu-item:hover, .ant-dropdown-menu-submenu-title:hover{
|
|
55
62
|
color:#1890FF;
|
|
56
63
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {Dropdown, Menu,Tooltip} from 'antd';
|
|
2
|
+
import {Dropdown, Menu,Tooltip,Avatar} from 'antd';
|
|
3
3
|
import {UserOutlined,LogoutOutlined,ClearOutlined} from '@ant-design/icons';
|
|
4
4
|
import {UserInfo} from "../../tmpl/interface";
|
|
5
5
|
import HcserviceV3 from '../../tmpl/hcservice-v3';
|
|
@@ -68,9 +68,12 @@ class UserBar extends React.PureComponent<UserBarProps, UserBarState> {
|
|
|
68
68
|
{/*<Avatar style={{ color:'#1890ff' }} shape="square" icon={<UserOutlined/>} size={{ xs: 8, sm: 16, md: 24, lg: 32, xl: 40, xxl: 48 }}>*/}
|
|
69
69
|
{/*</Avatar>*/}
|
|
70
70
|
{/*</Tooltip>*/}
|
|
71
|
-
|
|
71
|
+
{/*<UserOutlined/>*/}
|
|
72
72
|
<Tooltip placement="left" title={name}>
|
|
73
|
-
<
|
|
73
|
+
<Avatar className={'loginAvatar'} icon={ <UserOutlined/>} size="large" >
|
|
74
|
+
{/*{name ?name.substring(0,1).toUpperCase():null}*/}
|
|
75
|
+
</Avatar>
|
|
76
|
+
{/*<span>{name && name.length>=8?name.substring(0,5)+'...':name}</span>*/}
|
|
74
77
|
</Tooltip>
|
|
75
78
|
|
|
76
79
|
</div>
|
|
@@ -1,96 +1,108 @@
|
|
|
1
1
|
import superagent from 'superagent'
|
|
2
|
-
import {
|
|
2
|
+
import {message} from 'antd';
|
|
3
3
|
import Units from '../units';
|
|
4
4
|
|
|
5
|
-
export default class Superagent{
|
|
6
|
-
static
|
|
7
|
-
const hydrocarbonToken=Units.getLocalStorge("hydrocarbonToken")?Units.getLocalStorge("hydrocarbonToken")
|
|
8
|
-
:options.header && options.header.hydrocarbonToken?
|
|
9
|
-
options.header.hydrocarbonToken:null;
|
|
5
|
+
export default class Superagent {
|
|
6
|
+
static super(options, type, load) {
|
|
7
|
+
const hydrocarbonToken = Units.getLocalStorge("hydrocarbonToken") ? Units.getLocalStorge("hydrocarbonToken")
|
|
8
|
+
: options.header && options.header.hydrocarbonToken ?
|
|
9
|
+
options.header.hydrocarbonToken : null;
|
|
10
10
|
let loading;
|
|
11
|
-
if(options.data && options.data.isShowLoading!==false){
|
|
12
|
-
loading=document.getElementById('ajaxLoading')
|
|
13
|
-
loading.style.display=load?load:"block"
|
|
11
|
+
if (options.data && options.data.isShowLoading !== false) {
|
|
12
|
+
loading = document.getElementById('ajaxLoading')
|
|
13
|
+
loading.style.display = load ? load : "block"
|
|
14
14
|
}
|
|
15
|
-
let ty="form"
|
|
16
|
-
if(type==="formdata"){
|
|
17
|
-
ty=null
|
|
18
|
-
}else if(type==="json"){
|
|
19
|
-
ty="application/json"
|
|
15
|
+
let ty = "form"
|
|
16
|
+
if (type === "formdata") {
|
|
17
|
+
ty = null
|
|
18
|
+
} else if (type === "json") {
|
|
19
|
+
ty = "application/json"
|
|
20
20
|
}
|
|
21
|
-
let method=options.method?options.method:"POST";
|
|
21
|
+
let method = options.method ? options.method : "POST";
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
superagent(method,Units.joinPath(server,options.url))
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
let server = options.hydrocarbonServer ? options.hydrocarbonServer : Units.api();
|
|
26
|
+
superagent(method, Units.joinPath(server, options.url))
|
|
28
27
|
.type(ty)
|
|
29
|
-
.set("hydrocarbon-token",hydrocarbonToken)
|
|
30
|
-
.set("program-token",hydrocarbonToken)
|
|
31
|
-
.query(options.query||'')
|
|
28
|
+
.set("hydrocarbon-token", hydrocarbonToken)
|
|
29
|
+
.set("program-token", hydrocarbonToken)
|
|
30
|
+
.query(options.query || '')
|
|
32
31
|
.send(options.data)
|
|
33
|
-
.end((req,res)=>{
|
|
34
|
-
if(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
.end((req, res) => {
|
|
33
|
+
if (!res) {
|
|
34
|
+
|
|
35
|
+
message.error("服务器连接失败")
|
|
36
|
+
reject(res.body);
|
|
37
|
+
} else {
|
|
38
|
+
if (options.data && options.data.isShowLoading !== false) {
|
|
39
|
+
loading = document.getElementById('ajaxLoading')
|
|
40
|
+
loading.style.display = "none"
|
|
41
|
+
}
|
|
42
|
+
if (res.status === 200) {
|
|
43
|
+
Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken)
|
|
44
|
+
let result = res.body;
|
|
45
|
+
if (result && result.status === 'error') {
|
|
46
|
+
message.error("错误消息:" + result.message)
|
|
47
|
+
}
|
|
48
|
+
resolve(result)
|
|
49
|
+
}else if (res.status === 201) {
|
|
50
|
+
Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken)
|
|
51
|
+
resolve(res)
|
|
52
|
+
} else if (res.status === 403) {
|
|
53
|
+
//message.info("请求权限不足,可能是token已经超时")
|
|
54
|
+
//console.log('权限不足或登录超时',options);
|
|
55
|
+
window.location.hash = "/login";
|
|
56
|
+
} else if (res.status === 404 || res.status === 504) {
|
|
57
|
+
message.info("服务资源未找到("+res.status+")")
|
|
58
|
+
} else if (res.status === 500) {
|
|
59
|
+
message.info("后台处理错误("+res.status+")")
|
|
60
|
+
} else {
|
|
61
|
+
message.error("服务资源请求失败!")
|
|
62
|
+
reject(res.body)
|
|
43
63
|
}
|
|
44
|
-
resolve(result)
|
|
45
|
-
} if(res.status===201){
|
|
46
|
-
Units.setLocalStorge("hydrocarbonToken",hydrocarbonToken)
|
|
47
|
-
resolve(res)
|
|
48
|
-
}
|
|
49
|
-
else if(res.status===403){
|
|
50
|
-
//message.info("请求权限不足,可能是token已经超时")
|
|
51
|
-
//console.log('权限不足或登录超时',options);
|
|
52
|
-
window.location.hash="/login";
|
|
53
|
-
}else if(res.status===404||res.status===504){
|
|
54
|
-
message.info("服务器连接失败!")
|
|
55
|
-
}else if(res.status===500){
|
|
56
|
-
message.info("后台处理错误。")
|
|
57
|
-
}else{
|
|
58
|
-
reject(res.body)
|
|
59
64
|
}
|
|
60
|
-
})
|
|
65
|
+
})
|
|
61
66
|
})
|
|
62
67
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
|
|
69
|
+
static get(options) {
|
|
70
|
+
let server = options.hydrocarbonServer ? options.hydrocarbonServer : Units.api();
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
|
|
66
73
|
superagent
|
|
67
|
-
.get(Units.joinPath(server,options.url))
|
|
68
|
-
.query(options.query||'')
|
|
69
|
-
.end((req,res)=>{
|
|
70
|
-
if(res
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
.get(Units.joinPath(server, options.url))
|
|
75
|
+
.query(options.query || '')
|
|
76
|
+
.end((req, res) => {
|
|
77
|
+
if (!res) {
|
|
78
|
+
message.error("服务器连接失败")
|
|
79
|
+
reject(res.body);
|
|
80
|
+
} else {
|
|
81
|
+
if (res.status === 200) {
|
|
82
|
+
resolve(res.body)
|
|
83
|
+
} else if (res.status === 403) {
|
|
84
|
+
//message.info("请求权限不足,可能是token已经超时")
|
|
85
|
+
window.location.hash = "#/login";
|
|
86
|
+
} else if (res.status === 404 || res.status === 504) {
|
|
87
|
+
message.info("服务资源未找到("+res.status+")")
|
|
88
|
+
} else if (res.status === 500) {
|
|
89
|
+
message.info("后台处理错误("+res.status+")")
|
|
90
|
+
} else {
|
|
91
|
+
message.error("服务资源请求失败!");
|
|
92
|
+
reject(res.body)
|
|
93
|
+
}
|
|
81
94
|
}
|
|
82
|
-
})
|
|
95
|
+
})
|
|
83
96
|
})
|
|
84
97
|
}
|
|
85
|
-
|
|
98
|
+
|
|
99
|
+
static getHeaderObj() {
|
|
86
100
|
return {
|
|
87
|
-
'hydrocarbon-token':Units.getLocalStorge("hydrocarbonToken"),
|
|
88
|
-
'program-token':Units.getLocalStorge("hydrocarbonToken")
|
|
101
|
+
'hydrocarbon-token': Units.getLocalStorge("hydrocarbonToken"),
|
|
102
|
+
'program-token': Units.getLocalStorge("hydrocarbonToken")
|
|
89
103
|
}
|
|
90
104
|
|
|
91
105
|
}
|
|
92
106
|
|
|
93
107
|
|
|
94
|
-
|
|
95
|
-
|
|
96
108
|
}
|