dev_admin
hjm 6 years ago
parent 909bd562d0
commit f558c9d3ce

@ -9,6 +9,7 @@ import Dialog, {
import Button from 'material-ui/Button'; import Button from 'material-ui/Button';
import { FormControl, FormHelperText } from 'material-ui/Form'; import { FormControl, FormHelperText } from 'material-ui/Form';
import Input, { InputLabel } from 'material-ui/Input'; import Input, { InputLabel } from 'material-ui/Input';
import { InputNumber } from 'antd'
@ -38,8 +39,9 @@ class RewardDialog extends Component {
onGoldRewardDialogOkBtnClick() { onGoldRewardDialogOkBtnClick() {
console.log('onGoldRewardDialogOkBtnClick') console.log('onGoldRewardDialogOkBtnClick')
const { goldRewardInput } = this.state; const { goldRewardInput } = this.state;
if (!goldRewardInput || goldRewardInput === '0' || goldRewardInput.indexOf('-') !== -1) { if (!goldRewardInput || goldRewardInput === '0' || goldRewardInput < 0) {
this.setState({ goldRewardInputError: true}) this.props.showNotification('奖励金币不能为空或负数')
// this.setState({ goldRewardInputError: true})
return; return;
} else { } else {
this.props.setRewardDialogVisible( false ) this.props.setRewardDialogVisible( false )
@ -47,7 +49,8 @@ class RewardDialog extends Component {
} }
} }
onGoldRewardInputChange(event) { onGoldRewardInputChange(event) {
this.setState({ goldRewardInput: event.target.value, goldRewardInputError: false }); // || event.target.value
this.setState({ goldRewardInput: event , goldRewardInputError: false });
} }
render() { render() {
@ -58,17 +61,26 @@ class RewardDialog extends Component {
return ( return (
<Dialog <Dialog
open={goldRewardDialogOpen} open={goldRewardDialogOpen}
disableEscapeKeyDown={true} disableEscapeKeyDown={true}
onClose={this.handleGoldRewardDialogClose} onClose={this.handleGoldRewardDialogClose}
className={'rewardDialog'}
> >
<style>{`
.rewardDialog>div:last-child {
width: 280px;
}
`}</style>
<DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle> <DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle>
<DialogContent> <DialogContent>
<FormControl { ...goldRewardInputErrorObj } aria-describedby="name-error-text"> {/* <FormControl { ...goldRewardInputErrorObj } aria-describedby="name-error-text"> */}
<InputLabel htmlFor="goldReward">请输入奖励的金币数量</InputLabel> {/* <InputLabel htmlFor="goldReward"></InputLabel>
<Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} /> <Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} />
{ goldRewardInputError ? <FormHelperText id="name-error-text">奖励金币不能为空或负数</FormHelperText> : ''} { goldRewardInputError ? <FormHelperText id="name-error-text">奖励金币不能为空或负数</FormHelperText> : ''} */}
</FormControl>
<InputNumber placeholder="请输入奖励的金币数量" id="goldReward" type="number" value={this.state.goldRewardInput}
onChange={(e) => this.onGoldRewardInputChange(e)} width={228} style={{ width: '228px'}} />
{/* </FormControl> */}
{/*<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}> </DialogContentText>*/} {/*<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}> </DialogContentText>*/}
</DialogContent> </DialogContent>

@ -685,6 +685,7 @@ class MemoDetail extends Component {
<RewardDialog goldRewardDialogOpen={goldRewardDialogOpen} <RewardDialog goldRewardDialogOpen={goldRewardDialogOpen}
setRewardDialogVisible={this.setRewardDialogVisible} setRewardDialogVisible={this.setRewardDialogVisible}
rewardCode={this.rewardCodeMemo} rewardCode={this.rewardCodeMemo}
{...this.props}
></RewardDialog> ></RewardDialog>
<div className="clearfix"> <div className="clearfix">
<div id="forum_list" className="forum_table mh650"> <div id="forum_list" className="forum_table mh650">

Loading…
Cancel
Save