dev_forum
hjm 5 years ago
parent c56717b905
commit 23ae46b3d2

@ -26,7 +26,8 @@ class BoardsNew extends Component{
this.state = { this.state = {
fileList: [], fileList: [],
boards: [] boards: [],
title_num: 60
} }
} }
addSuccess = () => { addSuccess = () => {
@ -93,7 +94,8 @@ class BoardsNew extends Component{
status: 'done' status: 'done'
} }
}) })
this.setState({ fileList: _fileList, board_name: data.board_name })
this.setState({ fileList: _fileList, board_name: data.board_name, title_num: 60 - parseInt(data.subject.length) })
} }
} }
}) })
@ -228,8 +230,14 @@ class BoardsNew extends Component{
}); });
} }
// 附件相关 ------------ END // 附件相关 ------------ END
changeTitle=(e)=>{
console.log(e.target.value.length);
this.setState({
title_num: 60 - parseInt(e.target.value.length)
})
}
render() { render() {
let { addGroup, fileList, course_id } = this.state; let { addGroup, fileList, course_id, title_num } = this.state;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const formItemLayout = { const formItemLayout = {
@ -318,6 +326,8 @@ class BoardsNew extends Component{
position: 'absolute' position: 'absolute'
}}>置顶</Checkbox> }}>置顶</Checkbox>
)} )}
{/* checkbox 有个边距样式 .ant-checkbox-wrapper + span, */}
<span style={{ "padding-left": 0, "padding-right": 0 }}></span>
{getFieldDecorator('subject', { {getFieldDecorator('subject', {
rules: [{ rules: [{
required: true, message: '请输入标题', required: true, message: '请输入标题',
@ -325,7 +335,8 @@ class BoardsNew extends Component{
max: 60, message: '最大限制为60个字符', max: 60, message: '最大限制为60个字符',
}], }],
})( })(
<Input placeholder="请输入帖子标题最大限制60个字符" className="searchViewAfter"/> <Input placeholder="请输入帖子标题最大限制60个字符" className="searchViewAfter"
onInput={this.changeTitle} addonAfter={String(title_num)} />
)} )}
</Form.Item> </Form.Item>

Loading…
Cancel
Save