This commit is contained in:
caishi 2021-05-21 18:58:17 +08:00
parent a1bd41795a
commit ebf75ed433
6 changed files with 22 additions and 14 deletions

View File

@ -45,19 +45,22 @@ function CoderDepot(props){
const [ desc , setDesc ] = useState(undefined);
const [ website , setWebsite ] = useState(undefined);
const [ lesson_url , setLessonUrl ] = useState(undefined);
const [ readme , setReadme ] = useState(undefined)
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
const branchName = props.match.params.branchName;
const details = props.projectDetail;
let pathname = props.history.location.pathname;
useEffect(()=>{
if(props.projectDetail){
setProjectDetail(props.projectDetail);
setDesc(props.projectDetail.description);
setWebsite(props.projectDetail.website);
setLessonUrl(props.projectDetail.lesson_url);
if(details){
setProjectDetail(details);
setDesc(details.description);
setWebsite(details.website);
setLessonUrl(details.lesson_url);
}
},[props])
},[details])
useEffect(()=>{
if(treeValue){
@ -67,18 +70,19 @@ function CoderDepot(props){
}
},[treeValue])
useEffect(()=>{
if (pathname && projectDetail){
if (projectsId && owner){
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
let url = pathname.split(`/tree/${branchName}/`)[1];
setTreeValue(url);
getFileInfo(url,branchName);
}else{
setTreeValue(undefined);
getDirInfo(branchName ||projectDetail.default_branch);
getDirInfo(branchName ||(projectDetail && projectDetail.default_branch));
}
}
},[pathname,projectDetail])
},[projectsId,owner,pathname])
//
function getDirInfo(branch){
@ -98,6 +102,7 @@ function CoderDepot(props){
setLastCommitAuthor(c && c.committer);
setMainFlag(true);
setReadOnly(true);
setReadme(result.data.readme);
}
setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);})
@ -373,7 +378,7 @@ function CoderDepot(props){
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
}
{/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && (projectDetail && projectDetail.readme) ? <ReadMe ChangeFile={ChangeFile} readme={projectDetail && projectDetail.readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
{ dirInfo && readme ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
</div>
</LongWidth>
{

View File

@ -6,6 +6,7 @@ const $ = window.$;
function CoderDepotReadme({ operate , history , readme , ChangeFile }){
const [ menuList ,setMenuList ] = useState(undefined);
const [ content ,setContent ] = useState(undefined);
useEffect(()=>{
if(readme && readme.content){
@ -17,6 +18,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
return { href:`${path}${href}`,text:el.textContent , level:level }
});
setMenuList(items);
setContent(readme.content);
}
},[readme])
@ -54,7 +56,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
}
</div>
<div className="commonBox-info">
<RenderHtml className="break_word_comments imageLayerParent" value={readme && readme.content} url={history.location}/>
<RenderHtml className="break_word_comments imageLayerParent" value={content} url={history.location}/>
</div>
</div>
)

View File

@ -254,7 +254,7 @@ class MessageCount extends Component {
mergeabledMes=()=>{
return(
<div className="clearfix">
<p className="fl">Pull Request无法自动合并你通过如下命令手动合并</p>
<p className="fl">分支存在冲突无法自动合并你可以尝试通过如下命令手动合并</p>
<i className="iconfont icon-fuzhi font-16 fr" onClick={()=>this.jsCopy()}></i>
</div>
)

View File

@ -64,7 +64,7 @@ class m_editor extends Component {
/>
</div>
{!readOnly && (
<div style={{marginTop:"20px"}}>
<div style={{marginTop:"20px",padding:"20px"}}>
<UserSubmitComponent
{...this.props}
{...this.state}

View File

@ -553,7 +553,7 @@ class order extends Component {
<div className="topWrapper" style={{borderBottom:"none"}}>
<div className="target-detail-search">
<Search
placeholder="输入issue名称进行搜索"
placeholder="输入关键字搜索易修"
enterButton
onSearch={this.searchFunc}
style={{ width: 300 }}

View File

@ -54,6 +54,7 @@ class Home extends React.Component {
this.getSchoolDetail();
}
getSchoolDetail() {
axios.get(`/schools/${this.state.schoolId}/detail.json`).then(result => {
if(result.status === 200){