@ibiz-template/core 0.0.1-alpha.1 → 0.0.1-alpha.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.
- package/out/context/index.js +3 -3
- package/out/environment/environment.d.ts.map +1 -1
- package/out/environment/environment.js +5 -1
- package/out/ibizsys.d.ts +0 -7
- package/out/ibizsys.d.ts.map +1 -1
- package/out/ibizsys.js +1 -9
- package/out/index.d.ts +0 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -1
- package/out/install.d.ts.map +1 -1
- package/out/install.js +3 -2
- package/out/interface/i-environment/i-environment.d.ts +40 -1
- package/out/interface/i-environment/i-environment.d.ts.map +1 -1
- package/out/utils/index.d.ts +5 -2
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +4 -1
- package/out/utils/namespace/namespace.d.ts +148 -0
- package/out/utils/namespace/namespace.d.ts.map +1 -0
- package/out/utils/namespace/namespace.js +216 -0
- package/out/utils/net/http-response.d.ts +94 -0
- package/out/utils/net/http-response.d.ts.map +1 -0
- package/out/utils/net/http-response.js +53 -0
- package/out/utils/net/net.d.ts +16 -34
- package/out/utils/net/net.d.ts.map +1 -1
- package/out/utils/net/net.js +17 -14
- package/out/utils/plural/plural.d.ts +21 -0
- package/out/utils/plural/plural.d.ts.map +1 -0
- package/out/utils/plural/plural.js +25 -0
- package/package.json +13 -9
- package/src/context/index.ts +3 -3
- package/src/environment/environment.ts +5 -1
- package/src/ibizsys.ts +1 -10
- package/src/index.ts +0 -2
- package/src/install.ts +3 -2
- package/src/interface/i-environment/i-environment.ts +45 -2
- package/src/utils/index.ts +5 -2
- package/src/utils/namespace/namespace.ts +244 -0
- package/src/utils/net/http-response.ts +113 -0
- package/src/utils/net/net.ts +26 -41
- package/src/utils/plural/plural.ts +27 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本地请求仿造响应
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2022-08-21 17:08:00
|
|
6
|
+
* @export
|
|
7
|
+
* @class HttpResponse
|
|
8
|
+
* @implements {IHttpResponse<T>}
|
|
9
|
+
* @template T
|
|
10
|
+
*/
|
|
11
|
+
export class HttpResponse {
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of HttpResponse.
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2022-08-18 15:08:11
|
|
17
|
+
* @param {unknown} [data] 返回的数据
|
|
18
|
+
* @param {number} [status] 状态码 (默认为 200)
|
|
19
|
+
* @param {string} [statusText] 状态描述 (默认为空字符)
|
|
20
|
+
*/
|
|
21
|
+
constructor(data, status, statusText) {
|
|
22
|
+
/**
|
|
23
|
+
* 本地仿造响应
|
|
24
|
+
*
|
|
25
|
+
* @author chitanda
|
|
26
|
+
* @date 2022-08-18 15:08:06
|
|
27
|
+
*/
|
|
28
|
+
this.local = true;
|
|
29
|
+
this.ok = false;
|
|
30
|
+
/**
|
|
31
|
+
* header 本地仿造时值为空
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2022-08-18 15:08:46
|
|
35
|
+
* @type {AxiosResponseHeaders}
|
|
36
|
+
*/
|
|
37
|
+
this.headers = {};
|
|
38
|
+
/**
|
|
39
|
+
* AxiosResponse 本地仿造时值为空
|
|
40
|
+
*
|
|
41
|
+
* @author chitanda
|
|
42
|
+
* @date 2022-08-18 15:08:22
|
|
43
|
+
* @type {AxiosRequestConfig<IData>}
|
|
44
|
+
*/
|
|
45
|
+
this.config = {};
|
|
46
|
+
this.data = data;
|
|
47
|
+
this.status = status || 200;
|
|
48
|
+
this.statusText = statusText || '';
|
|
49
|
+
if (this.status >= 200 && this.status < 300) {
|
|
50
|
+
this.ok = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
package/out/utils/net/net.d.ts
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import { AxiosRequestHeaders
|
|
2
|
-
|
|
3
|
-
* 返回值扩展
|
|
4
|
-
*
|
|
5
|
-
* @author chitanda
|
|
6
|
-
* @date 2022-07-14 16:07:50
|
|
7
|
-
* @export
|
|
8
|
-
* @interface NetResponse
|
|
9
|
-
* @extends {AxiosResponse}
|
|
10
|
-
*/
|
|
11
|
-
export interface NetResponse extends AxiosResponse {
|
|
12
|
-
/**
|
|
13
|
-
* 是否请求成功
|
|
14
|
-
*
|
|
15
|
-
* @description 当状态码为 200-299 时认为成功
|
|
16
|
-
* @author chitanda
|
|
17
|
-
* @date 2022-07-14 16:07:59
|
|
18
|
-
* @type {boolean}
|
|
19
|
-
*/
|
|
20
|
-
ok: boolean;
|
|
21
|
-
}
|
|
1
|
+
import { AxiosRequestHeaders } from 'axios';
|
|
2
|
+
import { IHttpResponse } from './http-response';
|
|
22
3
|
/**
|
|
23
4
|
* 全局请求工具类
|
|
24
5
|
*
|
|
@@ -36,7 +17,8 @@ export declare class Net {
|
|
|
36
17
|
* @protected
|
|
37
18
|
* @type {string}
|
|
38
19
|
*/
|
|
39
|
-
protected
|
|
20
|
+
protected _prefix: string;
|
|
21
|
+
get prefix(): string;
|
|
40
22
|
/**
|
|
41
23
|
* Creates an instance of Net.
|
|
42
24
|
*
|
|
@@ -52,9 +34,9 @@ export declare class Net {
|
|
|
52
34
|
* @date 2022-07-14 15:07:01
|
|
53
35
|
* @param {string} url
|
|
54
36
|
* @param {IParams} [params={}]
|
|
55
|
-
* @return {*} {Promise<
|
|
37
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
56
38
|
*/
|
|
57
|
-
post(url: string, data: IData, params?: IParams, headers?: AxiosRequestHeaders): Promise<
|
|
39
|
+
post(url: string, data: IData, params?: IParams, headers?: AxiosRequestHeaders): Promise<IHttpResponse>;
|
|
58
40
|
/**
|
|
59
41
|
* Get 请求
|
|
60
42
|
*
|
|
@@ -62,9 +44,9 @@ export declare class Net {
|
|
|
62
44
|
* @date 2022-07-14 15:07:08
|
|
63
45
|
* @param {string} url
|
|
64
46
|
* @param {IParams} [params={}]
|
|
65
|
-
* @return {*} {Promise<
|
|
47
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
66
48
|
*/
|
|
67
|
-
get(url: string, params?: IParams, headers?: AxiosRequestHeaders): Promise<
|
|
49
|
+
get(url: string, params?: IParams, headers?: AxiosRequestHeaders, option?: IParams): Promise<IHttpResponse>;
|
|
68
50
|
/**
|
|
69
51
|
* Delete 请求
|
|
70
52
|
*
|
|
@@ -72,19 +54,19 @@ export declare class Net {
|
|
|
72
54
|
* @date 2022-07-14 15:07:43
|
|
73
55
|
* @param {string} url
|
|
74
56
|
* @param {IParams} [params]
|
|
75
|
-
* @return {*} {Promise<
|
|
57
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
76
58
|
*/
|
|
77
|
-
delete(url: string, params?: IParams, headers?: AxiosRequestHeaders): Promise<
|
|
59
|
+
delete(url: string, params?: IParams, headers?: AxiosRequestHeaders): Promise<IHttpResponse>;
|
|
78
60
|
/**
|
|
79
61
|
* Put 请求
|
|
80
62
|
*
|
|
81
63
|
* @author chitanda
|
|
82
64
|
* @date 2022-07-14 15:07:49
|
|
83
65
|
* @param {string} url
|
|
84
|
-
* @param {
|
|
85
|
-
* @return {*} {Promise<
|
|
66
|
+
* @param {IData} data
|
|
67
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
86
68
|
*/
|
|
87
|
-
put(url: string,
|
|
69
|
+
put(url: string, data: IData, headers?: AxiosRequestHeaders): Promise<IHttpResponse>;
|
|
88
70
|
/**
|
|
89
71
|
* 获取模型数据
|
|
90
72
|
*
|
|
@@ -92,9 +74,9 @@ export declare class Net {
|
|
|
92
74
|
* @date 2022-07-14 15:07:15
|
|
93
75
|
* @param {string} url
|
|
94
76
|
* @param {AxiosRequestHeaders} [headers={}]
|
|
95
|
-
* @return {*} {Promise<
|
|
77
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
96
78
|
*/
|
|
97
|
-
getModel(url: string, headers?: AxiosRequestHeaders): Promise<
|
|
79
|
+
getModel(url: string, headers?: AxiosRequestHeaders): Promise<IHttpResponse>;
|
|
98
80
|
/**
|
|
99
81
|
* 统一处理请求返回
|
|
100
82
|
*
|
|
@@ -102,7 +84,7 @@ export declare class Net {
|
|
|
102
84
|
* @date 2022-07-14 16:07:23
|
|
103
85
|
* @private
|
|
104
86
|
* @param {AxiosResponse} response
|
|
105
|
-
* @return {*} {
|
|
87
|
+
* @return {*} {IHttpResponse}
|
|
106
88
|
*/
|
|
107
89
|
private doResponseResult;
|
|
108
90
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../../src/utils/net/net.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../../src/utils/net/net.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,mBAAmB,EAAiB,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,GAAG;IACd;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,CAAM;IAE/B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;gBACS,MAAM,CAAC,EAAE,MAAM;IAM3B;;;;;;;;OAQG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC;IAezB;;;;;;;;OAQG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,mBAAwB,EACjC,MAAM,GAAE,OAAY,GACnB,OAAO,CAAC,aAAa,CAAC;IAUzB;;;;;;;;OAQG;IACG,MAAM,CACV,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC;IAMzB;;;;;;;;OAQG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,KAAK,EACX,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC;IAMzB;;;;;;;;OAQG;IACG,QAAQ,CACZ,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC;IAOzB;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAiBtB;;;;;;;;OAQG;IACH,OAAO,CAAC,SAAS;CAGlB"}
|
package/out/utils/net/net.js
CHANGED
|
@@ -26,11 +26,14 @@ export class Net {
|
|
|
26
26
|
* @protected
|
|
27
27
|
* @type {string}
|
|
28
28
|
*/
|
|
29
|
-
this.
|
|
29
|
+
this._prefix = '';
|
|
30
30
|
if (prefix) {
|
|
31
|
-
this.
|
|
31
|
+
this._prefix = prefix;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
get prefix() {
|
|
35
|
+
return this._prefix || ibiz.env.baseUrl;
|
|
36
|
+
}
|
|
34
37
|
/**
|
|
35
38
|
* Post 请求
|
|
36
39
|
*
|
|
@@ -38,7 +41,7 @@ export class Net {
|
|
|
38
41
|
* @date 2022-07-14 15:07:01
|
|
39
42
|
* @param {string} url
|
|
40
43
|
* @param {IParams} [params={}]
|
|
41
|
-
* @return {*} {Promise<
|
|
44
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
42
45
|
*/
|
|
43
46
|
async post(url, data, params = {}, headers = {}) {
|
|
44
47
|
url = this.handleAppPresetParam(url, params);
|
|
@@ -57,15 +60,15 @@ export class Net {
|
|
|
57
60
|
* @date 2022-07-14 15:07:08
|
|
58
61
|
* @param {string} url
|
|
59
62
|
* @param {IParams} [params={}]
|
|
60
|
-
* @return {*} {Promise<
|
|
63
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
61
64
|
*/
|
|
62
|
-
async get(url, params = {}, headers = {}) {
|
|
65
|
+
async get(url, params = {}, headers = {}, option = {}) {
|
|
63
66
|
// if (params.srfparentdata) {
|
|
64
67
|
// Object.assign(params, params.srfparentdata);
|
|
65
68
|
// delete params.srfparentdata;
|
|
66
69
|
// }
|
|
67
70
|
url = this.attachUrlParam(url, params);
|
|
68
|
-
const response = await axios.get(url, { headers });
|
|
71
|
+
const response = await axios.get(url, Object.assign({ headers }, option));
|
|
69
72
|
return this.doResponseResult(response);
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
@@ -75,7 +78,7 @@ export class Net {
|
|
|
75
78
|
* @date 2022-07-14 15:07:43
|
|
76
79
|
* @param {string} url
|
|
77
80
|
* @param {IParams} [params]
|
|
78
|
-
* @return {*} {Promise<
|
|
81
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
79
82
|
*/
|
|
80
83
|
async delete(url, params, headers = {}) {
|
|
81
84
|
url = this.handleAppPresetParam(url, params);
|
|
@@ -88,12 +91,12 @@ export class Net {
|
|
|
88
91
|
* @author chitanda
|
|
89
92
|
* @date 2022-07-14 15:07:49
|
|
90
93
|
* @param {string} url
|
|
91
|
-
* @param {
|
|
92
|
-
* @return {*} {Promise<
|
|
94
|
+
* @param {IData} data
|
|
95
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
93
96
|
*/
|
|
94
|
-
async put(url,
|
|
95
|
-
url = this.handleAppPresetParam(url,
|
|
96
|
-
const response = await axios.put(url,
|
|
97
|
+
async put(url, data, headers = {}) {
|
|
98
|
+
url = this.handleAppPresetParam(url, data);
|
|
99
|
+
const response = await axios.put(url, data, { headers });
|
|
97
100
|
return this.doResponseResult(response);
|
|
98
101
|
}
|
|
99
102
|
/**
|
|
@@ -103,7 +106,7 @@ export class Net {
|
|
|
103
106
|
* @date 2022-07-14 15:07:15
|
|
104
107
|
* @param {string} url
|
|
105
108
|
* @param {AxiosRequestHeaders} [headers={}]
|
|
106
|
-
* @return {*} {Promise<
|
|
109
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
107
110
|
*/
|
|
108
111
|
async getModel(url, headers = {}) {
|
|
109
112
|
const response = await axios.get(url, {
|
|
@@ -118,7 +121,7 @@ export class Net {
|
|
|
118
121
|
* @date 2022-07-14 16:07:23
|
|
119
122
|
* @private
|
|
120
123
|
* @param {AxiosResponse} response
|
|
121
|
-
* @return {*} {
|
|
124
|
+
* @return {*} {IHttpResponse}
|
|
122
125
|
*/
|
|
123
126
|
doResponseResult(response) {
|
|
124
127
|
const res = response;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 英文转复数写法
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2022-08-25 18:08:41
|
|
6
|
+
* @export
|
|
7
|
+
* @param {string} key
|
|
8
|
+
* @return {*} {string}
|
|
9
|
+
*/
|
|
10
|
+
export declare function plural(key: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* 英文转复数写法并转全小写
|
|
13
|
+
*
|
|
14
|
+
* @author chitanda
|
|
15
|
+
* @date 2022-08-25 18:08:23
|
|
16
|
+
* @export
|
|
17
|
+
* @param {string} key
|
|
18
|
+
* @return {*} {string}
|
|
19
|
+
*/
|
|
20
|
+
export declare function pluralLower(key: string): string;
|
|
21
|
+
//# sourceMappingURL=plural.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plural.d.ts","sourceRoot":"","sources":["../../../src/utils/plural/plural.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as pluralize from 'pluralize';
|
|
2
|
+
/**
|
|
3
|
+
* 英文转复数写法
|
|
4
|
+
*
|
|
5
|
+
* @author chitanda
|
|
6
|
+
* @date 2022-08-25 18:08:41
|
|
7
|
+
* @export
|
|
8
|
+
* @param {string} key
|
|
9
|
+
* @return {*} {string}
|
|
10
|
+
*/
|
|
11
|
+
export function plural(key) {
|
|
12
|
+
return pluralize(key);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 英文转复数写法并转全小写
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2022-08-25 18:08:23
|
|
19
|
+
* @export
|
|
20
|
+
* @param {string} key
|
|
21
|
+
* @return {*} {string}
|
|
22
|
+
*/
|
|
23
|
+
export function pluralLower(key) {
|
|
24
|
+
return plural(key).toLowerCase();
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/core",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.2",
|
|
4
4
|
"description": "核心包",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -11,23 +11,27 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "tsc --watch",
|
|
13
13
|
"build": "npm run lint && npm run clean && tsc --build",
|
|
14
|
-
"lint": "eslint src/**/*.ts",
|
|
15
|
-
"lint:fix": "eslint --fix src/**/*.ts",
|
|
14
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
15
|
+
"lint:fix": "eslint --fix 'src/**/*.ts'",
|
|
16
16
|
"clean": "rimraf out",
|
|
17
|
+
"test": "jest",
|
|
17
18
|
"publish:next": "npm run build && npm publish --access public --tag next",
|
|
18
19
|
"publish:npm": "npm run build && npm publish --access public"
|
|
19
20
|
},
|
|
20
21
|
"author": "chitanda",
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@ibiz-template/command": "^0.0.1-alpha.1",
|
|
24
|
-
"@ibiz-template/model": "^0.0.1-alpha.1",
|
|
25
24
|
"axios": "^0.27.2",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"pluralize": "^8.0.0",
|
|
26
|
+
"qs": "^6.11.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@types/
|
|
29
|
+
"@types/pluralize": "^0.0.29",
|
|
30
|
+
"@types/qs": "^6.9.7",
|
|
31
|
+
"qx-util": "^0.4.0"
|
|
31
32
|
},
|
|
32
|
-
"
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"qx-util": "^0.4.0"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "03023d73d45b9dc3b6156e996c196ce6705d31cd"
|
|
33
37
|
}
|
package/src/context/index.ts
CHANGED
|
@@ -17,14 +17,14 @@ export class IBizContextProxyHandle implements ProxyHandler<IBizContext> {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
get(target: IBizContext, p: string | symbol, _receiver: unknown): unknown {
|
|
20
|
-
if (target[p]) {
|
|
20
|
+
if (target[p] !== undefined) {
|
|
21
21
|
return target[p];
|
|
22
22
|
}
|
|
23
|
-
if (target.context[p]) {
|
|
23
|
+
if (target.context[p] !== undefined) {
|
|
24
24
|
return target.context[p];
|
|
25
25
|
}
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
if ((target as any)._parent) {
|
|
27
|
+
if ((target as any)._parent && (target as any)._parent[p] !== undefined) {
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
return (target as any)._parent[p];
|
|
30
30
|
}
|
|
@@ -4,5 +4,9 @@ import { IEnvironment } from '../interface';
|
|
|
4
4
|
* 环境变量
|
|
5
5
|
*/
|
|
6
6
|
export const Environment: IEnvironment = {
|
|
7
|
-
baseUrl: '
|
|
7
|
+
baseUrl: '',
|
|
8
|
+
assetsUrl: '/assets/',
|
|
9
|
+
dcSystem: '',
|
|
10
|
+
ExportFile: '/ibizutil/download',
|
|
11
|
+
UploadFile: '/ibizutil/upload',
|
|
8
12
|
};
|
package/src/ibizsys.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { commands } from '@ibiz-template/command';
|
|
2
1
|
import { Environment } from './environment/environment';
|
|
3
2
|
import { OrgData } from './interface';
|
|
4
3
|
import { Net } from './utils';
|
|
@@ -20,14 +19,6 @@ export class IBizSys {
|
|
|
20
19
|
*/
|
|
21
20
|
env = Environment;
|
|
22
21
|
|
|
23
|
-
/**
|
|
24
|
-
* 指令控制器
|
|
25
|
-
*
|
|
26
|
-
* @author chitanda
|
|
27
|
-
* @date 2022-07-21 17:07:45
|
|
28
|
-
*/
|
|
29
|
-
commands = commands;
|
|
30
|
-
|
|
31
22
|
/**
|
|
32
23
|
* 网络请求工具类
|
|
33
24
|
*
|
|
@@ -35,7 +26,7 @@ export class IBizSys {
|
|
|
35
26
|
* @date 2022-07-19 17:07:56
|
|
36
27
|
* @type {Net}
|
|
37
28
|
*/
|
|
38
|
-
net: Net = new Net(
|
|
29
|
+
net: Net = new Net();
|
|
39
30
|
|
|
40
31
|
/**
|
|
41
32
|
* sass 模式下的中心系统标识
|
package/src/index.ts
CHANGED
package/src/install.ts
CHANGED
|
@@ -9,8 +9,9 @@ import { Interceptor } from './utils';
|
|
|
9
9
|
* @export
|
|
10
10
|
*/
|
|
11
11
|
export function install(): void {
|
|
12
|
-
if (
|
|
13
|
-
|
|
12
|
+
if (window.ibiz) {
|
|
13
|
+
throw new Error('ibiz 已经存在, 无需重复安装');
|
|
14
14
|
}
|
|
15
|
+
window.ibiz = new IBizSys();
|
|
15
16
|
new Interceptor();
|
|
16
17
|
}
|
|
@@ -7,8 +7,15 @@
|
|
|
7
7
|
* @interface IEnvironment
|
|
8
8
|
*/
|
|
9
9
|
export interface IEnvironment {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* 命名空间
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2022-09-06 11:09:32
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
namespace?: string;
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* 请求根路径
|
|
14
21
|
*
|
|
@@ -17,4 +24,40 @@ export interface IEnvironment {
|
|
|
17
24
|
* @type {string}
|
|
18
25
|
*/
|
|
19
26
|
baseUrl: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 资源文件根路径
|
|
30
|
+
*
|
|
31
|
+
* @author lxm
|
|
32
|
+
* @date 2022-08-25 14:08:08
|
|
33
|
+
* @type {string}
|
|
34
|
+
*/
|
|
35
|
+
assetsUrl: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 中心系统标识
|
|
39
|
+
*
|
|
40
|
+
* @author chitanda
|
|
41
|
+
* @date 2022-08-22 23:08:46
|
|
42
|
+
* @type {string}
|
|
43
|
+
*/
|
|
44
|
+
dcSystem: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 文件导出
|
|
48
|
+
*
|
|
49
|
+
* @author chitanda
|
|
50
|
+
* @date 2022-08-22 23:08:46
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
ExportFile: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 文件上传
|
|
57
|
+
*
|
|
58
|
+
* @author chitanda
|
|
59
|
+
* @date 2022-08-22 23:08:46
|
|
60
|
+
* @type {string}
|
|
61
|
+
*/
|
|
62
|
+
UploadFile: string;
|
|
20
63
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { Interceptor } from './interceptor/interceptor';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { Namespace } from './namespace/namespace';
|
|
3
|
+
export { IHttpResponse, HttpResponse } from './net/http-response';
|
|
4
|
+
export { Net } from './net/net';
|
|
5
|
+
export { plural, pluralLower } from './plural/plural';
|
|
6
|
+
export * from './util/util';
|