diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js
index ce5cc8017..380b90bd9 100644
--- a/public/react/src/modules/comment/Comments.js
+++ b/public/react/src/modules/comment/Comments.js
@@ -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 {
{"奖励设置"}
-
+ this.onGoldRewardInputChange(e)} width={228} style={{ width: '228px'}} />
+
+ {/*
请输入奖励的金币数量
this.onGoldRewardInputChange(e)} />
{ goldRewardInputError ? 奖励金币不能为空或负数 : ''}
-
+ */}
{/* */}
diff --git a/public/react/src/modules/common/RewardDialog.js b/public/react/src/modules/common/RewardDialog.js
index d8a772e9f..93e0a8936 100644
--- a/public/react/src/modules/common/RewardDialog.js
+++ b/public/react/src/modules/common/RewardDialog.js
@@ -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() {