上传文件显示: 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} readOnly={readOnly}
editorType="update" editorType="update"
currentBranch={currentBranch} currentBranch={currentBranch}
descName={detail && `Update ${detail.name}`}
></Meditor> ></Meditor>
)} )}
</div> </div>

View File

@ -73,6 +73,7 @@ class Index extends Component {
content={undefined} content={undefined}
readOnly={false} readOnly={false}
editorType="new" editorType="new"
descName={filename && `Add ${filename}`}
></Meditor> ></Meditor>
</div> </div>
</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) => { changeSubmittype = (e) => {
this.setState({ this.setState({
submitType: e.target.value, submitType: e.target.value,

View File

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

View File

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

View File

@ -108,7 +108,9 @@ class Milepost extends Component {
} }
}).then((result) => { }).then((result) => {
if (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) => { }).catch((error) => {
console.log(error); console.log(error);