add askleave api&service
parent
d1d01f0ad1
commit
952a6caa24
14
doc/api.md
14
doc/api.md
|
|
@ -470,4 +470,18 @@ data:
|
||||||
"offDutyReason": "学园维修",
|
"offDutyReason": "学园维修",
|
||||||
"dutyRecoverTime": "下周一"
|
"dutyRecoverTime": "下周一"
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 成员请假 `POST /member/askleave`
|
||||||
|
|
||||||
|
Request
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"token": "token_test",
|
||||||
|
"week": 1,
|
||||||
|
"shift": "2",
|
||||||
|
"reason": "家庭原因",
|
||||||
|
"substitute": "晓洋" // 未找人代班则为空
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
import AskLeavePage from '@/pages/AskLeave/AskLeave';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import pt from '@/plain-text';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
export function reportMessage(that: AskLeavePage) {
|
||||||
|
that.setState({
|
||||||
|
isLoading: true,
|
||||||
|
});
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/member/askleave'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: wechatUser.getToken(),
|
||||||
|
week: that.state.week,
|
||||||
|
shift: that.state.shift,
|
||||||
|
reason: that.state.reason,
|
||||||
|
substitute: that.state.substitute,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err.errMsg);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.error + err.errMsg,
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue