刷新后404的原因

forge
caicai8 5 years ago
parent 272c309b25
commit 2079ccceaf

@ -65,6 +65,7 @@ class CoderRootDirectory extends Component{
const { current_user } = this.props; const { current_user } = this.props;
const { projectsId } = this.props.match.params; const { projectsId } = this.props.match.params;
const { state } = this.props.history.location; const { state } = this.props.history.location;
console.log(this.props);
const url = `/${state}/${projectsId}/entries.json`; const url = `/${state}/${projectsId}/entries.json`;
axios.get((url),{ axios.get((url),{
params:{ params:{

@ -293,6 +293,7 @@ class Detail extends Component{
const { isManager , isDeveloper } = this.props; const { isManager , isDeveloper } = this.props;
const { projectsId } = this.props.match.params; const { projectsId } = this.props.match.params;
const { state } = this.props.history.location;
return( return(
<div> <div>
<div className="detailHeader-wrapper"> <div className="detailHeader-wrapper">
@ -308,11 +309,11 @@ class Detail extends Component{
</div> </div>
<div className="f-wrap-between"> <div className="f-wrap-between">
<ul className="headerMenu-wrapper"> <ul className="headerMenu-wrapper">
<li className={(url.indexOf("coder")>0 || urlFlag)? "active" : ""}><Link to={`/projects/${projectsId}/coder`}><img alt="" src={img_1} width="18" />代码</Link></li> <li className={(url.indexOf("coder")>0 || urlFlag)? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/coder`,state}}><img alt="" src={img_1} width="18" />代码</Link></li>
<li className={url.indexOf("orders")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/orders`}><img alt="" src={img_2} width="12" />工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}</Link></li> <li className={url.indexOf("orders")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/orders`,state}}><img alt="" src={img_2} width="12" />工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}</Link></li>
<li className={url.indexOf("merge")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/merge`}><img alt="" src={img_3} width="13" />合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}</Link></li> <li className={url.indexOf("merge")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/merge`,state}}><img alt="" src={img_3} width="13" />合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}</Link></li>
<li className={url.indexOf("version")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/version`}><img alt="" src={img_4} width="16" />版本发布</Link></li> <li className={url.indexOf("version")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/version`,state}}><img alt="" src={img_4} width="16" />版本发布</Link></li>
<li className={url.indexOf("trends")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/trends`}><img alt="" src={img_6} width="16" />动态</Link></li> <li className={url.indexOf("trends")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/trends`,state}}><img alt="" src={img_6} width="16" />动态</Link></li>
{ {
isManager && isManager &&
<li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}><img alt="" src={img_7} width="19" />仓库设置</Link></li> <li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}><img alt="" src={img_7} width="19" />仓库设置</Link></li>

@ -5,10 +5,19 @@ import '../css/index.css'
import './list.css'; import './list.css';
import img_parise from '../Images/parise.png'; import img_parise from '../Images/parise.png';
class IndexItem extends Component{ class IndexItem extends Component{
// constructor(props){
// super(props);
// }
TurnToDetail=(login,url)=>{
this.props.history.push({
pathname:url,
state:login
})
}
render(){ render(){
const { projects } = this.props; const { projects } = this.props;
// item.author.login
const renderList = ( const renderList = (
projects && projects.length >0 ? projects.map((item,key)=>{ projects && projects.length >0 ? projects.map((item,key)=>{
return( return(
@ -16,11 +25,7 @@ class IndexItem extends Component{
<img className="p-r-photo" alt="" src={getImageUrl(`images/${item.author && item.author.image_url}`)} ></img> <img className="p-r-photo" alt="" src={getImageUrl(`images/${item.author && item.author.image_url}`)} ></img>
<div className="p-r-Infos"> <div className="p-r-Infos">
<div className="p-r-name"> <div className="p-r-name">
<Link to={{ <a onClick={()=>this.TurnToDetail(`${item.author && item.author.login}`,`/projects/${item.identifier}/coder`)} className="hide-1 font-16 color-grey-3" style={{whiteSpace:"wrap"}}>{item.name}</a>
pathname: `/projects/${item.identifier}/coder`,
state: `${item.author && item.author.login}`,
}} className="hide-1 font-16 color-grey-3" style={{whiteSpace:"wrap"}}>{item.name}</Link>
</div> </div>
<div className="p-r-content"> <div className="p-r-content">
<p className="break_word task-hide flex1" style={{maxHeight:"40px"}}>{item.description}</p> <p className="break_word task-hide flex1" style={{maxHeight:"40px"}}>{item.description}</p>

Loading…
Cancel
Save