change /duty/info api

mgy
Dawn1Ocean 2024-04-07 12:29:07 +08:00
parent ff926676bd
commit 7a198cfe03
3 changed files with 25 additions and 4 deletions

View File

@ -87,6 +87,23 @@ data:
} }
``` ```
#### 当前值班暂停
data:
```json
{
"isInDuty": false,
"inDutyCnt": 0,
"currentDuty": "off", // 'off' 代表当前值班暂停
"place": "",
"otherDutyStart": "",
"otherDutyEnd": "",
"offDutyReason": "考试周",
"dutyRecoverTime": "下周一"
}
```
## 账号登陆 ## 账号登陆
### 微信小程序登陆 `POST /login` OK ### 微信小程序登陆 `POST /login` OK

View File

@ -21,7 +21,7 @@ export class DutyData {
isInDuty: boolean; isInDuty: boolean;
inDutyCnt?: number; inDutyCnt?: number;
currentDuty?: '0' | '1' | '2' | '3' | 'others'; currentDuty?: 'off' | '0' | '1' | '2' | '3' | 'others';
otherDutyStart?: string; otherDutyStart?: string;
otherDutyEnd?: string; otherDutyEnd?: string;
offDutyReason?: string; offDutyReason?: string;
@ -122,7 +122,7 @@ export class DutyInfo extends Component {
moment(data.otherDutyStart).format('H:mm') + moment(data.otherDutyStart).format('H:mm') +
' - ' + ' - ' +
moment(data.otherDutyEnd).format('H:mm') moment(data.otherDutyEnd).format('H:mm')
: id.currentDutyText(data.currentDuty || '0'), : id.currentDutyText(data.currentDuty || 'off'),
}, },
{ title: id.inDutyCnt(data.inDutyCnt as number) }, { title: id.inDutyCnt(data.inDutyCnt as number) },
]} ]}

View File

@ -37,7 +37,7 @@ export interface MainPageText {
}; };
inDuty: { inDuty: {
title: string; title: string;
currentDutyText: (c: '0' | '1' | '2' | '3' | 'others') => string; currentDutyText: (c: 'off' | '0' | '1' | '2' | '3' | 'others') => string;
inDutyCnt: (n: number) => string; inDutyCnt: (n: number) => string;
}; };
}; };
@ -93,8 +93,10 @@ export const mainPageZhCn: MainPageText = {
title: '值班中', title: '值班中',
currentDutyText: (c) => { currentDutyText: (c) => {
switch (c) { switch (c) {
case 'off':
return '暂停值班';
case '0': case '0':
return '当前未值班'; return '休息中';
case '1': case '1':
return '第一班 13:30-16:00'; return '第一班 13:30-16:00';
case '2': case '2':
@ -160,6 +162,8 @@ export const mainPageEnUs: MainPageText = {
title: 'On Duty', title: 'On Duty',
currentDutyText: (c) => { currentDutyText: (c) => {
switch (c) { switch (c) {
case 'off':
return 'Duty paused';
case '0': case '0':
return 'Normal Shift'; return 'Normal Shift';
case '1': case '1':