king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/menu/picturecontroller/editform/index.jsx
@@ -19,12 +19,15 @@
  }
  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 {
@@ -61,7 +64,7 @@
    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>
@@ -109,7 +112,7 @@
              )}
            </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,
@@ -126,11 +129,28 @@
              })(<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', {