change doc & mock

mgy
Dawn1Ocean 2024-05-09 14:54:21 +08:00
parent 8f062b0e8c
commit 44ce17d43d
4 changed files with 129 additions and 23 deletions

View File

@ -32,6 +32,78 @@
}
```
## 登陆
### 账号密码登陆 `POST /login`
request:
```json
{
"stuid": "3220114514",
"passwd": "__passwd_test__"
}
```
data:
.role
-1 => 未定
0 => 干事
1 => 部长
2 => 会长
3 => 副会长
4 => 技术指导
5 => 已退休
6 => 管理员
7 => 副部长
8 => 总监
.department
-1 => 未定
0 => 电器部
1 => 电脑部
2 => 人资部
3 => 文宣部
4 => 财外部
```json
{
"token": "token_test",
"name": "亦可",
"avatar": "https://....png",
"role": 6,
"department": 1,
"access": "admin" // "admin" => 主席团成员 "leader" => 值班组长 "member" => 普通成员
}
```
### 登出 `POST /logout`
request:
```json
{
"token": "token_test"
}
```
## 主页面
### 统计数据 `GET /stats`
@ -86,10 +158,12 @@ data:
"otherDutyTime": [
{
"name": "第一班",
"place": "蓝田",
"range": ["2024-03-07T19:52:48.523303", "2024-03-07T19:52:48.523303"]
},
{
"name": "第二班",
"place": "蓝田",
"range": ["2024-03-07T19:52:48.523303", "2024-03-07T19:52:48.523303"]
},
...
@ -102,19 +176,50 @@ data:
#### 更新当前值班情况 `POST /admin/duty/update`
无关项返回空字符串,后端手动校验
无关项不返回,后端手动校验
新增字段dutyStatus "normal" => 正常值班 "others" => 特殊值班 "pause" => 暂停值班
request:
##### 正常值班
```json
{
"isNormalDuty": true,
"currentDuty": "2",
"dutyStatus": "normal",
"inDutyCnt": 3,
"otherDutyTime": [],
"offDutyReason": "",
"place": "204",
"dutyRecoverTime": "",
},
```
##### 特殊值班
```json
{
"dutyStatus": "others",
"inDutyCnt": 3,
"otherDutyTime": [
{
"name": "第一班",
"place": "蓝田",
"range": ["2024-03-07T19:52:48.523303", "2024-03-07T19:52:48.523303"]
},
{
"name": "第二班",
"place": "蓝田",
"range": ["2024-03-07T19:52:48.523303", "2024-03-07T19:52:48.523303"]
},
...
],
},
```
##### 暂停值班
```json
{
"dutyStatus": "pause",
"offDutyReason": "期中考试周",
"dutyRecoverTime": "2024-03-07T19:52:48.523303",
},
```

View File

@ -1,9 +1,9 @@
import askleavelist from './askleavelist.json';
import conclusionlist from './conclusionlist.json';
import loglist from './loglist.json';
import reportlist from './reportlist.json';
import sheet from './sheet.json';
import sheetlist from './sheetlist.json';
import askleavelist from './askleavelist.json';
module.exports = {
'GET /stats': {
@ -91,6 +91,21 @@ module.exports = {
total: 24,
data: askleavelist,
},
'POST /login': {
success: true,
data: {
token: 'token_test',
name: '亦可',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
role: 6,
department: 1,
access: 'admin',
},
},
'POST /logout': {
success: true,
data: {},
},
'GET /api/currentUser': {
success: true,
data: {

View File

@ -208,7 +208,6 @@ const Login: React.FC = () => {
</ProFormCheckbox>
</div>
<div style={{ marginBottom: '2vh' }}>
{' '}
<Button
type="default"
block

View File

@ -15,11 +15,6 @@ declare namespace API {
currentAuthority?: string;
};
type PageParams = {
current?: number;
pageSize?: number;
};
type LoginParams = {
username?: string;
password?: string;
@ -27,14 +22,6 @@ declare namespace API {
type?: string;
};
type ErrorResponse = {
/** 业务约定的错误码 */
errorCode: string;
/** 业务上的错误信息 */
errorMessage?: string;
/** 业务上的请求是否成功 */
success?: boolean;
};
type LogList = {
pageIndex: number;
pageCount: number;