forked from Gitlink/forgeplus-react
Merge branch 'feature_router' of https://git.trustie.net/Gitlink/forgeplus-react into feature_router
This commit is contained in:
commit
db18cd41b0
|
@ -25,7 +25,7 @@ if (isDev) {
|
||||||
}
|
}
|
||||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
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;
|
window._debugType = debugType;
|
||||||
export function initAxiosInterceptors(props) {
|
export function initAxiosInterceptors(props) {
|
||||||
|
|
|
@ -12,11 +12,7 @@ import Loadable from "react-loadable";
|
||||||
import Loading from "../Loading";
|
import Loading from "../Loading";
|
||||||
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
|
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
|
||||||
|
|
||||||
//404页面
|
|
||||||
const Shixunnopage = Loadable({
|
|
||||||
loader: () => import('../modules/404/Shixunnopage'),
|
|
||||||
loading: Loading,
|
|
||||||
})
|
|
||||||
const ProjectNew = Loadable({
|
const ProjectNew = Loadable({
|
||||||
loader: () => import("./New/Index"),
|
loader: () => import("./New/Index"),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
|
|
|
@ -512,7 +512,7 @@ class Detail extends Component {
|
||||||
{
|
{
|
||||||
watchers_count > 0 ?
|
watchers_count > 0 ?
|
||||||
platform ?
|
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}
|
{watchers_count}
|
||||||
</Link>
|
</Link>
|
||||||
:
|
:
|
||||||
|
@ -729,7 +729,7 @@ class Detail extends Component {
|
||||||
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/:owner/:projectsId/watchers"
|
<Route path="/:owner/:projectsId/following"
|
||||||
render={
|
render={
|
||||||
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
<Link to={`/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
|
||||||
<div className="notifyFlex">
|
<div className="notifyFlex">
|
||||||
<p className="notifyInfos">
|
<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>
|
<span className="color-grey-9">{i.time_ago}</span>
|
||||||
</p>
|
</p>
|
||||||
<FlexAJ>
|
<FlexAJ>
|
||||||
|
|
|
@ -88,7 +88,7 @@ export default ((props)=>{
|
||||||
|
|
||||||
// 跳转
|
// 跳转
|
||||||
function settingRule(protectBranch){
|
function settingRule(protectBranch){
|
||||||
props.history.push(`/${owner}/${projectsId}/settings/branch/${protectBranch}`);
|
props.history.push(`/${owner}/${projectsId}/settings/branches/${protectBranch}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 翻页
|
// 翻页
|
||||||
|
|
|
@ -290,7 +290,7 @@ export default Form.create()(
|
||||||
<Cancel
|
<Cancel
|
||||||
className="ml30"
|
className="ml30"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push(`/${owner}/${projectsId}/settings/branch`);
|
history.push(`/${owner}/${projectsId}/settings/branches`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
取消
|
取消
|
||||||
|
|
|
@ -91,17 +91,17 @@ class Index extends Component {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<p>
|
<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>
|
<i className="iconfont icon-fenzhi font-20 mr10"></i>
|
||||||
分支设置
|
分支设置
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
className={pathname.indexOf("settings/lables") > -1 ? "active" : ""}
|
className={pathname.indexOf("settings/labels") > -1 ? "active" : ""}
|
||||||
>
|
>
|
||||||
<p>
|
<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>
|
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
|
||||||
项目标签
|
项目标签
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -153,19 +153,19 @@ class Index extends Component {
|
||||||
></Route>
|
></Route>
|
||||||
{/* 修改仓库信息 */}
|
{/* 修改仓库信息 */}
|
||||||
<Route
|
<Route
|
||||||
path="/:owner/:projectsId/settings/lables"
|
path="/:owner/:projectsId/settings/labels"
|
||||||
render={(props) => (
|
render={(props) => (
|
||||||
<Tags {...this.props} {...props} {...this.state} />
|
<Tags {...this.props} {...props} {...this.state} />
|
||||||
)}
|
)}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/:owner/:projectsId/settings/branch/:branch"
|
path="/:owner/:projectsId/settings/branches/:branch"
|
||||||
render={(props) => (
|
render={(props) => (
|
||||||
<BranchNew {...this.props} {...props} {...this.state} />
|
<BranchNew {...this.props} {...props} {...this.state} />
|
||||||
)}
|
)}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/:owner/:projectsId/settings/branch"
|
path="/:owner/:projectsId/settings/branches"
|
||||||
render={(props) => (
|
render={(props) => (
|
||||||
<Branch {...this.props} {...props } {...this.state} />
|
<Branch {...this.props} {...props } {...this.state} />
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -11,7 +11,7 @@ function Activity({list}) {
|
||||||
list.map((i,k)=>{
|
list.map((i,k)=>{
|
||||||
return(
|
return(
|
||||||
<li>
|
<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">
|
<div className="aInfos">
|
||||||
<AlignCenter>
|
<AlignCenter>
|
||||||
<Link to={`/${i.user_login}`} className="name">{i.user_name}</Link>
|
<Link to={`/${i.user_login}`} className="name">{i.user_name}</Link>
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default withRouter(
|
||||||
secondRouter = props.location.pathname.split('/')[2];
|
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 (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
|
|
||||||
|
|
|
@ -84,10 +84,10 @@ class Infos extends Component {
|
||||||
this.setState({menuKey:"4",route_type:undefined});
|
this.setState({menuKey:"4",route_type:undefined});
|
||||||
}else if(pathname === `/${username}/organizes`){
|
}else if(pathname === `/${username}/organizes`){
|
||||||
this.setState({menuKey:"5",route_type:undefined});
|
this.setState({menuKey:"5",route_type:undefined});
|
||||||
}else if(pathname === `/${username}/watchers`){
|
}else if(pathname === `/${username}/following`){
|
||||||
this.setState({menuKey:undefined,route_type:"watchers"});
|
this.setState({menuKey:undefined,route_type:"following"});
|
||||||
}else if(pathname === `/${username}/fan_users`){
|
}else if(pathname === `/${username}/followers`){
|
||||||
this.setState({menuKey:undefined,route_type:"fan_users"});
|
this.setState({menuKey:undefined,route_type:"followers"});
|
||||||
}else{
|
}else{
|
||||||
this.setState({menuKey:undefined,route_type:undefined});
|
this.setState({menuKey:undefined,route_type:undefined});
|
||||||
}
|
}
|
||||||
|
@ -250,17 +250,17 @@ class Infos extends Component {
|
||||||
</div>
|
</div>
|
||||||
<div className="focusBox">
|
<div className="focusBox">
|
||||||
<Link
|
<Link
|
||||||
to={`/${user && user.login}/watchers`}
|
to={`/${user && user.login}/following`}
|
||||||
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`}
|
className={`with50 text-center pull-left ${route_type === "following" ? "text-primary" : ""}`}
|
||||||
onClick={() =>this.route_link("watchers")}
|
onClick={() =>this.route_link("following")}
|
||||||
>
|
>
|
||||||
<div>{current_user && user && user.login === current_user.login ? "我关注的" : "TA关注的"}</div>
|
<div>{current_user && user && user.login === current_user.login ? "我关注的" : "TA关注的"}</div>
|
||||||
<span>{user && user.watching_count}</span>
|
<span>{user && user.watching_count}</span>
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
to={`/${user && user.login}/fan_users`}
|
to={`/${user && user.login}/followers`}
|
||||||
onClick={() =>this.route_link("fan_users")}
|
onClick={() =>this.route_link("followers")}
|
||||||
className={`with50 text-center pull-left ${route_type === "fan_users" ? "text-primary" : ""}`}
|
className={`with50 text-center pull-left ${route_type === "followers" ? "text-primary" : ""}`}
|
||||||
>
|
>
|
||||||
<div>{current_user && user && user.login === current_user.login ? "关注我的" : "关注TA的"}</div>
|
<div>{current_user && user && user.login === current_user.login ? "关注我的" : "关注TA的"}</div>
|
||||||
<span>{user && user.watched_count}</span>
|
<span>{user && user.watched_count}</span>
|
||||||
|
@ -309,7 +309,7 @@ class Infos extends Component {
|
||||||
{user && (
|
{user && (
|
||||||
<Switch {...this.props}>
|
<Switch {...this.props}>
|
||||||
<Route
|
<Route
|
||||||
path="/:username/watchers"
|
path="/:username/following"
|
||||||
render={() => {
|
render={() => {
|
||||||
return <WatchsUser {...this.props} {...this.state} userType="watchers" fetchUser={this.fetchUser}/>;
|
return <WatchsUser {...this.props} {...this.state} userType="watchers" fetchUser={this.fetchUser}/>;
|
||||||
}}
|
}}
|
||||||
|
@ -321,7 +321,7 @@ class Infos extends Component {
|
||||||
}}
|
}}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/:username/fan_users"
|
path="/:username/followers"
|
||||||
render={() => {
|
render={() => {
|
||||||
return <FanUser {...this.props} {...this.state} userType="fan_users" fetchUser={this.fetchUser}/>;
|
return <FanUser {...this.props} {...this.state} userType="fan_users" fetchUser={this.fetchUser}/>;
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -22,8 +22,8 @@ class CommonList extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
get_watchers = () => {
|
get_watchers = () => {
|
||||||
const { login, userType } = this.props;
|
const { userType, match: { params: { username } } } = this.props;
|
||||||
const url = `/users/${login}/${userType}.json`;
|
const url = `/users/${username}/${userType}.json`;
|
||||||
const { page, limit, search } = this.state;
|
const { page, limit, search } = this.state;
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: true,
|
isSpin: true,
|
||||||
|
|
|
@ -3,10 +3,10 @@ import CommonLists from "./common_lists"
|
||||||
class FanUsers extends Component {
|
class FanUsers extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {user, current_user , fetchUser} = this.props
|
const {user, current_user , match, fetchUser} = this.props
|
||||||
return (
|
return (
|
||||||
<div>
|
<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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React, { Component } from "react";
|
||||||
import CommonLists from "./common_lists"
|
import CommonLists from "./common_lists"
|
||||||
class WatcherUsers extends Component {
|
class WatcherUsers extends Component {
|
||||||
render() {
|
render() {
|
||||||
const {user, current_user , fetchUser } = this.props;
|
const {user, current_user , match, fetchUser } = this.props;
|
||||||
return (
|
return (
|
||||||
user && user.login &&
|
user && user.login &&
|
||||||
<CommonLists
|
<CommonLists
|
||||||
|
@ -10,6 +10,7 @@ class WatcherUsers extends Component {
|
||||||
login={user.login}
|
login={user.login}
|
||||||
current_user={current_user}
|
current_user={current_user}
|
||||||
fetchUser={fetchUser}
|
fetchUser={fetchUser}
|
||||||
|
match={match}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue