dev_admin
hjm 6 years ago
parent c6d491f0a3
commit d7e9e041b5

@ -23,6 +23,7 @@ import CommentItemMDEditor from './CommentItemMDEditor';
import './Comment.css'
import Modals from '../modals/Modals'
import { InputNumber } from 'antd'
/*
-------------------------- 样式相关
@ -470,7 +471,8 @@ class Comments extends Component {
onGoldRewardDialogOkBtnClick() {
console.log('onGoldRewardDialogOkBtnClick')
const { goldRewardInput } = this.state;
if (!goldRewardInput || goldRewardInput === '0' || goldRewardInput.indexOf('-') !== -1) {
// || goldRewardInput.indexOf('-') !== -1
if (!goldRewardInput || goldRewardInput === '0' ) {
this.setState({ goldRewardInputError: true})
return;
} else {
@ -478,8 +480,13 @@ class Comments extends Component {
this.props.rewardCode(this.comment, this.childComment, goldRewardInput)
}
}
onGoldRewardInputChange(event) {
this.setState({ goldRewardInput: event.target.value, goldRewardInputError: false });
onGoldRewardInputChange(value) {
// e.target.value
const number = parseInt(value || 0, 10);
if (Number.isNaN(number)) {
return;
}
this.setState({ goldRewardInput: number, goldRewardInputError: false });
}
render() {
const { deleteComment, onPaginationChange, comment_count_without_reply, currentPage, comments, usingAntdModal } = this.props;
@ -538,11 +545,14 @@ class Comments extends Component {
<DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle>
<DialogContent>
<FormControl { ...goldRewardInputErrorObj } aria-describedby="name-error-text">
<InputNumber placeholder="请输入奖励的金币数量" id="goldReward" type="number" value={this.state.goldRewardInput}
onChange={(e) => this.onGoldRewardInputChange(e)} width={228} style={{ width: '228px'}} />
{/* <FormControl { ...goldRewardInputErrorObj } aria-describedby="name-error-text">
<InputLabel htmlFor="goldReward">请输入奖励的金币数量</InputLabel>
<Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} />
{ goldRewardInputError ? <FormHelperText id="name-error-text">奖励金币不能为空或负数</FormHelperText> : ''}
</FormControl>
</FormControl> */}
{/*<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}> </DialogContentText>*/}
</DialogContent>

@ -48,9 +48,13 @@ class RewardDialog extends Component {
this.props.rewardCode(goldRewardInput)
}
}
onGoldRewardInputChange(event) {
onGoldRewardInputChange(value) {
// || event.target.value
this.setState({ goldRewardInput: event , goldRewardInputError: false });
const number = parseInt(value || 0, 10);
if (Number.isNaN(number)) {
return;
}
this.setState({ goldRewardInput: number , goldRewardInputError: false });
}
render() {

Loading…
Cancel
Save