readme 接口返回编辑、显示数据的字段不一致

This commit is contained in:
caishi 2022-05-20 17:26:07 +08:00
parent 0a6c000d4f
commit 9a32e37a0c
3 changed files with 10 additions and 10 deletions

View File

@ -25,7 +25,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {

View File

@ -11,8 +11,8 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
const [ content ,setContent ] = useState(undefined);
useEffect(()=>{
if(readme && readme.content){
setContent(readme.content);
if(readme && readme.replace_content){
setContent(readme.replace_content);
}else{
setContent(undefined);
}

View File

@ -21,7 +21,7 @@ class CoderRootFileDetail extends Component {
value: undefined,
language: undefined,
languages: undefined,
description: props.detail.content,
description: props.detail.replace_content,
menuList:undefined
};
}
@ -36,12 +36,12 @@ class CoderRootFileDetail extends Component {
};
componentDidUpdate=(prevProps)=>{
const { content } = this.props && this.props.detail;
const prevcontent = prevProps.detail && prevProps.detail.content;
if (content && prevcontent) {
if (prevcontent !== content){
const { replace_content } = this.props && this.props.detail;
const prevcontent = prevProps.detail && prevProps.detail.replace_content;
if (replace_content && prevcontent) {
if (prevcontent !== replace_content){
this.setState({
description: content
description: replace_content
});
}
}
@ -319,7 +319,7 @@ class CoderRootFileDetail extends Component {
{...this.state}
language={language ? language : "javascript"}
filepath={`/${detail.path}`}
content={description}
content={detail.content}
readOnly={readOnly}
editorType="update"
currentBranch={currentBranch}