issue
This commit is contained in:
parent
a1bd41795a
commit
ebf75ed433
|
@ -45,19 +45,22 @@ function CoderDepot(props){
|
||||||
const [ desc , setDesc ] = useState(undefined);
|
const [ desc , setDesc ] = useState(undefined);
|
||||||
const [ website , setWebsite ] = useState(undefined);
|
const [ website , setWebsite ] = useState(undefined);
|
||||||
const [ lesson_url , setLessonUrl ] = useState(undefined);
|
const [ lesson_url , setLessonUrl ] = useState(undefined);
|
||||||
|
const [ readme , setReadme ] = useState(undefined)
|
||||||
|
|
||||||
const owner = props.match.params.owner;
|
const owner = props.match.params.owner;
|
||||||
const projectsId = props.match.params.projectsId;
|
const projectsId = props.match.params.projectsId;
|
||||||
const branchName = props.match.params.branchName;
|
const branchName = props.match.params.branchName;
|
||||||
|
const details = props.projectDetail;
|
||||||
let pathname = props.history.location.pathname;
|
let pathname = props.history.location.pathname;
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(props.projectDetail){
|
if(details){
|
||||||
setProjectDetail(props.projectDetail);
|
setProjectDetail(details);
|
||||||
setDesc(props.projectDetail.description);
|
setDesc(details.description);
|
||||||
setWebsite(props.projectDetail.website);
|
setWebsite(details.website);
|
||||||
setLessonUrl(props.projectDetail.lesson_url);
|
setLessonUrl(details.lesson_url);
|
||||||
}
|
}
|
||||||
},[props])
|
},[details])
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(treeValue){
|
if(treeValue){
|
||||||
|
@ -67,18 +70,19 @@ function CoderDepot(props){
|
||||||
}
|
}
|
||||||
},[treeValue])
|
},[treeValue])
|
||||||
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if (pathname && projectDetail){
|
if (projectsId && owner){
|
||||||
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
|
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
|
||||||
let url = pathname.split(`/tree/${branchName}/`)[1];
|
let url = pathname.split(`/tree/${branchName}/`)[1];
|
||||||
setTreeValue(url);
|
setTreeValue(url);
|
||||||
getFileInfo(url,branchName);
|
getFileInfo(url,branchName);
|
||||||
}else{
|
}else{
|
||||||
setTreeValue(undefined);
|
setTreeValue(undefined);
|
||||||
getDirInfo(branchName ||projectDetail.default_branch);
|
getDirInfo(branchName ||(projectDetail && projectDetail.default_branch));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},[pathname,projectDetail])
|
},[projectsId,owner,pathname])
|
||||||
|
|
||||||
// 获取主目录列表
|
// 获取主目录列表
|
||||||
function getDirInfo(branch){
|
function getDirInfo(branch){
|
||||||
|
@ -98,6 +102,7 @@ function CoderDepot(props){
|
||||||
setLastCommitAuthor(c && c.committer);
|
setLastCommitAuthor(c && c.committer);
|
||||||
setMainFlag(true);
|
setMainFlag(true);
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
|
setReadme(result.data.readme);
|
||||||
}
|
}
|
||||||
setTimeout(function(){setIsSpin(false);},500);
|
setTimeout(function(){setIsSpin(false);},500);
|
||||||
}).catch(error=>{setIsSpin(false);})
|
}).catch(error=>{setIsSpin(false);})
|
||||||
|
@ -373,7 +378,7 @@ function CoderDepot(props){
|
||||||
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
|
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
|
||||||
}
|
}
|
||||||
{/* readme文件显示(显示文件详情时不显示readme文件) */}
|
{/* 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>
|
</div>
|
||||||
</LongWidth>
|
</LongWidth>
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ const $ = window.$;
|
||||||
|
|
||||||
function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
||||||
const [ menuList ,setMenuList ] = useState(undefined);
|
const [ menuList ,setMenuList ] = useState(undefined);
|
||||||
|
const [ content ,setContent ] = useState(undefined);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(readme && readme.content){
|
if(readme && readme.content){
|
||||||
|
@ -17,6 +18,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
||||||
return { href:`${path}${href}`,text:el.textContent , level:level }
|
return { href:`${path}${href}`,text:el.textContent , level:level }
|
||||||
});
|
});
|
||||||
setMenuList(items);
|
setMenuList(items);
|
||||||
|
setContent(readme.content);
|
||||||
}
|
}
|
||||||
},[readme])
|
},[readme])
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className="commonBox-info">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -254,7 +254,7 @@ class MessageCount extends Component {
|
||||||
mergeabledMes=()=>{
|
mergeabledMes=()=>{
|
||||||
return(
|
return(
|
||||||
<div className="clearfix">
|
<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>
|
<i className="iconfont icon-fuzhi font-16 fr" onClick={()=>this.jsCopy()}></i>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -64,7 +64,7 @@ class m_editor extends Component {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{!readOnly && (
|
{!readOnly && (
|
||||||
<div style={{marginTop:"20px"}}>
|
<div style={{marginTop:"20px",padding:"20px"}}>
|
||||||
<UserSubmitComponent
|
<UserSubmitComponent
|
||||||
{...this.props}
|
{...this.props}
|
||||||
{...this.state}
|
{...this.state}
|
||||||
|
|
|
@ -553,7 +553,7 @@ class order extends Component {
|
||||||
<div className="topWrapper" style={{borderBottom:"none"}}>
|
<div className="topWrapper" style={{borderBottom:"none"}}>
|
||||||
<div className="target-detail-search">
|
<div className="target-detail-search">
|
||||||
<Search
|
<Search
|
||||||
placeholder="输入issue名称进行搜索"
|
placeholder="输入关键字搜索易修"
|
||||||
enterButton
|
enterButton
|
||||||
onSearch={this.searchFunc}
|
onSearch={this.searchFunc}
|
||||||
style={{ width: 300 }}
|
style={{ width: 300 }}
|
||||||
|
|
|
@ -54,6 +54,7 @@ class Home extends React.Component {
|
||||||
this.getSchoolDetail();
|
this.getSchoolDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getSchoolDetail() {
|
getSchoolDetail() {
|
||||||
axios.get(`/schools/${this.state.schoolId}/detail.json`).then(result => {
|
axios.get(`/schools/${this.state.schoolId}/detail.json`).then(result => {
|
||||||
if(result.status === 200){
|
if(result.status === 200){
|
||||||
|
|
Loading…
Reference in New Issue