web-core-tcm 0.0.23 → 0.0.25
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 +38 -21
- package/quasar.config.ts +28 -15
- package/src/api/algorithm/comprehensiveAlgorithm.ts +1 -1
- package/src/api/algorithm/index.ts +7 -7
- package/src/api/algorithm/inquiriesAlgorithm.ts +4 -7
- package/src/api/algorithm/inspectionsAlgorithm.ts +1 -1
- package/src/api/algorithm/lisemsAlgorithm.ts +3 -3
- package/src/api/algorithm/pulsationsAlgorithm.ts +2 -3
- package/src/api/authorization/alova/apiDefinitions.ts +2 -2
- package/src/api/authorization/alova/createApis.ts +22 -7
- package/src/api/authorization/alova/globals.d.ts +35 -14
- package/src/api/authorization/alova/implement/authorization.ts +11 -9
- package/src/api/authorization/alova/implement/index.ts +1 -1
- package/src/api/authorization/alova/index.ts +4 -5
- package/src/api/authorization/authorization.ts +6 -6
- package/src/api/authorization/index.ts +1 -1
- package/src/api/check/alova/apiDefinitions.ts +2 -2
- package/src/api/check/alova/createApis.ts +22 -7
- package/src/api/check/alova/globals.d.ts +29 -20
- package/src/api/check/alova/implement/check.ts +145 -99
- package/src/api/check/alova/implement/index.ts +1 -1
- package/src/api/check/alova/index.ts +4 -5
- package/src/api/check/check.ts +116 -63
- package/src/api/check/index.ts +1 -1
- package/src/api/config/alova/index.ts +26 -27
- package/src/api/config/index.ts +59 -57
- package/src/api/doctor/alova/apiDefinitions.ts +2 -2
- package/src/api/doctor/alova/createApis.ts +22 -7
- package/src/api/doctor/alova/globals.d.ts +27 -18
- package/src/api/doctor/alova/implement/doctor.ts +38 -24
- package/src/api/doctor/alova/implement/index.ts +1 -1
- package/src/api/doctor/alova/index.ts +4 -4
- package/src/api/doctor/doctor.ts +18 -18
- package/src/api/doctor/index.ts +1 -1
- package/src/api/index.ts +12 -15
- package/src/api/metric/implement/index.ts +1 -1
- package/src/api/metric/implement/metric.ts +44 -34
- package/src/api/metric/index.ts +1 -1
- package/src/api/metric/metric.ts +36 -36
- package/src/api/oauth/alova/apiDefinitions.ts +2 -2
- package/src/api/oauth/alova/createApis.ts +22 -7
- package/src/api/oauth/alova/globals.d.ts +25 -16
- package/src/api/oauth/alova/implement/index.ts +1 -1
- package/src/api/oauth/alova/implement/oauth.ts +20 -15
- package/src/api/oauth/alova/index.ts +4 -5
- package/src/api/oauth/index.ts +1 -1
- package/src/api/oauth/oauth.ts +9 -5
- package/src/api/outpatient/alova/apiDefinitions.ts +2 -2
- package/src/api/outpatient/alova/createApis.ts +22 -7
- package/src/api/outpatient/alova/globals.d.ts +25 -16
- package/src/api/outpatient/alova/implement/index.ts +1 -1
- package/src/api/outpatient/alova/implement/outpatient.ts +76 -51
- package/src/api/outpatient/alova/index.ts +4 -5
- package/src/api/outpatient/index.ts +1 -1
- package/src/api/outpatient/outpatient.ts +29 -24
- package/src/api/patient/alova/apiDefinitions.ts +2 -2
- package/src/api/patient/alova/createApis.ts +22 -7
- package/src/api/patient/alova/globals.d.ts +56 -43
- package/src/api/patient/alova/implement/index.ts +1 -1
- package/src/api/patient/alova/implement/meta.ts +253 -224
- package/src/api/patient/alova/implement/patient.ts +79 -57
- package/src/api/patient/alova/index.ts +3 -5
- package/src/api/patient/core.ts +51 -49
- package/src/api/patient/index.ts +1 -1
- package/src/api/patient/meta.ts +244 -140
- package/src/api/patient/patient.ts +25 -25
- package/src/api/prescription/alova/apiDefinitions.ts +2 -2
- package/src/api/prescription/alova/createApis.ts +22 -7
- package/src/api/prescription/alova/globals.d.ts +32 -23
- package/src/api/prescription/alova/implement/herbal.ts +59 -39
- package/src/api/prescription/alova/implement/index.ts +1 -1
- package/src/api/prescription/alova/implement/prescription.ts +50 -33
- package/src/api/prescription/alova/index.ts +4 -5
- package/src/api/prescription/herbal.ts +17 -10
- package/src/api/prescription/index.ts +1 -1
- package/src/api/prescription/prescription.ts +35 -27
- package/src/api/scientist/alova/apiDefinitions.ts +2 -2
- package/src/api/scientist/alova/createApis.ts +22 -7
- package/src/api/scientist/alova/globals.d.ts +25 -16
- package/src/api/scientist/alova/implement/index.ts +1 -1
- package/src/api/scientist/alova/implement/scientist.ts +31 -20
- package/src/api/scientist/alova/index.ts +5 -4
- package/src/api/scientist/index.ts +1 -1
- package/src/api/scientist/scientist.ts +20 -20
- package/src/index.ts +3 -4
- package/src/layouts/UserLayout.vue +9 -7
- package/src/pages/LoginPage.vue +2 -5
- package/src/proto/types/Images_pb.ts +13 -13
- package/src/proto/types/WaveMap_pb.ts +13 -13
- package/src/router/routes.ts +2 -2
- package/src/util/export.ts +4 -4
- package/src/util/helper.ts +6 -6
- package/src/util/image.ts +1 -1
- package/src/util/number.ts +4 -4
- package/src/util/s256.js +1 -4
- package/src/util/secret.ts +1 -1
- package/src/util/string.ts +18 -18
- package/tsconfig.json +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-core-tcm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "Core",
|
|
5
5
|
"productName": "Core",
|
|
6
6
|
"author": "wywywywywywywywywy <qa123456_0714@qq.com>",
|
|
@@ -11,21 +11,18 @@
|
|
|
11
11
|
"test": "echo \"No test specified\" && exit 0",
|
|
12
12
|
"dev": "quasar dev",
|
|
13
13
|
"build": "quasar build",
|
|
14
|
-
"postinstall": "quasar prepare"
|
|
14
|
+
"postinstall": "quasar prepare",
|
|
15
|
+
"lint:fix": "eslint --fix"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
|
-
"@quasar/extras": "^1.16.4",
|
|
18
|
-
"quasar": "^2.16.0",
|
|
19
|
-
"vue": "^3.5.22",
|
|
20
|
-
"vue-router": "^4.0.12",
|
|
21
|
-
"@bufbuild/protobuf": "^2.9.0",
|
|
22
|
-
"@bufbuild/protoc-gen-es": "^2.9.0",
|
|
23
18
|
"@alova/adapter-axios": "^1.2.6",
|
|
24
19
|
"@alova/mock": "^1.5.1",
|
|
25
20
|
"@alova/scene-vue": "^1.6.2",
|
|
21
|
+
"@bufbuild/protobuf": "^2.9.0",
|
|
22
|
+
"@bufbuild/protoc-gen-es": "^2.9.0",
|
|
23
|
+
"@quasar/extras": "^1.16.4",
|
|
26
24
|
"@vueuse/core": "^11.0.3",
|
|
27
25
|
"alova": "^3.3.4",
|
|
28
|
-
"pinyin": "^4.0.0",
|
|
29
26
|
"builder-pattern": "^2.2.0",
|
|
30
27
|
"compressorjs": "^1.2.1",
|
|
31
28
|
"dotenv-cli": "^7.4.2",
|
|
@@ -33,33 +30,53 @@
|
|
|
33
30
|
"ftdi-d2xx": "^1.3.1",
|
|
34
31
|
"jwt-decode": "^4.0.0",
|
|
35
32
|
"papaparse": "^5.5.3",
|
|
36
|
-
"
|
|
33
|
+
"pinyin": "^4.0.0",
|
|
34
|
+
"punycode": "^2.3.1",
|
|
35
|
+
"quasar": "^2.16.0",
|
|
36
|
+
"vite-plugin-dts": "^4.5.4",
|
|
37
|
+
"vue": "^3.5.22",
|
|
38
|
+
"vue-router": "^4.0.12"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@alova/wormhole": "^1.2.0",
|
|
40
42
|
"@eslint/js": "^9.14.0",
|
|
43
|
+
"@quasar/app-vite": "^2.1.0",
|
|
44
|
+
"@types/node": "^20.5.9",
|
|
45
|
+
"@vue/eslint-config-prettier": "^10.1.0",
|
|
46
|
+
"@vue/eslint-config-typescript": "^14.4.0",
|
|
47
|
+
"autoprefixer": "^10.4.2",
|
|
41
48
|
"eslint": "^9.14.0",
|
|
42
49
|
"eslint-plugin-vue": "^10.4.0",
|
|
43
50
|
"globals": "^16.4.0",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
51
|
+
"prettier": "^3.3.3",
|
|
52
|
+
"tsc-alias": "^1.8.16",
|
|
53
|
+
"typescript": "^5.9.2",
|
|
46
54
|
"vite-plugin-checker": "^0.11.0",
|
|
47
55
|
"vue-eslint-parser": "^10.2.0",
|
|
48
|
-
"
|
|
49
|
-
"prettier": "^3.3.3",
|
|
50
|
-
"@types/node": "^20.5.9",
|
|
51
|
-
"@quasar/app-vite": "^2.1.0",
|
|
52
|
-
"autoprefixer": "^10.4.2",
|
|
53
|
-
"typescript": "^5.9.2"
|
|
56
|
+
"vue-tsc": "^3.0.7"
|
|
54
57
|
},
|
|
55
58
|
"engines": {
|
|
56
59
|
"node": "^28 || ^26 || ^24 || ^22 || ^20",
|
|
57
60
|
"npm": ">= 6.13.4",
|
|
58
61
|
"yarn": ">= 1.21.1"
|
|
59
62
|
},
|
|
60
|
-
"main": "
|
|
61
|
-
"types": "
|
|
62
|
-
"module": "
|
|
63
|
+
"main": "dist/index.ts",
|
|
64
|
+
"types": "dist/index.ts",
|
|
65
|
+
"module": "dist/index.ts",
|
|
66
|
+
"exports": {
|
|
67
|
+
"./api/algorithm": "./dist/src/api/patient/index.d.ts",
|
|
68
|
+
"./api/authorization": "./dist/api/authorization/index.d.ts",
|
|
69
|
+
"./api/check": "./dist/src/api/check/index.d.ts",
|
|
70
|
+
"./api/config": "./dist/src/api/config/index.d.ts",
|
|
71
|
+
"./api/device": "./dist/src/api/device/index.d.ts",
|
|
72
|
+
"./api/doctor": "./dist/src/api/doctor/index.d.ts",
|
|
73
|
+
"./api/metric": "./dist/src/api/metric/index.d.ts",
|
|
74
|
+
"./api/oauth": "./dist/src/api/oauth/index.d.ts",
|
|
75
|
+
"./api/outpatient": "./dist/src/api/outpatient/index.d.ts",
|
|
76
|
+
"./api/patient": "./dist/src/api/patient/index.d.ts",
|
|
77
|
+
"./api/prescription": "./dist/src/api/prescription/index.d.ts",
|
|
78
|
+
"./api/scientist": "./dist/src/api/scientist/index.d.ts"
|
|
79
|
+
},
|
|
63
80
|
"repository": {
|
|
64
81
|
"type": "git",
|
|
65
82
|
"url": "git+https://github.com/NUC-TCM/web.core.tcm.git"
|
package/quasar.config.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-file
|
|
3
3
|
|
|
4
4
|
import { defineConfig } from '#q-app/wrappers';
|
|
5
|
+
import dts from 'vite-plugin-dts';
|
|
6
|
+
import { resolve } from 'path';
|
|
5
7
|
|
|
6
8
|
export default defineConfig((/* ctx */) => {
|
|
7
9
|
return {
|
|
@@ -37,17 +39,6 @@ export default defineConfig((/* ctx */) => {
|
|
|
37
39
|
node: 'node20',
|
|
38
40
|
},
|
|
39
41
|
|
|
40
|
-
typescript: {
|
|
41
|
-
strict: true,
|
|
42
|
-
vueShim: true,
|
|
43
|
-
extendTsConfig (tsConfig) {
|
|
44
|
-
tsConfig.compilerOptions!.paths['@core'] = [...tsConfig.compilerOptions!.paths['src']]
|
|
45
|
-
tsConfig.compilerOptions!.paths['@core/*'] = [...tsConfig.compilerOptions!.paths['src/*']]
|
|
46
|
-
delete tsConfig.compilerOptions!.paths['src'];
|
|
47
|
-
delete tsConfig.compilerOptions!.paths['src/*'];
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
42
|
vueRouterMode: 'hash', // available values: 'hash', 'history'
|
|
52
43
|
// vueRouterBase,
|
|
53
44
|
// vueDevtools,
|
|
@@ -65,6 +56,24 @@ export default defineConfig((/* ctx */) => {
|
|
|
65
56
|
// distDir
|
|
66
57
|
// viteVuePluginOptions: {},
|
|
67
58
|
|
|
59
|
+
extendViteConf(config) {
|
|
60
|
+
config.build = {
|
|
61
|
+
outDir: 'dist',
|
|
62
|
+
lib: {
|
|
63
|
+
entry: 'src/index.ts',
|
|
64
|
+
formats: ['es'],
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
rollupOptions: {
|
|
68
|
+
external: [], // 可选:这里写不想被打包进来的依赖
|
|
69
|
+
output: {
|
|
70
|
+
preserveModules: true, // ✅ 保留文件结构
|
|
71
|
+
entryFileNames: '[name].js', // ✅ 输出文件名规则
|
|
72
|
+
dir: 'dist',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
},
|
|
68
77
|
vitePlugins: [
|
|
69
78
|
[
|
|
70
79
|
'vite-plugin-checker',
|
|
@@ -77,9 +86,13 @@ export default defineConfig((/* ctx */) => {
|
|
|
77
86
|
},
|
|
78
87
|
{ server: false },
|
|
79
88
|
],
|
|
89
|
+
dts({
|
|
90
|
+
entryRoot: 'src',
|
|
91
|
+
outDir: 'dist/src',
|
|
92
|
+
tsconfigPath: './tsconfig.json',
|
|
93
|
+
}),
|
|
80
94
|
],
|
|
81
95
|
},
|
|
82
|
-
|
|
83
96
|
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-file#devserver
|
|
84
97
|
devServer: {
|
|
85
98
|
// https: true,
|
|
@@ -110,9 +123,9 @@ export default defineConfig((/* ctx */) => {
|
|
|
110
123
|
|
|
111
124
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-file#sourcefiles
|
|
112
125
|
// sourceFiles: {
|
|
113
|
-
// rootComponent: '
|
|
114
|
-
// router: '
|
|
115
|
-
// store: '
|
|
126
|
+
// rootComponent: 'src/App.vue',
|
|
127
|
+
// router: 'src/router/index',
|
|
128
|
+
// store: 'src/store/index',
|
|
116
129
|
// pwaRegisterServiceWorker: 'src-pwa/register-service-worker',
|
|
117
130
|
// pwaServiceWorker: 'src-pwa/custom-service-worker',
|
|
118
131
|
// pwaManifestFile: 'src-pwa/manifest.json',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/api/comprehensiveAlgorithm.ts
|
|
2
|
-
import { comprehensiveAlgorithmService } from '
|
|
2
|
+
import { comprehensiveAlgorithmService } from 'src/api/algorithm';
|
|
3
3
|
|
|
4
4
|
export const comprehensiveQwenAlgorithm = (data: object) =>
|
|
5
5
|
comprehensiveAlgorithmService.Post<Response>('/千问大模型分析', data, {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createAlova } from 'alova';
|
|
2
2
|
import adapterFetch from 'alova/fetch';
|
|
3
|
-
import { responded } from '
|
|
4
|
-
import { getServiceEndpoint, ServiceType } from '
|
|
3
|
+
import { responded } from 'src/api/config/alova';
|
|
4
|
+
import { getServiceEndpoint, ServiceType } from 'src/api/config';
|
|
5
5
|
|
|
6
6
|
export const inspectionAlgorithmService = createAlova({
|
|
7
7
|
baseURL: getServiceEndpoint(ServiceType.InspectionsAlgorithm),
|
|
8
8
|
timeout: 30000,
|
|
9
9
|
cacheFor: null,
|
|
10
10
|
requestAdapter: adapterFetch(),
|
|
11
|
-
responded: responded
|
|
11
|
+
responded: responded,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export const inquiriesAlgorithmService = createAlova({
|
|
@@ -16,7 +16,7 @@ export const inquiriesAlgorithmService = createAlova({
|
|
|
16
16
|
timeout: 30000,
|
|
17
17
|
cacheFor: null,
|
|
18
18
|
requestAdapter: adapterFetch(),
|
|
19
|
-
responded: responded
|
|
19
|
+
responded: responded,
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
export const lisemsAlgorithmService = createAlova({
|
|
@@ -24,7 +24,7 @@ export const lisemsAlgorithmService = createAlova({
|
|
|
24
24
|
timeout: 30000,
|
|
25
25
|
cacheFor: null,
|
|
26
26
|
requestAdapter: adapterFetch(),
|
|
27
|
-
responded: responded
|
|
27
|
+
responded: responded,
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
export const pulsationsAlgorithmService = createAlova({
|
|
@@ -32,7 +32,7 @@ export const pulsationsAlgorithmService = createAlova({
|
|
|
32
32
|
timeout: 30000,
|
|
33
33
|
cacheFor: null,
|
|
34
34
|
requestAdapter: adapterFetch(),
|
|
35
|
-
responded: responded
|
|
35
|
+
responded: responded,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
export const comprehensiveAlgorithmService = createAlova({
|
|
@@ -40,7 +40,7 @@ export const comprehensiveAlgorithmService = createAlova({
|
|
|
40
40
|
timeout: 30000,
|
|
41
41
|
cacheFor: null,
|
|
42
42
|
requestAdapter: adapterFetch(),
|
|
43
|
-
responded: responded
|
|
43
|
+
responded: responded,
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export * from './comprehensiveAlgorithm';
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { inquiriesAlgorithmService } from '
|
|
1
|
+
import { inquiriesAlgorithmService } from 'src/api/algorithm';
|
|
2
2
|
|
|
3
3
|
export const complaintsRecognition = (symptomDescription: string) =>
|
|
4
|
-
inquiriesAlgorithmService.Post<string[]>(
|
|
5
|
-
'/主诉/识别',
|
|
6
|
-
{ symptomDescription },
|
|
7
|
-
);
|
|
4
|
+
inquiriesAlgorithmService.Post<string[]>('/主诉/识别', { symptomDescription });
|
|
8
5
|
|
|
9
6
|
export const complaintsDialog = (body: object) =>
|
|
10
7
|
inquiriesAlgorithmService.Post<{ reply: string; positive_symptom: string[] }>('/主诉/对话', body);
|
|
11
8
|
|
|
12
9
|
export const complaintsView = (params: string) =>
|
|
13
|
-
inquiriesAlgorithmService.Post<{ symptoms: string[] }>('/主诉/视图', {params});
|
|
10
|
+
inquiriesAlgorithmService.Post<{ symptoms: string[] }>('/主诉/视图', { params });
|
|
14
11
|
|
|
15
12
|
export const complaintsSearch = (data: string) =>
|
|
16
|
-
inquiriesAlgorithmService.Post<string[]>('/主诉/搜索', {data});
|
|
13
|
+
inquiriesAlgorithmService.Post<string[]>('/主诉/搜索', { data });
|
|
17
14
|
|
|
18
15
|
export const complaintsChoose = (body: object) =>
|
|
19
16
|
inquiriesAlgorithmService.Post<{ status: string; data: [] }>('/主诉/选择', body);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { lisemsAlgorithmService } from '
|
|
1
|
+
import { lisemsAlgorithmService } from 'src/api/algorithm';
|
|
2
2
|
|
|
3
3
|
export const analysisLisems = (body: object) =>
|
|
4
|
-
lisemsAlgorithmService.Post<JSON,Response>('/特征参数', body, {
|
|
4
|
+
lisemsAlgorithmService.Post<JSON, Response>('/特征参数', body, {
|
|
5
5
|
transform(data) {
|
|
6
6
|
return data.json() as Promise<JSON>;
|
|
7
7
|
},
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
export const getFrequencyDomainDiagram = (body: number[]) =>
|
|
11
|
-
lisemsAlgorithmService.Post<string,Response>('/频域图', JSON.stringify(body), {
|
|
11
|
+
lisemsAlgorithmService.Post<string, Response>('/频域图', JSON.stringify(body), {
|
|
12
12
|
async transform(res) {
|
|
13
13
|
const blob = await res.blob();
|
|
14
14
|
return URL.createObjectURL(blob);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { pulsationsAlgorithmService } from '
|
|
1
|
+
import { pulsationsAlgorithmService } from 'src/api/algorithm';
|
|
2
2
|
|
|
3
3
|
export const pulsationPreprocessing = (pulsation: object) =>
|
|
4
|
-
pulsationsAlgorithmService.Post<{ [key: string]: number[] }>('/预处理', pulsation, {
|
|
5
|
-
});
|
|
4
|
+
pulsationsAlgorithmService.Post<{ [key: string]: number[] }>('/预处理', pulsation, {});
|
|
6
5
|
export const pulsationAnalysis = (pulsation: object) =>
|
|
7
6
|
pulsationsAlgorithmService.Post<JSON>('/特征参数', pulsation, {
|
|
8
7
|
timeout: 30000,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types='./globals.d.ts' />
|
|
2
2
|
/* tslint:disable */
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* OpenAPI definition - version v0
|
|
6
6
|
*
|
|
@@ -19,5 +19,5 @@ export default {
|
|
|
19
19
|
'oAuthRestful.getToken': ['POST', '/授权/服务/令牌'],
|
|
20
20
|
'resourceAuthorizationRestful.getResourceAuthorizationState': ['GET', '/授权/服务/资源/{id}'],
|
|
21
21
|
'roleAuthorizationRestful.getRoleAuthorizationState': ['GET', '/授权/服务/角色/{role}'],
|
|
22
|
-
'userAuthorizationRestful.getUserAuthorizationState': ['GET', '/授权/服务/用户/{userId}']
|
|
22
|
+
'userAuthorizationRestful.getUserAuthorizationState': ['GET', '/授权/服务/用户/{userId}'],
|
|
23
23
|
};
|
|
@@ -19,7 +19,11 @@ import { Method } from 'alova';
|
|
|
19
19
|
import apiDefinitions from './apiDefinitions';
|
|
20
20
|
|
|
21
21
|
const cache = Object.create(null);
|
|
22
|
-
const createFunctionalProxy = (
|
|
22
|
+
const createFunctionalProxy = (
|
|
23
|
+
array: (string | symbol)[],
|
|
24
|
+
alovaInstance: Alova<AlovaGenerics>,
|
|
25
|
+
configMap: any,
|
|
26
|
+
) => {
|
|
23
27
|
const apiPathKey = array.join('.') as keyof typeof apiDefinitions;
|
|
24
28
|
if (cache[apiPathKey]) {
|
|
25
29
|
return cache[apiPathKey];
|
|
@@ -39,7 +43,7 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
39
43
|
}
|
|
40
44
|
const mergedConfig = {
|
|
41
45
|
...configMap[apiPathKey],
|
|
42
|
-
...config
|
|
46
|
+
...config,
|
|
43
47
|
};
|
|
44
48
|
const [method, url] = apiItem;
|
|
45
49
|
const pathParams = mergedConfig.pathParams;
|
|
@@ -49,7 +53,10 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
49
53
|
});
|
|
50
54
|
delete mergedConfig.pathParams;
|
|
51
55
|
let data = mergedConfig.data;
|
|
52
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
Object.prototype.toString.call(data) === '[object Object]' &&
|
|
58
|
+
typeof FormData !== 'undefined'
|
|
59
|
+
) {
|
|
53
60
|
let hasBlobData = false;
|
|
54
61
|
const formData = new FormData();
|
|
55
62
|
for (const key in data) {
|
|
@@ -60,8 +67,14 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
60
67
|
}
|
|
61
68
|
data = hasBlobData ? formData : data;
|
|
62
69
|
}
|
|
63
|
-
return new Method(
|
|
64
|
-
|
|
70
|
+
return new Method(
|
|
71
|
+
method!.toUpperCase() as MethodType,
|
|
72
|
+
alovaInstance,
|
|
73
|
+
urlReplaced,
|
|
74
|
+
mergedConfig,
|
|
75
|
+
data,
|
|
76
|
+
);
|
|
77
|
+
},
|
|
65
78
|
});
|
|
66
79
|
cache[apiPathKey] = proxy;
|
|
67
80
|
return proxy;
|
|
@@ -71,7 +84,7 @@ export const createApis = (alovaInstance: Alova<AlovaGenerics>, configMap: any)
|
|
|
71
84
|
const Apis = new Proxy({} as authorizeApi, {
|
|
72
85
|
get(_, property) {
|
|
73
86
|
return createFunctionalProxy([property], alovaInstance, configMap);
|
|
74
|
-
}
|
|
87
|
+
},
|
|
75
88
|
});
|
|
76
89
|
return Apis;
|
|
77
90
|
};
|
|
@@ -93,7 +106,9 @@ type APISofParameters<Tag extends string, Url extends string> = Tag extends keyo
|
|
|
93
106
|
: any;
|
|
94
107
|
type MethodsConfigMap = {
|
|
95
108
|
[P in keyof typeof import('./apiDefinitions').default]?: MethodConfig<
|
|
96
|
-
P extends `${infer Tag}.${infer Url}`
|
|
109
|
+
P extends `${infer Tag}.${infer Url}`
|
|
110
|
+
? Parameters<NonNullable<APISofParameters<Tag, Url>[0]>['transform']>[0]
|
|
111
|
+
: any
|
|
97
112
|
>;
|
|
98
113
|
};
|
|
99
114
|
export const withConfigType = <Config extends MethodsConfigMap>(config: Config) => config;
|
|
@@ -36,7 +36,16 @@ type Alova2MethodConfig<Responded> =
|
|
|
36
36
|
>
|
|
37
37
|
? Omit<
|
|
38
38
|
AlovaMethodCreateConfig<
|
|
39
|
-
AlovaGenerics<
|
|
39
|
+
AlovaGenerics<
|
|
40
|
+
Responded,
|
|
41
|
+
any,
|
|
42
|
+
RequestConfig,
|
|
43
|
+
Response,
|
|
44
|
+
ResponseHeader,
|
|
45
|
+
L1Cache,
|
|
46
|
+
L2Cache,
|
|
47
|
+
SE
|
|
48
|
+
>,
|
|
40
49
|
any,
|
|
41
50
|
Responded
|
|
42
51
|
>,
|
|
@@ -47,7 +56,7 @@ type Alova2MethodConfig<Responded> =
|
|
|
47
56
|
// Extract the return type of transform function that define in $$userConfigMap, if it not exists, use the default type.
|
|
48
57
|
type ExtractUserDefinedTransformed<
|
|
49
58
|
DefinitionKey extends keyof typeof apiDefinitions,
|
|
50
|
-
Default
|
|
59
|
+
Default,
|
|
51
60
|
> = DefinitionKey extends keyof UserMethodConfigMap
|
|
52
61
|
? UserMethodConfigMap[DefinitionKey]['transform'] extends (...args: any[]) => any
|
|
53
62
|
? Awaited<ReturnType<UserMethodConfigMap[DefinitionKey]['transform']>>
|
|
@@ -56,7 +65,7 @@ type ExtractUserDefinedTransformed<
|
|
|
56
65
|
type Alova2Method<
|
|
57
66
|
Responded,
|
|
58
67
|
DefinitionKey extends keyof typeof apiDefinitions,
|
|
59
|
-
CurrentConfig extends Alova2MethodConfig<any
|
|
68
|
+
CurrentConfig extends Alova2MethodConfig<any>,
|
|
60
69
|
> =
|
|
61
70
|
CollapsedAlova extends Alova<
|
|
62
71
|
AlovaGenerics<
|
|
@@ -226,9 +235,9 @@ declare global {
|
|
|
226
235
|
getToken<
|
|
227
236
|
Config extends Alova2MethodConfig<GetTokenResponse> & {
|
|
228
237
|
data: GetTokenRequest;
|
|
229
|
-
}
|
|
238
|
+
},
|
|
230
239
|
>(
|
|
231
|
-
config: Config
|
|
240
|
+
config: Config,
|
|
232
241
|
): Alova2Method<GetTokenResponse, 'oAuthRestful.getToken', Config>;
|
|
233
242
|
};
|
|
234
243
|
resourceAuthorizationRestful: {
|
|
@@ -272,10 +281,14 @@ declare global {
|
|
|
272
281
|
pathParams: {
|
|
273
282
|
id: string;
|
|
274
283
|
};
|
|
275
|
-
}
|
|
284
|
+
},
|
|
276
285
|
>(
|
|
277
|
-
config: Config
|
|
278
|
-
): Alova2Method<
|
|
286
|
+
config: Config,
|
|
287
|
+
): Alova2Method<
|
|
288
|
+
ResourceAuthorizationState,
|
|
289
|
+
'resourceAuthorizationRestful.getResourceAuthorizationState',
|
|
290
|
+
Config
|
|
291
|
+
>;
|
|
279
292
|
};
|
|
280
293
|
roleAuthorizationRestful: {
|
|
281
294
|
/**
|
|
@@ -317,10 +330,14 @@ declare global {
|
|
|
317
330
|
pathParams: {
|
|
318
331
|
role: string;
|
|
319
332
|
};
|
|
320
|
-
}
|
|
333
|
+
},
|
|
321
334
|
>(
|
|
322
|
-
config: Config
|
|
323
|
-
): Alova2Method<
|
|
335
|
+
config: Config,
|
|
336
|
+
): Alova2Method<
|
|
337
|
+
RoleAuthorizationState,
|
|
338
|
+
'roleAuthorizationRestful.getRoleAuthorizationState',
|
|
339
|
+
Config
|
|
340
|
+
>;
|
|
324
341
|
};
|
|
325
342
|
userAuthorizationRestful: {
|
|
326
343
|
/**
|
|
@@ -362,10 +379,14 @@ declare global {
|
|
|
362
379
|
pathParams: {
|
|
363
380
|
userId: string;
|
|
364
381
|
};
|
|
365
|
-
}
|
|
382
|
+
},
|
|
366
383
|
>(
|
|
367
|
-
config: Config
|
|
368
|
-
): Alova2Method<
|
|
384
|
+
config: Config,
|
|
385
|
+
): Alova2Method<
|
|
386
|
+
UserAuthorizationState,
|
|
387
|
+
'userAuthorizationRestful.getUserAuthorizationState',
|
|
388
|
+
Config
|
|
389
|
+
>;
|
|
369
390
|
};
|
|
370
391
|
}
|
|
371
392
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Authorization } from '
|
|
2
|
-
export class AlovaAuthorization extends Authorization{
|
|
1
|
+
import { Authorization } from 'src/api/authorization/authorization';
|
|
2
|
+
export class AlovaAuthorization extends Authorization {
|
|
3
3
|
static override getToken(type?: string, uid?: string, token?: string) {
|
|
4
|
-
return authorizeApi.oAuthRestful
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
return authorizeApi.oAuthRestful
|
|
5
|
+
.getToken({
|
|
6
|
+
data: {
|
|
7
|
+
...{ ...(type && { type }) },
|
|
8
|
+
...{ ...(uid && { uid }) },
|
|
9
|
+
...{ ...(token && { token }) },
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
.send();
|
|
11
13
|
}
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './authorization';
|
|
1
|
+
export * from './authorization';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createAlova } from 'alova';
|
|
2
2
|
import fetchAdapter from 'alova/fetch';
|
|
3
3
|
import { createApis, withConfigType, mountApis } from './createApis';
|
|
4
|
-
import { onAuthRequired, responded } from '
|
|
5
|
-
import { getServiceEndpoint, ServiceType } from '
|
|
4
|
+
import { onAuthRequired, responded } from 'src/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from 'src/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Authorization),
|
|
9
9
|
requestAdapter: fetchAdapter(),
|
|
10
10
|
beforeRequest: onAuthRequired(),
|
|
11
11
|
cacheFor: null,
|
|
12
|
-
responded: responded
|
|
12
|
+
responded: responded,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const $$userConfigMap = withConfigType({});
|
|
@@ -19,5 +19,4 @@ const Apis = createApis(alovaInstance, $$userConfigMap);
|
|
|
19
19
|
mountApis(Apis);
|
|
20
20
|
|
|
21
21
|
export default Apis;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export * from './implement';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { GetTokenResponse } from '
|
|
1
|
+
import type { GetTokenResponse } from 'src/api/authorization/alova/globals';
|
|
2
2
|
import type { IBuilder } from 'builder-pattern';
|
|
3
3
|
import { Builder } from 'builder-pattern';
|
|
4
4
|
|
|
5
|
-
export class Authorization{
|
|
6
|
-
static _default: typeof Authorization
|
|
7
|
-
static builder(): IBuilder<Authorization>{
|
|
5
|
+
export class Authorization {
|
|
6
|
+
static _default: typeof Authorization;
|
|
7
|
+
static builder(): IBuilder<Authorization> {
|
|
8
8
|
return Builder(this._default) as unknown as IBuilder<Authorization>;
|
|
9
9
|
}
|
|
10
10
|
static default(): typeof Authorization {
|
|
11
11
|
return this._default as unknown as typeof Authorization;
|
|
12
12
|
}
|
|
13
|
-
static getToken(type?: string, uid?: string, token?: string): Promise<GetTokenResponse>{
|
|
14
|
-
return Authorization.default().getToken(type, uid, token)
|
|
13
|
+
static getToken(type?: string, uid?: string, token?: string): Promise<GetTokenResponse> {
|
|
14
|
+
return Authorization.default().getToken(type, uid, token);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './authorization';
|
|
2
|
-
export * from './alova
|
|
2
|
+
export * from './alova';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types='./globals.d.ts' />
|
|
2
2
|
/* tslint:disable */
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* OpenAPI definition - version v0
|
|
6
6
|
*
|
|
@@ -26,5 +26,5 @@ export default {
|
|
|
26
26
|
'checkStateRestful.totalOfCheckState': ['GET', '/病历/服务/统计/病历/总数'],
|
|
27
27
|
'checkStateRestful.genderDistributeOfCheckState': ['GET', '/病历/服务/统计/病历/性别/分布'],
|
|
28
28
|
'checkStateRestful.ageDistributeOfCheckState': ['GET', '/病历/服务/统计/病历/年龄/分布'],
|
|
29
|
-
'checkStateRestful.totalOfCheckByTodayState': ['GET', '/病历/服务/统计/病历/今日']
|
|
29
|
+
'checkStateRestful.totalOfCheckByTodayState': ['GET', '/病历/服务/统计/病历/今日'],
|
|
30
30
|
};
|
|
@@ -19,7 +19,11 @@ import { Method } from 'alova';
|
|
|
19
19
|
import apiDefinitions from './apiDefinitions';
|
|
20
20
|
|
|
21
21
|
const cache = Object.create(null);
|
|
22
|
-
const createFunctionalProxy = (
|
|
22
|
+
const createFunctionalProxy = (
|
|
23
|
+
array: (string | symbol)[],
|
|
24
|
+
alovaInstance: Alova<AlovaGenerics>,
|
|
25
|
+
configMap: any,
|
|
26
|
+
) => {
|
|
23
27
|
const apiPathKey = array.join('.') as keyof typeof apiDefinitions;
|
|
24
28
|
if (cache[apiPathKey]) {
|
|
25
29
|
return cache[apiPathKey];
|
|
@@ -39,7 +43,7 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
39
43
|
}
|
|
40
44
|
const mergedConfig = {
|
|
41
45
|
...configMap[apiPathKey],
|
|
42
|
-
...config
|
|
46
|
+
...config,
|
|
43
47
|
};
|
|
44
48
|
const [method, url] = apiItem;
|
|
45
49
|
const pathParams = mergedConfig.pathParams;
|
|
@@ -49,7 +53,10 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
49
53
|
});
|
|
50
54
|
delete mergedConfig.pathParams;
|
|
51
55
|
let data = mergedConfig.data;
|
|
52
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
Object.prototype.toString.call(data) === '[object Object]' &&
|
|
58
|
+
typeof FormData !== 'undefined'
|
|
59
|
+
) {
|
|
53
60
|
let hasBlobData = false;
|
|
54
61
|
const formData = new FormData();
|
|
55
62
|
for (const key in data) {
|
|
@@ -60,8 +67,14 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
60
67
|
}
|
|
61
68
|
data = hasBlobData ? formData : data;
|
|
62
69
|
}
|
|
63
|
-
return new Method(
|
|
64
|
-
|
|
70
|
+
return new Method(
|
|
71
|
+
method!.toUpperCase() as MethodType,
|
|
72
|
+
alovaInstance,
|
|
73
|
+
urlReplaced,
|
|
74
|
+
mergedConfig,
|
|
75
|
+
data,
|
|
76
|
+
);
|
|
77
|
+
},
|
|
65
78
|
});
|
|
66
79
|
cache[apiPathKey] = proxy;
|
|
67
80
|
return proxy;
|
|
@@ -71,7 +84,7 @@ export const createApis = (alovaInstance: Alova<AlovaGenerics>, configMap: any)
|
|
|
71
84
|
const Apis = new Proxy({} as checkApi, {
|
|
72
85
|
get(_, property) {
|
|
73
86
|
return createFunctionalProxy([property], alovaInstance, configMap);
|
|
74
|
-
}
|
|
87
|
+
},
|
|
75
88
|
});
|
|
76
89
|
return Apis;
|
|
77
90
|
};
|
|
@@ -93,7 +106,9 @@ type APISofParameters<Tag extends string, Url extends string> = Tag extends keyo
|
|
|
93
106
|
: any;
|
|
94
107
|
type MethodsConfigMap = {
|
|
95
108
|
[P in keyof typeof import('./apiDefinitions').default]?: MethodConfig<
|
|
96
|
-
P extends `${infer Tag}.${infer Url}`
|
|
109
|
+
P extends `${infer Tag}.${infer Url}`
|
|
110
|
+
? Parameters<NonNullable<APISofParameters<Tag, Url>[0]>['transform']>[0]
|
|
111
|
+
: any
|
|
97
112
|
>;
|
|
98
113
|
};
|
|
99
114
|
export const withConfigType = <Config extends MethodsConfigMap>(config: Config) => config;
|