| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { card } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | if (values.urls) { |
| | | values.linkurl = values.urls |
| | | } else if (card.typecharone === 'color' && /^[0-9a-f]{6}$/.test(values.linkurl)) { |
| | | values.linkurl = '#' + values.linkurl |
| | | } |
| | | resolve(values) |
| | | } else { |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="picture-edit-model-form"> |
| | | <Row gutter={24}> |
| | | {!card.id ? <Col span={24}> |
| | | {!card.id && card.typecharone !== 'color' ? <Col span={24}> |
| | | <Form.Item label="添加方式"> |
| | | <Radio.Group value={plusType} onChange={(e) => {this.changeType(e.target.value)}} disabled={false}> |
| | | <Radio value="upload">上传</Radio> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!card.id && plusType === 'input' ? <Col span={24}> |
| | | {!card.id && card.typecharone !== 'color' && plusType === 'input' ? <Col span={24}> |
| | | <Form.Item label="地址"> |
| | | {getFieldDecorator('linkurl', { |
| | | initialValue: linkurl, |
| | |
| | | })(<TextArea autoSize={{ minRows: 3 }} onPressEnter={() => this.props.inputSubmit()}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {card.id ? <Col span={24}> |
| | | {card.id && card.typecharone !== 'color' ? <Col span={24}> |
| | | <Form.Item label="地址"> |
| | | <TextArea value={card.linkurl} readOnly={true} autoSize={{ minRows: 3 }} /> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {card.typecharone === 'color' ? <Col span={24}> |
| | | <Form.Item label="色值"> |
| | | {getFieldDecorator('linkurl', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请填写色值!' |
| | | }, |
| | | { |
| | | max: 100, |
| | | message: '色值最多100个字符!' |
| | | } |
| | | ] |
| | | })(<Input onPressEnter={() => this.props.inputSubmit()}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label="备注"> |
| | | {getFieldDecorator('remark', { |