add pickTicket in service
parent
501f27bfbb
commit
2398644cc3
|
|
@ -18,6 +18,7 @@ import { submitComment } from '@/service/submitComment';
|
|||
import Taro from '@tarojs/taro';
|
||||
import wechatUser from '@/wechat';
|
||||
import { addToOreo } from '@/service/addToOreo';
|
||||
import { pickTicket } from '@/service/pickTicket';
|
||||
|
||||
const submitInterval = 5000;
|
||||
|
||||
|
|
@ -148,6 +149,16 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
}
|
||||
|
||||
handlePickConfirm(): void {
|
||||
this.setState({
|
||||
isPickDisable: true,
|
||||
showPickModal: false,
|
||||
});
|
||||
pickTicket(this);
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
isPickDisable: false,
|
||||
});
|
||||
}, submitInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +210,12 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
className='at-col'
|
||||
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
||||
>
|
||||
<AtButton type='secondary' onClick={this.onPick.bind(this)}>
|
||||
<AtButton
|
||||
loading={this.state.isPickLoading}
|
||||
disabled={this.state.isPickDisable}
|
||||
type='secondary'
|
||||
onClick={this.onPick.bind(this)}
|
||||
>
|
||||
{pt.get().ticketDetail.pick}
|
||||
</AtButton>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export function addToOreo(that: TicketDetail) {
|
|||
.catch((err) => {
|
||||
console.log(err);
|
||||
that.setState({
|
||||
isLoading: false,
|
||||
isOreoLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.error + err.toString(),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function pickTicket(that: TicketDetail) {
|
||||
that.setState({
|
||||
isPickLoading: true,
|
||||
});
|
||||
Taro.request({
|
||||
url: getUrl('/tickets/pick'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: 'token_test',
|
||||
id: that.state.id,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
that.setState({
|
||||
isPickLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.success,
|
||||
type: 'success',
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
that.setState({
|
||||
isPickLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.error + err.toString(),
|
||||
type: 'error',
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue