Skip to content

Commit 23bd069

Browse files
committed
update version
1 parent 3d463fa commit 23bd069

File tree

20 files changed

+80
-560
lines changed

20 files changed

+80
-560
lines changed

mobile-ui/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"private": true,
55
"dependencies": {
66
"@babel/standalone": "^7.25.6",
7-
"@codingapi/flow-mobile": "^0.0.24",
8-
"@codingapi/form-mobile": "^0.0.24",
9-
"@codingapi/ui-framework": "^0.0.24",
7+
"@codingapi/flow-mobile": "^0.0.28",
8+
"@codingapi/form-mobile": "^0.0.28",
9+
"@codingapi/ui-framework": "^0.0.28",
1010
"@logicflow/core": "^2.0.10",
1111
"@logicflow/extension": "^2.0.14",
1212
"@reduxjs/toolkit": "^2.2.7",
@@ -23,7 +23,6 @@
2323
"jszip": "^3.10.1",
2424
"lodash": "^4.17.21",
2525
"moment": "^2.30.1",
26-
"monaco-editor": "^0.51.0",
2726
"react": "^18.3.1",
2827
"react-dom": "^18.3.1",
2928
"react-redux": "^9.1.2",

mobile-ui/src/api/account.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {get, post} from "@/api";
1+
import {httpClient} from "@/api";
22

33
export async function captcha() {
4-
return get('/open/captcha');
4+
return httpClient.get('/open/captcha');
55
}
66

77
export async function login(body: any) {
8-
return post('/user/login', body);
8+
return httpClient.post('/user/login', body);
99
}
1010

1111
export function initUser(user: {

mobile-ui/src/api/flow.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {get, page, post} from "@/api/index";
1+
import {httpClient} from "@/api/index";
22

33

44
// 流程设计
@@ -12,118 +12,118 @@ export async function list(
1212
type: string
1313
}[]
1414
) {
15-
return page('/api/query/flowWork/list', params, sort, filter, match);
15+
return httpClient.page('/api/query/flowWork/list', params, sort, filter, match);
1616
}
1717

1818

1919
export async function save(body: any) {
20-
return post('/api/cmd/flowWork/save', body);
20+
return httpClient.post('/api/cmd/flowWork/save', body);
2121
}
2222

2323
export async function copy(id: any) {
24-
return post('/api/cmd/flowWork/copy', {id});
24+
return httpClient.post('/api/cmd/flowWork/copy', {id});
2525
}
2626

2727
export async function remove(id: any) {
28-
return post('/api/cmd/flowWork/delete', {id});
28+
return httpClient.post('/api/cmd/flowWork/delete', {id});
2929
}
3030

3131
export async function changeState(id: any) {
32-
return post('/api/cmd/flowWork/changeState', {id});
32+
return httpClient.post('/api/cmd/flowWork/changeState', {id});
3333
}
3434

3535
export async function schema(body: any) {
36-
return post('/api/cmd/flowWork/schema', body);
36+
return httpClient.post('/api/cmd/flowWork/schema', body);
3737
}
3838

3939
// 流程控制
4040

4141
export async function startFlow(body:any) {
42-
return post('/api/cmd/flowRecord/startFlow', body);
42+
return httpClient.post('/api/cmd/flowRecord/startFlow', body);
4343
}
4444

4545
export async function getFlowStep(body:any) {
46-
return post('/api/cmd/flowRecord/getFlowStep', body);
46+
return httpClient.post('/api/cmd/flowRecord/getFlowStep', body);
4747
}
4848

4949
export async function detail(id?:any,workCode?:any) {
50-
return get('/api/query/flowRecord/detail', {id,workCode});
50+
return httpClient.get('/api/query/flowRecord/detail', {id,workCode});
5151
}
5252

5353
export async function processDetail(processId?:any) {
54-
return get('/api/query/flowRecord/processDetail', {processId});
54+
return httpClient.get('/api/query/flowRecord/processDetail', {processId});
5555
}
5656

5757
export async function saveFlow(body:any) {
58-
return post('/api/cmd/flowRecord/save', body);
58+
return httpClient.post('/api/cmd/flowRecord/save', body);
5959
}
6060

6161
export async function removeFlow(body:any) {
62-
return post('/api/cmd/flowRecord/remove', body);
62+
return httpClient.post('/api/cmd/flowRecord/remove', body);
6363
}
6464

6565

6666
export async function submitFlow(body:any) {
67-
return post('/api/cmd/flowRecord/submitFlow', body);
67+
return httpClient.post('/api/cmd/flowRecord/submitFlow', body);
6868
}
6969

7070

7171
export async function trySubmitFlow(body:any) {
72-
return post('/api/cmd/flowRecord/trySubmitFlow', body);
72+
return httpClient.post('/api/cmd/flowRecord/trySubmitFlow', body);
7373
}
7474

7575
export async function custom(body:any) {
76-
return post('/api/cmd/flowRecord/custom', body);
76+
return httpClient.post('/api/cmd/flowRecord/custom', body);
7777
}
7878

7979

8080
export async function recall(body:any) {
81-
return post('/api/cmd/flowRecord/recall', body);
81+
return httpClient.post('/api/cmd/flowRecord/recall', body);
8282
}
8383

8484
export async function postponed(body:any) {
85-
return post('/api/cmd/flowRecord/postponed', body);
85+
return httpClient.post('/api/cmd/flowRecord/postponed', body);
8686
}
8787

8888
export async function transfer(body:any) {
89-
return post('/api/cmd/flowRecord/transfer', body);
89+
return httpClient.post('/api/cmd/flowRecord/transfer', body);
9090
}
9191

9292
export async function urge(body:any) {
93-
return post('/api/cmd/flowRecord/urge', body);
93+
return httpClient.post('/api/cmd/flowRecord/urge', body);
9494
}
9595

9696

9797
// 待办中心控制
9898

9999
export async function findAllByOperatorId( lastId?: string,
100100
pageSize=10) {
101-
return get('/api/app/query/flowRecord/findAllByOperatorId',{lastId,pageSize});
101+
return httpClient.get('/api/app/query/flowRecord/findAllByOperatorId',{lastId,pageSize});
102102
}
103103

104104
export async function findTodoByOperatorId(lastId?: string,
105105
pageSize=10) {
106-
return get('/api/app/query/flowRecord/findTodoByOperatorId', {lastId,pageSize});
106+
return httpClient.get('/api/app/query/flowRecord/findTodoByOperatorId', {lastId,pageSize});
107107
}
108108

109109
export async function findDoneByOperatorId(lastId?: string,
110110
pageSize=10) {
111-
return get('/api/app/query/flowRecord/findDoneByOperatorId',{lastId,pageSize});
111+
return httpClient.get('/api/app/query/flowRecord/findDoneByOperatorId',{lastId,pageSize});
112112
}
113113

114114

115115
export async function findInitiatedByOperatorId(lastId?: string,
116116
pageSize=10) {
117-
return get('/api/app/query/flowRecord/findInitiatedByOperatorId', {lastId,pageSize});
117+
return httpClient.get('/api/app/query/flowRecord/findInitiatedByOperatorId', {lastId,pageSize});
118118
}
119119

120120

121121
export async function findTimeoutTodoByOperatorId(lastId?: string,
122122
pageSize=10) {
123-
return get('/api/app/query/flowRecord/findTimeoutTodoByOperatorId',{lastId,pageSize});
123+
return httpClient.get('/api/app/query/flowRecord/findTimeoutTodoByOperatorId',{lastId,pageSize});
124124
}
125125

126126
export async function findPostponedTodoByOperatorId(lastId?: string,
127127
pageSize=10) {
128-
return get('/api/app/query/flowRecord/findPostponedTodoByOperatorId',{lastId,pageSize});
128+
return httpClient.get('/api/app/query/flowRecord/findPostponedTodoByOperatorId',{lastId,pageSize});
129129
}

mobile-ui/src/api/index.ts

Lines changed: 12 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,16 @@
1-
import axios from "axios";
2-
import {sleep, textToBase64} from "@/utils";
31
import {Toast} from "antd-mobile";
2+
import {HttpClient} from "@codingapi/ui-framework";
43

5-
const api = axios.create({
6-
timeout: 10000,
7-
headers: {
8-
"Content-Type": "application/json",
4+
export const httpClient = new HttpClient(10000,{
5+
success: (msg: string) => {
6+
Toast.show({
7+
content: msg,
8+
})
99
},
10-
});
11-
12-
api.interceptors.request.use((config: any) => {
13-
const token = localStorage.getItem("token");
14-
if (token) {
15-
config.headers = {
16-
Authorization: `${token}`,
17-
} as any;
18-
}
19-
return config;
20-
}, (error: any) => {
21-
return Promise.reject(error);
22-
});
23-
24-
api.interceptors.response.use(async (response: any) => {
25-
const headers = response.headers;
26-
const token = headers['authorization'];
27-
28-
const state = response.status;
29-
if (state === 200) {
30-
if (token) {
31-
console.log('reset token', token);
32-
localStorage.setItem("token", token)
33-
}
34-
if(response.data) {
35-
const success = response.data.success;
36-
if (!success) {
37-
const errMessage = response.data.errMessage;
38-
const errCode = response.data.errCode;
39-
if ("token.expire" === errCode || "token.error" === errCode) {
40-
Toast.show({
41-
content: '登录已过期,请退出再重新打开',
42-
})
43-
await sleep(1500);
44-
localStorage.clear();
45-
window.location.href = '/#login';
46-
} else {
47-
if ("login.error" === errCode) {
48-
return response;
49-
}
50-
Toast.show({
51-
icon: 'fail',
52-
content:errMessage,
53-
})
54-
}
55-
}
56-
}else {
57-
Toast.show({
58-
icon: 'fail',
59-
content:'抱歉,该账户无权限访问',
60-
})
61-
}
62-
}
63-
return response;
64-
},
65-
(error: any) => {
66-
const response = error.response;
67-
const state = response.data.status;
68-
69-
if(state === 403){
70-
Toast.show({
71-
icon: 'fail',
72-
content:'抱歉,该账户无权限访问',
73-
})
74-
return {
75-
data: {
76-
success: false,
77-
}
78-
}
79-
}
80-
return Promise.reject(error);
81-
}
82-
)
83-
84-
85-
export const get = async (url: string, params?: any) => {
86-
try {
87-
const response = await api.get(url, {
88-
params
89-
});
90-
return response.data;
91-
}catch (e){
92-
return {
93-
success: false,
94-
}
95-
}
96-
}
97-
98-
export const post = async (url: string, data: any) => {
99-
try {
100-
const response = await api.post(url, data);
101-
return response.data;
102-
}catch (e){
103-
return {
104-
success: false,
105-
}
106-
}
107-
}
108-
109-
export const page = async (url: string, params: any, sort: any, filter: any, match: {
110-
key: string,
111-
type: string
112-
}[]) => {
113-
const response = await get(url, {
114-
...params,
115-
sort: textToBase64(sort),
116-
filter: textToBase64(filter),
117-
params: textToBase64(match),
118-
});
119-
120-
if(response.success){
121-
const list = response.data.total > 0 ? response.data.list : [];
122-
return {
123-
data: list,
124-
success: response.success,
125-
total: response.data.total
126-
};
127-
}else{
128-
return {
129-
data: [],
130-
success: response.success,
131-
total: 0
132-
}
133-
}
134-
}
135-
136-
137-
export const getDownload = async (url: string, filename?: string) => {
138-
try {
139-
const token = localStorage.getItem("token");
140-
const response = await axios.get(url, {
141-
responseType: 'blob',
142-
headers: {
143-
'Authorization': token,
144-
}
145-
});
146-
const bytes = await response.data;
147-
const blob = new Blob([bytes]);
148-
const downloadUrl = window.URL.createObjectURL(blob);
149-
const a = document.createElement('a');
150-
a.href = downloadUrl;
151-
a.download = filename || 'result.csv';
152-
a.click();
153-
} catch (e) {
154-
console.log(e);
155-
}
156-
}
157-
158-
export const postDownload = async (url: string, data: any, filename?: string) => {
159-
try {
160-
const token = localStorage.getItem("token");
161-
const response = await axios.post(url, data, {
162-
responseType: 'blob',
163-
headers: {
164-
'Authorization': token,
165-
}
166-
});
167-
const bytes = await response.data;
168-
const blob = new Blob([bytes]);
169-
const downloadUrl = window.URL.createObjectURL(blob);
170-
const a = document.createElement('a');
171-
a.href = downloadUrl;
172-
a.download = filename || 'result.csv';
173-
a.click();
174-
} catch (e) {
175-
console.log(e);
10+
error: (msg: string) => {
11+
Toast.show({
12+
icon: 'fail',
13+
content: msg,
14+
})
17615
}
177-
}
16+
})

mobile-ui/src/api/leave.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import {get, post} from "@/api/index";
1+
import {httpClient} from "@/api/index";
22

33
export async function list(
44
lastId?: string,
55
pageSize=10,
66
) {
7-
return get('/api/app/query/leave/list', {lastId,pageSize});
7+
return httpClient.get('/api/app/query/leave/list', {lastId,pageSize});
88
}
99

1010

1111
export async function startLeave(body: any) {
12-
return post('/api/cmd/leave/startLeave', body);
12+
return httpClient.post('/api/cmd/leave/startLeave', body);
1313
}
1414

0 commit comments

Comments
 (0)