非.git结尾的也需要自动填充

This commit is contained in:
caishi 2021-10-15 10:54:26 +08:00
parent 1aa6c05869
commit 95050bb3bd
1 changed files with 6 additions and 2 deletions

View File

@ -285,12 +285,16 @@ class Index extends Component {
if(value.indexOf("/") > -1){ if(value.indexOf("/") > -1){
let arr = value.split("/"); let arr = value.split("/");
let first = arr[arr.length-1]; let first = arr[arr.length-1];
if(first.indexOf(".git") > -1){ if(first.indexOf(".") > -1){
let second = first.split('.')[0]; let second = first.split('.')[0];
if(!second)return; if(!second)return;
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
repository_name:second repository_name:second
}) })
}else{
this.props.form.setFieldsValue({
repository_name:first
})
} }
} }
} }
@ -351,7 +355,7 @@ class Index extends Component {
required: true, message: '请填写镜像版本库地址' required: true, message: '请填写镜像版本库地址'
}], }],
})( })(
<Input placeholder="请输入需要导入到本项目的仓库地址" onChange={this.ChangeAddr} /> <Input placeholder="请输入需要导入到本项目的仓库地址" onBlur={this.ChangeAddr} />
)} )}
</Form.Item> </Form.Item>
<p className="formTip color-orange">示例https://github.com/facebook/reack.git</p> <p className="formTip color-orange">示例https://github.com/facebook/reack.git</p>