上传文件显示: ADD file via upload

创建新文件显示: Add 文件名
修改文件: Update 文件名
This commit is contained in:
caishi 2021-06-18 14:23:46 +08:00
parent e9badf0d7c
commit 5eaebd4e42
6 changed files with 26 additions and 2 deletions

View File

@ -285,6 +285,7 @@ class CoderRootFileDetail extends Component {
readOnly={readOnly}
editorType="update"
currentBranch={currentBranch}
descName={detail && `Update ${detail.name}`}
></Meditor>
)}
</div>

View File

@ -73,6 +73,7 @@ class Index extends Component {
content={undefined}
readOnly={false}
editorType="new"
descName={filename && `Add ${filename}`}
></Meditor>
</div>
</div>

View File

@ -16,6 +16,24 @@ class UserSubmitComponent extends Component {
};
}
componentDidMount=()=>{
const { descName } = this.props;
if(descName){
this.props.form.setFieldsValue({
desc:descName
})
}
}
componentDidUpdate=(preProps)=>{
const { descName } = this.props;
if(preProps && descName && preProps.descName !== descName ){
this.props.form.setFieldsValue({
desc:descName
})
}
}
changeSubmittype = (e) => {
this.setState({
submitType: e.target.value,

View File

@ -27,7 +27,7 @@ class m_editor extends Component {
render() {
const { editorValue } = this.state;
const { readOnly, editorType, language , currentBranch } = this.props;
const { readOnly, editorType, language , currentBranch , descName } = this.props;
const editor_options = {
lineNumbers: "on",
wordWrap: true, //强制换行
@ -72,6 +72,7 @@ class m_editor extends Component {
content={editorValue}
editor_type={editorType}
currentBranch={currentBranch}
descName={descName}
></UserSubmitComponent>
</div>
)}

View File

@ -60,6 +60,7 @@ class UploadFile extends Component {
filepath={file_path}
content={editorValue}
editor_type={"upload"}
descName={`ADD file via upload`}
></UserSubmitComponent>
</div>
</div>

View File

@ -108,7 +108,9 @@ class Milepost extends Component {
}
}).then((result) => {
if (result) {
this.getList(1, this.state.status, 'desc')
this.getList(1, this.state.status, 'desc');
const { getDetail } = this.props;
getDetail && getDetail();
}
}).catch((error) => {
console.log(error);