Merge pull request '修改路由相关issue' (#42) from tongChong/forgeplus-react:feature_router into feature_router

This commit is contained in:
jasder 2021-09-03 14:43:55 +08:00
commit 5e58f349cd
13 changed files with 33 additions and 36 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

@ -12,11 +12,7 @@ import Loadable from "react-loadable";
import Loading from "../Loading";
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
//404页面
const Shixunnopage = Loadable({
loader: () => import('../modules/404/Shixunnopage'),
loading: Loading,
})
const ProjectNew = Loadable({
loader: () => import("./New/Index"),
loading: Loading,

View File

@ -512,7 +512,7 @@ class Detail extends Component {
{
watchers_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{ color: `${watched ? "#2878FF" : "#666"}` }} to={platform ? { pathname: `/${owner}/${projectsId}/watchers`, state } : ""}>
<Link className="detail_tag_btn_count" style={{ color: `${watched ? "#2878FF" : "#666"}` }} to={platform ? { pathname: `/${owner}/${projectsId}/following`, state } : ""}>
{watchers_count}
</Link>
:
@ -729,7 +729,7 @@ class Detail extends Component {
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/watchers"
<Route path="/:owner/:projectsId/following"
render={
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
}

View File

@ -72,7 +72,7 @@ function UndoEvent(props){
<Link to={`/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<div className="notifyFlex">
<p className="notifyInfos">
<Link to={`/${i.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<Link to={`/${i.user && i.user.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span>
</p>
<FlexAJ>

View File

@ -88,7 +88,7 @@ export default ((props)=>{
// 跳转
function settingRule(protectBranch){
props.history.push(`/${owner}/${projectsId}/settings/branch/${protectBranch}`);
props.history.push(`/${owner}/${projectsId}/settings/branches/${protectBranch}`);
}
// 翻页

View File

@ -290,7 +290,7 @@ export default Form.create()(
<Cancel
className="ml30"
onClick={() => {
history.push(`/${owner}/${projectsId}/settings/branch`);
history.push(`/${owner}/${projectsId}/settings/branches`);
}}
>
取消

View File

@ -91,17 +91,17 @@ class Index extends Component {
}
>
<p>
<Link to={`/${owner}/${projectsId}/settings/branch`} className="w-100">
<Link to={`/${owner}/${projectsId}/settings/branches`} className="w-100">
<i className="iconfont icon-fenzhi font-20 mr10"></i>
分支设置
</Link>
</p>
</li>
<li
className={pathname.indexOf("settings/lables") > -1 ? "active" : ""}
className={pathname.indexOf("settings/labels") > -1 ? "active" : ""}
>
<p>
<Link to={`/${owner}/${projectsId}/settings/lables`} className="w-100">
<Link to={`/${owner}/${projectsId}/settings/labels`} className="w-100">
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
项目标签
</Link>
@ -153,19 +153,19 @@ class Index extends Component {
></Route>
{/* 修改仓库信息 */}
<Route
path="/:owner/:projectsId/settings/lables"
path="/:owner/:projectsId/settings/labels"
render={(props) => (
<Tags {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/:owner/:projectsId/settings/branch/:branch"
path="/:owner/:projectsId/settings/branches/:branch"
render={(props) => (
<BranchNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/:owner/:projectsId/settings/branch"
path="/:owner/:projectsId/settings/branches"
render={(props) => (
<Branch {...this.props} {...props } {...this.state} />
)}

View File

@ -11,7 +11,7 @@ function Activity({list}) {
list.map((i,k)=>{
return(
<li>
<Link to={`/${i.user_login}`}><img src={getImageUrl(`/system/lets/letter_avatars/2/D/169_162_140/120.png`)} alt="" className="aImg"/></Link>
<Link to={`/${i.user_login}`}><img src={getImageUrl(`${i.user_avatar}`)} alt="" className="aImg"/></Link>
<div className="aInfos">
<AlignCenter>
<Link to={`/${i.user_login}`} className="name">{i.user_name}</Link>

View File

@ -24,7 +24,7 @@ export default withRouter(
secondRouter = props.location.pathname.split('/')[2];
}
let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'watchers', 'fan_users', 'password'];
let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'following', 'followers', 'password'];
return (
<Switch>

View File

@ -84,10 +84,10 @@ class Infos extends Component {
this.setState({menuKey:"4",route_type:undefined});
}else if(pathname === `/${username}/organizes`){
this.setState({menuKey:"5",route_type:undefined});
}else if(pathname === `/${username}/watchers`){
this.setState({menuKey:undefined,route_type:"watchers"});
}else if(pathname === `/${username}/fan_users`){
this.setState({menuKey:undefined,route_type:"fan_users"});
}else if(pathname === `/${username}/following`){
this.setState({menuKey:undefined,route_type:"following"});
}else if(pathname === `/${username}/followers`){
this.setState({menuKey:undefined,route_type:"followers"});
}else{
this.setState({menuKey:undefined,route_type:undefined});
}
@ -249,17 +249,17 @@ class Infos extends Component {
</div>
<div className="focusBox">
<Link
to={`/${user && user.login}/watchers`}
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`}
onClick={() =>this.route_link("watchers")}
to={`/${user && user.login}/following`}
className={`with50 text-center pull-left ${route_type === "following" ? "text-primary" : ""}`}
onClick={() =>this.route_link("following")}
>
<div>{current_user && user && user.login === current_user.login ? "我关注的" : "TA关注的"}</div>
<span>{user && user.watching_count}</span>
</Link>
<Link
to={`/${user && user.login}/fan_users`}
onClick={() =>this.route_link("fan_users")}
className={`with50 text-center pull-left ${route_type === "fan_users" ? "text-primary" : ""}`}
to={`/${user && user.login}/followers`}
onClick={() =>this.route_link("followers")}
className={`with50 text-center pull-left ${route_type === "followers" ? "text-primary" : ""}`}
>
<div>{current_user && user && user.login === current_user.login ? "关注我的" : "关注TA的"}</div>
<span>{user && user.watched_count}</span>
@ -308,7 +308,7 @@ class Infos extends Component {
{user && (
<Switch {...this.props}>
<Route
path="/:username/watchers"
path="/:username/following"
render={() => {
return <WatchsUser {...this.props} {...this.state} userType="watchers" fetchUser={this.fetchUser}/>;
}}
@ -320,7 +320,7 @@ class Infos extends Component {
}}
></Route>
<Route
path="/:username/fan_users"
path="/:username/followers"
render={() => {
return <FanUser {...this.props} {...this.state} userType="fan_users" fetchUser={this.fetchUser}/>;
}}

View File

@ -22,8 +22,8 @@ class CommonList extends Component {
};
get_watchers = () => {
const { login, userType } = this.props;
const url = `/users/${login}/${userType}.json`;
const { userType, match: { params: { username } } } = this.props;
const url = `/users/${username}/${userType}.json`;
const { page, limit, search } = this.state;
this.setState({
isSpin: true,

View File

@ -3,10 +3,10 @@ import CommonLists from "./common_lists"
class FanUsers extends Component {
render() {
const {user, current_user , fetchUser} = this.props
const {user, current_user , match, fetchUser} = this.props
return (
<div>
{user && user.login && <CommonLists userType="fan_users" login={user.login} current_user={current_user} fetchUser={fetchUser}/>}
{user && user.login && <CommonLists userType="fan_users" login={user.login} current_user={current_user} match={match} fetchUser={fetchUser}/>}
</div>
);
}

View File

@ -2,7 +2,7 @@ import React, { Component } from "react";
import CommonLists from "./common_lists"
class WatcherUsers extends Component {
render() {
const {user, current_user , fetchUser } = this.props;
const {user, current_user , match, fetchUser } = this.props;
return (
user && user.login &&
<CommonLists
@ -10,6 +10,7 @@ class WatcherUsers extends Component {
login={user.login}
current_user={current_user}
fetchUser={fetchUser}
match={match}
/>
);
}