diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index 612e47d9f..aa7f9dec1 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -126,7 +126,7 @@ class AccountBasic extends Component { // 输入昵称时change剩余的字数 changeNickName=(e)=>{ - let num= 10 - parseInt(e.target.value.length); + let num= 20 - parseInt(e.target.value.length); this.setState({ nameLength:num < 0 ? 0 : num }) @@ -393,6 +393,13 @@ class AccountBasic extends Component { this.props.showNotification("请先选择正确的单位或者学校!"); } } + checkNameLength = (rule, value, callback) => { + if (value && value.length <= 10) { + callback(); + return; + } + callback('请输入您的姓名,最大限制10个字符'); + } render() { let{ @@ -491,8 +498,8 @@ class AccountBasic extends Component { message: '请输入您的昵称', }], })( - {String(nameLength)}/10 + {String(nameLength)}/20 }> )} @@ -505,10 +512,11 @@ class AccountBasic extends Component { rules: [{ // initialValue: this.state.cityDefaultValue, required: true, - message: '请输入您的姓名', + message: '请输入您的姓名,最大限制10个字符', + validator: this.checkNameLength }], })( - this.showOrHide(showRealName)}> }>