修改user路由

This commit is contained in:
何童崇 2021-08-30 10:31:51 +08:00
parent e606147d03
commit eb02b814a9
76 changed files with 330 additions and 312 deletions

View File

@ -3,7 +3,7 @@ import './App.css';
import { ConfigProvider } from 'antd'
import zhCN from 'antd/lib/locale-provider/zh_CN';
import {
BrowserRouter as Router,
// BrowserRouter as Router,
Route,
Switch
} from 'react-router-dom';
@ -108,6 +108,12 @@ class App extends Component {
initAxiosInterceptors(this.props);
let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
pathname && this.getPathnameType(pathname);
this.unlisten = this.props.history.listen((location,action) => {
// 最新路由的 location 对象,可以通过比较 pathname 是否相同来判断路由的变化情况
let newPathname = location.pathname.split('/')[1];
newPathname&&this.getPathnameType(newPathname);
});
}
getPathnameType = (pathname) => {
@ -124,6 +130,8 @@ class App extends Component {
}
}
HideAddcoursestypess = (i) => {
this.setState({
Addcoursestype: false,
@ -146,7 +154,14 @@ class App extends Component {
window.addEventListener('error', (event) => {
const msg = `${event.type}: ${event.message}`;
});
}
componentWillUnmount() {
this.unlisten && this.unlisten(); // 执行解绑
}
//修改登录方法
Modifyloginvalue = () => {
this.setState({
@ -225,121 +240,121 @@ class App extends Component {
<MuiThemeProvider theme={theme}>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
<SiderBar />
<Router>
<Switch>
{/* wiki预览 */}
<Route path="/projects/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
(props) => {
return (<WikiPreview {...this.props} {...props} {...this.state} />)
}
} />
{/*项目*/}
<Route
path={"/projects/:owner/:projectId/devops/:opsId/detail"}
render={
(props) => {
return (<OpsDetail {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route
path={"/settings"}
render={
(props) => {
return (<Security {...this.props} {...props} {...this.state} />)
}
}>
</Route>
{/*项目*/}
<Route
path={"/projects"}
render={
(props) => {
return (<Projects {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route
path="/register"
render={
(props) => {
return (<EducoderLogin {...this.props} {...props} {...this.state} />)
}
}
/>
{/*403*/}
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500} />
{/*404*/}
<Route path="/nopage" component={Shixunnopage} />
{/* 查询 */}
<Route path="/search" component={Search} />
<Route exact path="/explore"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
}
/>
{/* 判断为用户/组织,并进入对应页面 */}
{
pathType === 'User' ?
<Route exact path="/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}
/> : pathType === 'Organization' ? <Route path={"/:OIdentifier"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route> : pathType === '404' ? <Route path="/nopage" component={Shixunnopage} /> : <Loading />
{/* <Router> */}
<Switch>
{/* wiki预览 */}
<Route path="/projects/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
(props) => {
return (<WikiPreview {...this.props} {...props} {...this.state} />)
}
} />
{/* 组织 */}
{/* <Route path={"/organize"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route> */}
{/* 个人主页 */}
<Route path="/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}></Route>
<Route exact path="/"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
{/*项目*/}
<Route
path={"/projects/:owner/:projectId/devops/:opsId/detail"}
render={
(props) => {
return (<OpsDetail {...this.props} {...props} {...this.state} />)
}
/>
<Route component={Shixunnopage} />
</Switch>
</Router>
}>
</Route>
<Route
path={"/settings"}
render={
(props) => {
return (<Security {...this.props} {...props} {...this.state} />)
}
}>
</Route>
{/*项目*/}
<Route
path={"/projects"}
render={
(props) => {
return (<Projects {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route
path="/register"
render={
(props) => {
return (<EducoderLogin {...this.props} {...props} {...this.state} />)
}
}
/>
{/*403*/}
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500} />
{/*404*/}
<Route path="/nopage" component={Shixunnopage} />
{/* 查询 */}
<Route path="/search" component={Search} />
<Route exact path="/explore"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
}
/>
{/* 判断为用户/组织,并进入对应页面 */}
{
pathType === 'User' ?
<Route exact path="/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}
/> : pathType === 'Organization' ? <Route path={"/:OIdentifier"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route> : pathType === '404' ? <Route path="/nopage" component={Shixunnopage} /> : <Route exact path="/"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
}
/>
}
{/* 组织 */}
<Route path={"/organize"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route>
{/* 个人主页 */}
<Route path="/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}></Route>
<Route component={Shixunnopage} />
</Switch>
{/* </Router> */}
</MuiThemeProvider>
</ConfigProvider>
</Provider>

View File

@ -195,7 +195,7 @@ class College extends Component {
align: 'center',
className: "edu-txt-center font-14 maxnamewidth105",
render: (text, record) => (
<a href={`/users/${record.login}`} title={record.name} target="_blank" className="task-hide maxnamewidth105" style={{
<a href={`/${record.login}`} title={record.name} target="_blank" className="task-hide maxnamewidth105" style={{
color:'#007bff',
}}> {

View File

@ -435,11 +435,11 @@ class TPIContextProvider extends Component {
image_url: "avatars/User/1"
login: "innov"
name: "Coder"
user_url: "/users/innov"
user_url: "/innov"
*/
let user = resData.user;
user.username = resData.user.name;
user.user_url = `/users/${resData.user.login}`;
user.user_url = `/${resData.user.login}`;
// user.image_url = resData.image_url;
user.is_teacher = resData.is_teacher;
resData.user = user;

View File

@ -32,7 +32,7 @@ class ActivityItem extends Component {
</p >
}
<p className="itemLine mt10">
<Link to={`/users/${item && item.user_login}`} className="show-user-link">
<Link to={`/${item && item.user_login}`} className="show-user-link">
<img alt="" src={getImageUrl(`/${item.user_avatar}`)} className="createImage" />
<span className="mr20">{item.user_name}</span>
</Link>

View File

@ -52,8 +52,8 @@ function Contributors({contributors,owner,projectsId}){
<Spin spinning={isSpin}>
<FlexAJ>
<AlignCenter>
<Link to={`/users/${data.login}`}><img src={getImageUrl(`/${data.image_url}`)} alt="" className="radius" width="38px" height="38px"/></Link>
<Link to={`/users/${data.login}`} className="ml10">{data.name}</Link>
<Link to={`/${data.login}`}><img src={getImageUrl(`/${data.image_url}`)} alt="" className="radius" width="38px" height="38px"/></Link>
<Link to={`/${data.login}`} className="ml10">{data.name}</Link>
</AlignCenter>
{
data.is_watch ? <a className="color-grey-9" onClick={()=>FocusFunc(false,data.login)}>取消关注</a>:<a className="color-blue" onClick={()=>FocusFunc(true,data.login)}>关注</a>
@ -145,7 +145,7 @@ function Contributors({contributors,owner,projectsId}){
list.map((item,key)=>{
return(
<Popover content={menu} visible={item.visible} overlayClassName="menuPanels" placement="top">
<Link key={key} to={`/users/${item.login}`}>
<Link key={key} to={`/${item.login}`}>
<img src={getImageUrl(`/${item.image_url}`)} alt="" onMouseOver={()=>setVisibleFunc(true,item.login,key)}/>
</Link>
</Popover>

View File

@ -45,9 +45,9 @@ const Div = styled.div`{
export default (({ user , img, name, time, focusStatus, is_current_user, login , successFunc }) => {
return (
<Div>
<Link to={`/users/${user && user.login}`}><Img src={getImageUrl(`/${img}`)} /></Link>
<Link to={`/${user && user.login}`}><Img src={getImageUrl(`/${img}`)} /></Link>
<div className="m-infos">
<Link to={`/users/${user && user.login}`}><Name>{name}</Name></Link>
<Link to={`/${user && user.login}`}><Name>{name}</Name></Link>
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>
{
is_current_user ?

View File

@ -20,7 +20,7 @@ export default ({ url , name , column , id , login })=>{
`;
return(
id?
<Link to={`/users/${login}`}>
<Link to={`/${login}`}>
<Img>
{ url && <img src={url} alt=""/> }
<span>{name}</span>

View File

@ -385,16 +385,16 @@ class NewHeader extends Component {
if (new_link && (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1)) {
if (user_login) {
if (new_link.indexOf("courses") > -1) {
new_link = new_link.replace(/courses/g, "users/" + user_login + "/courses")
new_link = new_link.replace(/courses/g, user_login + "/courses")
} else if (new_link.indexOf("contests") > -1) {
new_link = new_link.replace(/contests/g, "users/" + user_login + "/contests")
new_link = new_link.replace(/contests/g, user_login + "/contests")
}
} else {
is_hidden = true
}
}
if (user_login && (new_link && new_link.indexOf("homes") > -1)) {
new_link = new_link.replace(/homes/g, "users/" + user_login + "/user_activities")
new_link = new_link.replace(/homes/g, user_login + "/user_activities")
}
var waiLian = (new_link && str.filter(item=>new_link.indexOf(item)>-1) );
@ -442,7 +442,7 @@ class NewHeader extends Component {
</span>
:
<Dropdown placement={`bottomRight`} overlay={this.renderMenu(settings && settings.personal)}>
<a href={`/users/${this.props.current_user && this.props.current_user.login}`}>
<a href={`/${this.props.current_user && this.props.current_user.login}`}>
<img alt="头像" src={getImageUrl(`/${user.image_url}`)} className="currentImg"></img>
</a>
</Dropdown>

View File

@ -147,7 +147,7 @@ class CoderRootCommit extends Component{
<p className="f-wrap-alignCenter mt15">
{
item.id ?
<Link to={`/users/${item.login}`} className="show-user-link">
<Link to={`/${item.login}`} className="show-user-link">
{item.image_url?<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
</Link>:

View File

@ -413,11 +413,10 @@ class Detail extends Component {
}
textFunc = (forked_from_project_id,fork_info)=>{
let type = fork_info && fork_info.fork_project_user_type;
return forked_from_project_id && fork_info ?
<div className="color-grey-9 df">
<span>复刻自</span>
<Link to={`${type ==="Organization" ? '':'/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
<Link to={`/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
<span> / </span>
<Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{maxWidth:"400px"}} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
</div> : ""
@ -453,7 +452,7 @@ class Detail extends Component {
<AlignTop>
<div className="projectallName">
{project && project.author &&
<Link to={`${project.author.type ==="Organization" ? '':'/users'}/${project.author.login}`}>{project.author.name}</Link>
<Link to={`/${project.author.login}`}>{project.author.name}</Link>
}
<span className="ml5 mr5">/</span>
<Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>

View File

@ -28,7 +28,7 @@ class IndexItem extends Component {
<img className="p-r-photo" alt="" src={item.author && item.author.image_url} ></img>
</a>
:
<Link to={item.author && (item.author.type === "Organization" ? `/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
<Link to={item.author && item.author.login} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
</Link>
}

View File

@ -52,7 +52,7 @@ function Contribute(props){
<AlignCenter>
<img alt="" style={{borderRadius:"50%",marginRight:"10px"}} src={getImageUrl(`/${item.image_url}`)} width="50px" height="50px"/>
<div>
<Link to={`/users/${item.login}`} className="font-16">{item.name}</Link>
<Link to={`/${item.login}`} className="font-16">{item.name}</Link>
<p className="font-12 color-grey-9">提交{item.contributions}</p>
</div>
</AlignCenter>

View File

@ -78,7 +78,7 @@ class MergeItem extends Component {
</p>
<p className="grid-item font-13">
<Link
to={`/users/${item && item.author_login}`}
to={`/${item && item.author_login}`}
className="show-user-link"
>
<img
@ -91,7 +91,7 @@ class MergeItem extends Component {
</Link>
<AlignCenter>
<Link
to={`/users/${item && item.author_login}`}
to={`/${item && item.author_login}`}
className="show-user-link color-grey-8 ml5"
>
{item && item.author_name}
@ -156,7 +156,7 @@ class MergeItem extends Component {
<li>
{item.assign_user_name ? (
<Link
to={`/users/${item.assign_user_login}`}
to={`/${item.assign_user_login}`}
className="show-user-link"
>
{item.assign_user_name}

View File

@ -100,7 +100,7 @@ class MergeSubmit extends Component{
width:"10%",
render: (text,item) => (
<span className="f-wrap-alignCenter">
<Link to={`/users/${item.login}`} className="show-user-link">
<Link to={`/${item.login}`} className="show-user-link">
<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
<label className="hide-1" style={{maxWidth:"75px",'vertical-align':'middle'}}>{text}</label>
</Link>

View File

@ -386,14 +386,14 @@ class MessageCount extends Component {
}
<div className="mt15">
<Link to={`/users/${data.issue.author_login}`} className="show-user-link">
<Link to={`/${data.issue.author_login}`} className="show-user-link">
<img className="mr5" src={getImageUrl(`/${data.issue.author_picture}`)}
alt="" width="24" height="24" style={{borderRadius:"50%"}}
/>
</Link>
<span className="ver-middle">
<span className="color-grey-8 mr5"></span>
<Link to={`/users/${data.issue.author_login}`} className="show-user-link color-blue">
<Link to={`/${data.issue.author_login}`} className="show-user-link color-blue">
{data.issue.author_name}
</Link>
<span className="ml5 color-grey-8">
@ -408,7 +408,7 @@ class MessageCount extends Component {
<span className="color-grey-8">审查人员</span>
{data.issue.assign_user_name ? (
<Link
to={`/users/${data.issue.assign_user_login}`}
to={`/${data.issue.assign_user_login}`}
className="show-user-link color-blue"
>
{data.issue.assign_user_name}

View File

@ -150,7 +150,7 @@ class UserSubmitComponent extends Component {
return (
<div>
<span className="df" style={{ alignItems: "center" }}>
<Link to={`/users/${current_user && current_user.login}`} className="show-user-link" >
<Link to={`/${current_user && current_user.login}`} className="show-user-link" >
<img
src={getImageUrl(`/${current_user && current_user.image_url}`)}
alt=""

View File

@ -63,11 +63,11 @@ function Apply(props) {
{
list.map((i,k)=>{
return(
<li>
<Link to={`/users/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<li key={k}>
<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={`/users/${i.user && i.user.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

@ -33,7 +33,7 @@ function Index(props){
useEffect(()=>{
if((username && current_user && (current_user.login !== username))){
props.history.push(`/users/${username}`);
props.history.push(`/${username}`);
}
},[current_user,username])
@ -47,14 +47,14 @@ function Index(props){
useEffect(()=>{
if(pathname && username){
if(pathname === `/users/${username}/notice`){
if(pathname === `/${username}/notice`){
setMenu("notify");
changeNum(user.undo_messages);
}
if(pathname === `/users/${username}/notice/undo`){
if(pathname === `/${username}/notice/undo`){
setMenu("undo");
}
if(pathname === `/users/${username}/notice/apply`){
if(pathname === `/${username}/notice/apply`){
setMenu("apply");
}
}
@ -84,19 +84,19 @@ function Index(props){
<div>
<ul className="noticeMenu">
<li className={menu === "notify" ? "active":""}>
<Link to={`/users/${username}/notice`} onClick={changeNum}>
<Link to={`/${username}/notice`} onClick={changeNum}>
<span>通知</span>
{messagesCount ? <span className="unNum">{messagesCount}</span>:""}
</Link>
</li>
<li className={menu === "undo" ? "active":""}>
<Link to={`/users/${username}/notice/undo`}>
<Link to={`/${username}/notice/undo`}>
<span>接收仓库</span>
{transferCount ? <span className="unNum">{transferCount}</span>:""}
</Link>
</li>
<li className={menu === "apply" ? "active":""}>
<Link to={`/users/${username}/notice/apply`}>
<Link to={`/${username}/notice/apply`}>
<span>成员申请</span>
{applyCount ? <span className="unNum">{applyCount}</span>:""}
</Link>
@ -104,19 +104,19 @@ function Index(props){
</ul>
<Switch>
<Route
path="/users/:username/notice/apply"
path="/:username/notice/apply"
render={(p) => {
return <Apply {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
<Route
path="/users/:username/notice/undo"
path="/:username/notice/undo"
render={(p) => {
return <UndoEvent {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
<Route
path="/users/:username/notice"
path="/:username/notice"
render={(p) => {
return <Notify {...props} {...p} deleteEvent={deleteEvent}/>;
}}

View File

@ -46,9 +46,9 @@ function Notify(props){
case 'canceled':
return <p>取消转移<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库</p>
case 'common':
return <p>正在将<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库转移给<Link to={`/users/${owner && owner.login}`}>{owner && owner.name}</Link></p>
return <p>正在将<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库转移给<Link to={`/${owner && owner.login}`}>{owner && owner.name}</Link></p>
case 'successed':
return <p><Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库成功转移给<Link to={`/users/${owner && owner.login}`}>{owner && owner.name}</Link></p>
return <p><Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库成功转移给<Link to={`/${owner && owner.login}`}>{owner && owner.name}</Link></p>
default:
return <p>拒绝转移<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库</p>
}
@ -81,11 +81,11 @@ function Notify(props){
{
list.map((i,k)=>{
return(
<li>
<Link to={`/users/${i.login}`}><img src={getImageUrl(`/${i.applied_user && i.applied_user.image_url}`)} alt="" className="notifyImg"/></Link>
<li i={k}>
<Link to={`/${i.login}`}><img src={getImageUrl(`/${i.applied_user && i.applied_user.image_url}`)} alt="" className="notifyImg"/></Link>
<div className="notifyFlex">
<p className="notifyInfos">
<Link to={`/users/${i.applied_user && i.applied_user.login}`} className="font-15 mr20">{i.applied_user && i.applied_user.name}</Link>
<Link to={`/${i.applied_user && i.applied_user.login}`} className="font-15 mr20">{i.applied_user && i.applied_user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span>
</p>
{ i.applied_type === "AppliedProject" ? renderApplyStatus(i.status,i.applied):renderStatus(i.status,i.applied)}

View File

@ -68,16 +68,16 @@ function UndoEvent(props){
{
list.map((i,k)=>{
return(
<li>
<Link to={`/users/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<li key={k}>
<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={`/users/${i.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<Link to={`/${i.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span>
</p>
<FlexAJ>
<p className="color-grey-6">请求将仓库<Link to={`/projects/${i.project && i.project.owner && i.project.owner.login}/${i.project && i.project.identifier}`}>{i.project && i.project.name}</Link>
转移给<Link to={`/users/${i.owner && i.owner.login}`}>{i.owner && i.owner.name}</Link>是否接受</p>
转移给<Link to={`/${i.owner && i.owner.login}`}>{i.owner && i.owner.name}</Link>是否接受</p>
{
i.status === "common" &&
<span>

View File

@ -207,7 +207,7 @@ class Detail extends Component {
<div className="background-f boder-4">
<div className="grid-item border-1f pd20 ">
<Link
to={`/users/${data && data.author_login}`}
to={`/${data && data.author_login}`}
className="show-user-link"
>
<img
@ -240,7 +240,7 @@ class Detail extends Component {
<div className="mt10">
<span className="color-grey-9 mr5"></span>
<Link
to={`/users/${data && data.author_login}`}
to={`/${data && data.author_login}`}
className="show-user-link color-blue"
>
{data && data.author_name}

View File

@ -67,7 +67,7 @@ class OrderItem extends Component {
<li>
{
item.author_name ?
<Link to={`/users/${item.author_login}`} className="show-user-link">
<Link to={`/${item.author_login}`} className="show-user-link">
{item.author_name}
</Link>
: "--"
@ -76,7 +76,7 @@ class OrderItem extends Component {
<li>
{
item.assign_user_name ?
<Link to={`/users/${item.assign_user_login}`} className="show-user-link">
<Link to={`/${item.assign_user_login}`} className="show-user-link">
{item.assign_user_name}
</Link>
: "--"

View File

@ -186,7 +186,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
render: (text, item) => (
<span className="f-wrap-alignCenter">
<Link
to={`/users/${item.login}`}
to={`/${item.login}`}
className="show-user-link"
>
<img
@ -204,7 +204,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
title: "用户名",
dataIndex: "name",
render: (text, item) => (
<Link to={`/users/${item.login}`} className="show-user-link">
<Link to={`/${item.login}`} className="show-user-link">
{text}
</Link>
),

View File

@ -351,7 +351,7 @@ class Setting extends Component {
{
is_transfering ?
<span>此仓库正在转移给
{transfer && <Link to={transfer.type="User"?`/users/${transfer.login}`:`/organize/${transfer.login}`}>{transfer.name}</Link>}
{transfer && <Link to={transfer.login}>{transfer.name}</Link>}
请联系对方接收此仓库</span>
:
`将此仓库转移给其他用户或组织`

View File

@ -217,7 +217,7 @@ function Index(props){
data.map((item,key)=>{
return(
<li>
<Link to= {`/users/${item.login}`} className="infoImg"><img src={getImageUrl(`/${item.imageUrl}`)} alt="" /></Link>
<Link to= {`/${item.login}`} className="infoImg"><img src={getImageUrl(`/${item.imageUrl}`)} alt="" /></Link>
<div style={{flex:'1',width:"0"}}>
<FlexAJ>
<AlignCenter>

View File

@ -87,7 +87,7 @@ export default ((props) => {
align: "center",
render: (value, item) => {
return (
<Link to={`/users/${item.user.login}`}>{item.user.name}</Link>
<Link to={`/${item.user.login}`}>{item.user.name}</Link>
)
}
},

View File

@ -56,6 +56,10 @@ export default Form.create()(
})
}
function test(){
history.push(`/test2org`);
}
useEffect(()=>{
setFieldsValue({
visibility:"common"
@ -145,6 +149,7 @@ export default Form.create()(
<p className="mt20">
<Button type="primary" className="mr30" onClick={createOrganize}>创建组织</Button>
<Button className="grey" onClick={()=>{window.history.back(-1)}}>取消</Button>
<Button className="grey" onClick={test}>test</Button>
</p>
</div>
)

View File

@ -72,9 +72,9 @@ function RightBox({ OIdentifier , history , admin }) {
memberData.organization_users.map((item,key)=>{
return(
<div className="teammembers" key={key}>
<Link to={`/users/${item.user && item.user.login}`}><Img src={getImageUrl(`/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
<Link to={`/${item.user && item.user.login}`}><Img src={getImageUrl(`/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
<div>
<Link to={`/users/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
<Link to={`/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
<Align><i className="iconfont icon-shijian color-green mr3 font-13"></i><Span>加入时间{item.created_at}</Span></Align>
</div>
</div>

View File

@ -92,7 +92,7 @@ export default Form.create()(
}).then(result=>{
if(result && result.data){
//
history.push(`/users/${current_user && current_user.login}/organizes`);
history.push(`/${current_user && current_user.login}/organizes`);
}
})
setVisible(false);

View File

@ -64,7 +64,7 @@ export default (({organizeDetail})=>{
width:"5%",
render:(value)=>{
return(
value && <Link to={`/users/${value && value.login}`}><Img src={getImageUrl('/'+value.image_url)}></Img> </Link>
value && <Link to={`/${value && value.login}`}><Img src={getImageUrl('/'+value.image_url)}></Img> </Link>
)
}
},
@ -73,7 +73,7 @@ export default (({organizeDetail})=>{
dataIndex: 'user',
width:"15%",
render:(value,item)=>{
return <Link to={`/users/${value && value.login}`}>{value && value.name}</Link>
return <Link to={`/${value && value.login}`}>{value && value.name}</Link>
}
},
{

View File

@ -86,7 +86,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
{
item.users && item.users.map((i,k)=>{
return(
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
k < count ? <Link to={`/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
:
k === count ?
<Link to={`/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>

View File

@ -83,7 +83,7 @@ class ForkUsers extends Component {
<div className="pbt25 grid-item mlr10 border-b-line">
<div>
<Link
to={`/users/${item.login}`}
to={`/${item.login}`}
className="show-user-link"
>
<img

View File

@ -14,7 +14,7 @@ class UserList extends Component {
<div className="pbt25 grid-item mlr10 border-b-line">
<div>
<a
href={`/users/${item.login}`}
href={`/${item.login}`}
className="show-user-link"
>
<img
@ -27,7 +27,7 @@ class UserList extends Component {
<div className="ml12">
<div>
<Link
to={`/users/${item.login}`}
to={`/${item.login}`}
className="font-16 text-primary task-hide max-w-200"
style={{display:"block"}}
title={item.name}

View File

@ -106,7 +106,7 @@ export default (props) => {
function goUser(login) {
window.location.href = `/users/${login}`;
window.location.href = `/${login}`;
}
//

View File

@ -113,7 +113,7 @@ class children_comments extends Component {
<div className="width100">
<div className="grid-item pb5">
<Link
to={`/users/${item && item.user_login}`}
to={`/${item && item.user_login}`}
className="show-user-link"
>
<img
@ -125,7 +125,7 @@ class children_comments extends Component {
/>
</Link>
<Link
to={`/users/${item && item.user_login}`}
to={`/${item && item.user_login}`}
className="show-user-link color-black ml10 fwb"
>
{item && item.user_name}

View File

@ -77,7 +77,7 @@ class children_journals extends Component {
<div className="width100">
<div className="grid-item pb10">
<Link
to={`/users/${item && item.user_login}`}
to={`/${item && item.user_login}`}
className="show-user-link"
>
<img
@ -91,7 +91,7 @@ class children_journals extends Component {
<span className="grid-item">
<span>
<Link
to={`/users/${item && item.user_login}`}
to={`/${item && item.user_login}`}
className="show-user-link color-blue ml10"
>
{item && item.user_name}

View File

@ -304,7 +304,7 @@ class comments extends Component {
return (
<div className="grid-item-top pb10">
<Link
to={`/users/${current_user && current_user.login}`}
to={`/${current_user && current_user.login}`}
className="show-user-link mr10"
>
<img
@ -370,7 +370,7 @@ class comments extends Component {
<div className="width100">
<div className="pb5">
<Link
to={`/users/${item && item.user_login}`}
to={`/${item && item.user_login}`}
className="show-user-link"
>
<img
@ -382,7 +382,7 @@ class comments extends Component {
/>
</Link>
<Link
to={`/users/${item && item.user_login}`}
to={`/${item && item.user_login}`}
className="show-user-link color-black ml10 fwb"
>
{item && item.user_name}

View File

@ -58,7 +58,7 @@ function ConcentrateProject({userLogin,current}) {
{
list.map((i,k)=>{
return(
<li>
<li key={i.id}>
<Link to={`/projects/${i.author && i.author.login}/${i.identifier}`} className="name">{i.name}</Link>
<p className="task-hide desc">{i.description}</p>
<AlignCenter>

View File

@ -12,9 +12,7 @@ const Infos = Loadable({
});
export default withRouter(
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props)=>{
console.log(props);
return(
<div>
<Switch>
<Route
path="/:username"
@ -23,7 +21,6 @@ export default withRouter(
)}
></Route>
</Switch>
</div>
)
}))))
)

View File

@ -72,22 +72,21 @@ class Infos extends Component {
renderPath=(pathname)=>{
const { username } = this.props.match.params;
console.log(username);
if(pathname === `/users/${username}`){
if(pathname === `/${username}`){
this.setState({menuKey:"0",route_type:undefined});
}else if(pathname === `/users/${username}/statistics`){
}else if(pathname === `/${username}/statistics`){
this.setState({menuKey:"1",route_type:undefined});
}else if(pathname.indexOf(`/users/${username}/projects`)>-1){
}else if(pathname.indexOf(`/${username}/projects`)>-1){
this.setState({menuKey:"2",route_type:undefined});
}else if(pathname.indexOf(`/users/${username}/notice`)>-1){
}else if(pathname.indexOf(`/${username}/notice`)>-1){
this.setState({menuKey:"3",route_type:undefined});
}else if(pathname.indexOf(`/users/${username}/devops`)>-1){
}else if(pathname.indexOf(`/${username}/devops`)>-1){
this.setState({menuKey:"4",route_type:undefined});
}else if(pathname === `/users/${username}/organizes`){
}else if(pathname === `/${username}/organizes`){
this.setState({menuKey:"5",route_type:undefined});
}else if(pathname === `/users/${username}/watchers`){
}else if(pathname === `/${username}/watchers`){
this.setState({menuKey:undefined,route_type:"watchers"});
}else if(pathname === `/users/${username}/fan_users`){
}else if(pathname === `/${username}/fan_users`){
this.setState({menuKey:undefined,route_type:"fan_users"});
}else{
this.setState({menuKey:undefined,route_type:undefined});
@ -147,7 +146,7 @@ class Infos extends Component {
project_type: type ,
route_type: undefined
})
this.props.history.push(`/users/${user && user.login}/devops/${type}`);
this.props.history.push(`/${user && user.login}/devops/${type}`);
}
undo_link = () => {
@ -156,7 +155,7 @@ class Infos extends Component {
route_type: undefined,
project_type:"notice",
},()=>{
this.props.history.push(`/users/${user && user.login}/notice`);
this.props.history.push(`/${user && user.login}/notice`);
this.fetchUser();
})
}
@ -173,7 +172,7 @@ class Infos extends Component {
route_type: undefined,
project_type:"organizes"
})
this.props.history.push(`/users/${user && user.login}/organizes`)
this.props.history.push(`/${user && user.login}/organizes`)
}
resetUser=()=>{
@ -250,7 +249,7 @@ class Infos extends Component {
</div>
<div className="focusBox">
<Link
to={`/users/${user && user.login}/watchers`}
to={`/${user && user.login}/watchers`}
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`}
onClick={() =>this.route_link("watchers")}
>
@ -258,7 +257,7 @@ class Infos extends Component {
<span>{user && user.watching_count}</span>
</Link>
<Link
to={`/users/${user && user.login}/fan_users`}
to={`/${user && user.login}/fan_users`}
onClick={() =>this.route_link("fan_users")}
className={`with50 text-center pull-left ${route_type === "fan_users" ? "text-primary" : ""}`}
>
@ -281,13 +280,13 @@ class Infos extends Component {
<div className="list-right">
{ !route_type && menuKey &&
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu">
<Menu.Item key="0"><Link to={`/users/${user && user.login}`}><i className="iconfont icon-gailan"></i></Link></Menu.Item>
<Menu.Item key="1"><Link to={`/users/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i></Link></Menu.Item>
<Menu.Item key="2"><Link to={`/users/${user && user.login}/projects/common`}><i className="iconfont icon-xiangmu"></i></Link></Menu.Item>
<Menu.Item key="0"><Link to={`/${user && user.login}`}><i className="iconfont icon-gailan"></i></Link></Menu.Item>
<Menu.Item key="1"><Link to={`/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i></Link></Menu.Item>
<Menu.Item key="2"><Link to={`/${user && user.login}/projects/common`}><i className="iconfont icon-xiangmu"></i></Link></Menu.Item>
{
current_user && user && user.login === current_user.login ?
<Menu.Item key="3">
<Link to={`/users/${user && user.login}/notice`}>
<Link to={`/${user && user.login}/notice`}>
<i className="iconfont icon-daibanshixiang"></i>
{undo_events && undo_events >0 ? <span className="menuNum">({undo_events})</span>:""}</Link>
</Menu.Item>
@ -295,11 +294,11 @@ class Infos extends Component {
}
{
current_user && current_user.login && current_user.login === username ?
<Menu.Item key="4"><Link to={`/users/${user && user.login}/devops/CIService`}><i className="iconfont icon-gongzuoliu1"></i>DevOps</Link></Menu.Item>
<Menu.Item key="4"><Link to={`/${user && user.login}/devops/CIService`}><i className="iconfont icon-gongzuoliu1"></i>DevOps</Link></Menu.Item>
:""
}
<Menu.Item key="5">
<Link to={`/users/${user && user.login}/organizes`}>
<Link to={`/${user && user.login}/organizes`}>
<i className="iconfont icon-zuzhi"></i>
{ user && user.user_org_count && user.user_org_count > 0 ? <span className="menuNum">({user.user_org_count})</span>:""}
</Link>
@ -309,68 +308,68 @@ class Infos extends Component {
{user && (
<Switch {...this.props}>
<Route
path="/users/:username/watchers"
path="/:username/watchers"
render={() => {
return <WatchsUser {...this.props} {...this.state} userType="watchers" fetchUser={this.fetchUser}/>;
}}
></Route>
<Route
path="/users/:username/notice"
path="/:username/notice"
render={() => {
return <Notice {...this.props} {...this.state} deleteUndoEvent={this.deleteUndoEvent}/>;
}}
></Route>
<Route
path="/users/:username/fan_users"
path="/:username/fan_users"
render={() => {
return <FanUser {...this.props} {...this.state} userType="fan_users" fetchUser={this.fetchUser}/>;
}}
></Route>
<Route
path="/users/:username/devops/CDService"
path="/:username/devops/CDService"
render={() => {
return <InfosDevOpsCD {...this.props} {...this.state} />;
}}
></Route>
<Route
path="/users/:username/devops/CIService"
path="/:username/devops/CIService"
render={() => {
return <InfosDevOps {...this.props} {...this.state} />;
}}
></Route>
<Route
path="/users/:username/projects/:project_type"
path="/:username/projects/:project_type"
render={() => {
return <InfosUser {...this.props} {...this.state} />;
}}
></Route>
<Route
path="/users/:username/organizes"
path="/:username/organizes"
render={() => {
return <Organize {...this.props} {...this.state} />;
}}
></Route>
<Route
path="/users/:username/info"
path="/:username/info"
render={() => {
return <UpdateInfo {...this.props} {...this.state} resetUser={this.resetUser}/>;
}}
></Route>
<Route
path="/users/:username/password"
path="/:username/password"
render={() => {
return <UpdateInfo {...this.props} {...this.state}/>;
}}
></Route>
<Route
path="/users/:username/statistics"
path="/:username/statistics"
render={(props) => {
return <Statistics {...this.props} {...this.state} />;
}}
></Route>
<Route
path="/users/:username"
path="/:username"
render={(props) => {
return <GeneralView {...this.props} {...this.state} />;
}}

View File

@ -45,7 +45,7 @@ export default Form.create()(
if(result && result.data){
props.showNotification("资料修改成功!")
resetUser && resetUser(result.data);
props.history.push(`/users/${username}`)
props.history.push(`/${username}`)
}
}).catch(error=>{})
}
@ -71,7 +71,7 @@ export default Form.create()(
{getFieldDecorator("real_name",{
rules:[{required:true,message:"请输入姓名"}]
})(
<Input placeholder="请输入您的姓名" maxLength={"20"} style={{width:"400px"}}/>
<Input placeholder="请输入您的姓名" maxLength={20} style={{width:"400px"}}/>
)}
</Form.Item>
<div>
@ -90,7 +90,7 @@ export default Form.create()(
{getFieldDecorator("custom_department",{
rules:[{required:true,message:"请输入单位名称"}]
})(
<Input placeholder="请输入单位名称" maxLength="30" style={{width:"400px"}}/>
<Input placeholder="请输入单位名称" maxLength={30} style={{width:"400px"}}/>
)}
</Form.Item>
<Form.Item label="">
@ -120,13 +120,13 @@ export default Form.create()(
{getFieldDecorator("description",{
rules:[]
})(
<TextArea placeholder="请输入您的自我简介" rows={4} maxLength="140" style={{width:"600px"}}/>
<TextArea placeholder="请输入您的自我简介" rows={4} maxLength={140} style={{width:"600px"}}/>
)}
</Form.Item>
<AlignCenter>
<span className="ant-form-item-label"></span>
<Button type={"primary"} onClick={submit}>提交</Button>
<Button type={"default"} onClick={()=>props.history.push(`/users/${username}`)} className="ml20">取消</Button>
<Button type={"default"} onClick={()=>props.history.push(`/${username}`)} className="ml20">取消</Button>
</AlignCenter>
</Form>
)

View File

@ -12,7 +12,7 @@ function Index(props){
useEffect(()=>{
if((username && current_user && (current_user.login !== username))){
props.history.push(`/users/${username}`);
props.history.push(`/${username}`);
}
},[current_user,username])
@ -20,7 +20,7 @@ function Index(props){
useEffect(()=>{
if(pathname){
if(pathname === `/users/${username}/info`){
if(pathname === `/${username}/info`){
setKey("0");
}else{
setKey("1");
@ -32,8 +32,8 @@ function Index(props){
return(
<div>
<Menu selectedKeys={[key]} mode={'horizontal'} className="infosRightMenu">
<Menu.Item key="0"><Link to={`/users/${username}/info`}>基本资料</Link></Menu.Item>
{/* <Menu.Item key="1"><Link to={`/users/${username}/password`}>密码管理</Link></Menu.Item> */}
<Menu.Item key="0"><Link to={`/${username}/info`}>基本资料</Link></Menu.Item>
{/* <Menu.Item key="1"><Link to={`/${username}/password`}>密码管理</Link></Menu.Item> */}
</Menu>
<div style={{padding:"20px"}}>
{

View File

@ -90,7 +90,7 @@ export default Form.create()(
<AlignCenter style={{marginTop:"20px"}}>
<span className="ant-form-item-label"></span>
<Button type={"primary"} onClick={submit}>提交</Button>
<Button type={"default"} onClick={()=>props.history.push(`/users/${username}`)} className="ml20">取消</Button>
<Button type={"default"} onClick={()=>props.history.push(`/${username}`)} className="ml20">取消</Button>
</AlignCenter>
</Form>
)

View File

@ -150,11 +150,11 @@ function Index(props) {
{
percentData &&
<div className="pBox">
<div class="progress">
<div className="progress">
{
percentData.map((i,k)=>{
return(
<span style={{width: `${i.p}%`, backgroundColor:`${i.color}`}}></span>
<span key={i.name} style={{width: `${i.p}%`, backgroundColor:`${i.color}`}}></span>
)
})
}
@ -163,8 +163,8 @@ function Index(props) {
{
percentData.map((i,k)=>{
return(
<span>
<i class="zero" style={{backgroundColor: `${i.color}`}}></i><span>{i.name}</span>
<span key={i.name}>
<i className="zero" style={{backgroundColor: `${i.color}`}}></i><span>{i.name}</span>
<span>{`${i.p}%`}</span>
</span>
)

View File

@ -91,7 +91,7 @@ class CommonList extends Component {
<Spin spinning={isSpin}>
<div className="minH-670">
<div className="grid-item pb20 bbt">
<h3 style={{marginBottom:"0px"}}><Link to={`/users/${login}`} ><i className="iconfont icon-zuojiantou color-grey-9 font-16 mr8"></i></Link>{userType === "watch_users" ? `${title_type}` : `${title_type}`}</h3>
<h3 style={{marginBottom:"0px"}}><Link to={`/${login}`} ><i className="iconfont icon-zuojiantou color-grey-9 font-16 mr8"></i></Link>{userType === "watch_users" ? `${title_type}` : `${title_type}`}</h3>
<div className="text-right">
<Search
placeholder="输入名称进行搜索"

View File

@ -2,7 +2,7 @@ import './public-path'
import { AppContainer } from 'react-hot-loader';
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, Route } from 'react-router-dom'
import './index.css';
import App from './App';
import { configureUrlQuery } from 'react-url-query';
@ -17,7 +17,10 @@ window.__useKindEditor = false;
const render = (Component) => {
ReactDOM.render(
<AppContainer >
<Component />
{/* <Component /> */}
<BrowserRouter basename='/'>
<Route path={`/`} component={App}></Route>
</BrowserRouter>
</AppContainer>,
document.getElementById('root')
)

View File

@ -74,7 +74,7 @@ class Comments extends Component {
<div key={index} className="childComment" >
<div className="J_Comment_Info clearfix mt3">
<div className="t_info fl">
<a href={`${_origin}/users/${item.user_login}`} className="content-username hide fl">
<a href={`${_origin}/${item.user_login}`} className="content-username hide fl">
{item.username}
</a>
<span className="t_area fl">{item.time}</span>
@ -139,13 +139,13 @@ class Comments extends Component {
if (!comments || comments.length === 0) {
return;
}
// "https://www.educoder.net/users/m02945638"
// "https://www.educoder.net/m02945638"
let commentsElement = comments.map((item, index) => {
return (
<div className="comment_item_cont df clearfix" key={index}>
<div className="J_Comment_Face fl">
<a href={`${_origin}/users/${item.user_login}`} target="_blank">
<a href={`${_origin}/${item.user_login}`} target="_blank">
<img alt="用户头像" height="50" src={getImageUrl(`images/${item.image_url}`)} width="50" />
</a>
</div>
@ -155,7 +155,7 @@ class Comments extends Component {
<div className="comment_orig_content" style={{ margin: "0px" }}>
<div className="J_Comment_Info clearfix mt3">
<div className="t_info fl">
<a href={`${_origin}/users/${item.user_login}`} className="content-username hide fl">
<a href={`${_origin}/${item.user_login}`} className="content-username hide fl">
{item.username}
</a>
<span className="t_area fl">{item.time}</span>

View File

@ -71,7 +71,7 @@ export function commentHOC(WrappedComponent) {
image_url: "avatar/User/36497"
login: "p24891375"
name: "杨俊男"
user_url: "/users/p24891375"
user_url: "/p24891375"
*/
handleComments(comments, responseData) {
comments.forEach(element => {

View File

@ -188,7 +188,7 @@ class CCommentItem extends Component {
<img alt="用户头像" height="50"
src={`${getUrl()}/images/edu_user/anony.png`} width="50" />
</a>
: <a href={`${_origin}/users/${item.user_info.user_login}`} target="_blank">
: <a href={`${_origin}/${item.user_info.user_login}`} target="_blank">
<img alt="用户头像" height="50"
src={`${getImageUrl(`images/` + imgSrc)}`}
width="50" />
@ -204,7 +204,7 @@ class CCommentItem extends Component {
<a className="content-username hide fl">
{item.user_info.user_name}
</a>
: <a href={`${_origin}/users/${item.user_info.user_login}`} className="content-username hide fl">
: <a href={`${_origin}/${item.user_info.user_login}`} className="content-username hide fl">
{item.user_info.user_name}
</a>}
@ -275,7 +275,7 @@ class CCommentItem extends Component {
<img alt="用户头像" height="50"
src={`${getUrl()}/images/edu_user/anony.png`} width="50" />
</a>
: <a href={`${_origin}/users/${item.user_login}`} target="_blank">
: <a href={`${_origin}/${item.user_login}`} target="_blank">
<img alt="用户头像" height="50"
src={`${getUrl()}/images/${item.image_url}`}
width="50" />
@ -292,7 +292,7 @@ class CCommentItem extends Component {
{item.username}{item.comment_role}
</a>
:
<a href={`${_origin}/users/${item.user_login}`} className="content-username hide fl">
<a href={`${_origin}/${item.user_login}`} className="content-username hide fl">
{item.username}{item.comment_role}
</a>
}

View File

@ -37,7 +37,7 @@ class CommonReply extends Component {
}
_getUser() {
const { current_user } = this.props;
current_user.user_url = `/users/${current_user.login}`;
current_user.user_url = `/${current_user.login}`;
return current_user;
}
_findById = _findById

View File

@ -84,7 +84,7 @@ class CompetitionContents extends Component{
dataIndex: 'userimg',
key: 'userimg',
render: (text, record) =>(
<a href={`/users/${record.user_login}`} target={"_blank"} className="color-dark">
<a href={`/${record.user_login}`} target={"_blank"} className="color-dark">
<div className={"relativef"}>
<img className={"Competitionuserimg mb10"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/>
<div className={"competimgabsoluteijmg"}><Badge count={record.competition_prize} style={{ backgroundColor: '#459BE5' }} title={record.competition_prize}/></div>
@ -212,7 +212,7 @@ class CompetitionContents extends Component{
<li className="pr Competitioncenter">
<img src={getImageUrl("images/educoder/huangguan-two.png")}/>
<div className={"mt10"}>
<a href={`/users/${item.user_login}`} target={"_blank"} className="color-dark ">
<a href={`/${item.user_login}`} target={"_blank"} className="color-dark ">
<div className={"relativef"}>
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<div className={"competimgabsolute"}><Badge count={item.competition_prize} style={{ backgroundColor: '#459BE5' }} title={item.competition_prize}/></div>
@ -251,7 +251,7 @@ class CompetitionContents extends Component{
<li className="pr Competitioncenter">
<img src={getImageUrl("/images/educoder/huangguan.png")}/>
<div className={"mt10"}>
<a href={`/users/${item.user_login}`} target={"_blank"} className="color-dark">
<a href={`/${item.user_login}`} target={"_blank"} className="color-dark">
<div className={"relativef"}>
<img className={"rankingimg"} src={getImageUrl(`/images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<div className={"competimgabsolute"}><Badge count={item.competition_prize} style={{ backgroundColor: '#459BE5' }} title={item.competition_prize}/></div>
@ -290,7 +290,7 @@ class CompetitionContents extends Component{
<li className=" pr Competitioncenter ">
<img src={getImageUrl("images/educoder/huangguan-three.png")}/>
<div className={"mt10"}>
<a href={`/users/${item.user_login}`} target={"_blank"} className="color-dark">
<a href={`/${item.user_login}`} target={"_blank"} className="color-dark">
<div className={"relativef"}>
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<div className={"competimgabsolute"}><Badge count={item.competition_prize} style={{ backgroundColor: '#459BE5' }} title={item.competition_prize}/></div>

View File

@ -360,7 +360,7 @@ class CoursesBanner extends Component {
var url = `/courses/${id}/exit_course.json`;
axios.post(url).then((response) => {
if (response.data.status === 0) {
window.location.href = "/users/" + this.props.current_user.login;
window.location.href = "/" + this.props.current_user.login;
}
})
}
@ -543,11 +543,11 @@ class CoursesBanner extends Component {
<div className="clearfix ">
<div className="flex-container mr40 mb20" >
<a href={"/users/" + coursedata.teacher_login} >
<a href={"/" + coursedata.teacher_login} >
<img alt="头像" className="radius mt3 bannerimgname"
src={getImageUrl(`images/` + coursedata.teacher_img)} />
</a>
<a href={"/users/" + coursedata.teacher_login} className="mt13 color-white bannnerusername mt13">{coursedata.teacher_name}</a>
<a href={"/" + coursedata.teacher_login} className="mt13 color-white bannnerusername mt13">{coursedata.teacher_name}</a>
<p className="mt13 color-white bannnerusernames">{coursedata.teacher_school}</p>
</div>

View File

@ -414,7 +414,7 @@ class ShixunhomeWorkItem extends Component{
<div className="cl"></div>
<p className="color-grey mt15 fl" style={{"width":"820px"}}>
<span >
{/* <a href="/users/innov" className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a> */}
{/* <a href="/innov" className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a> */}
{ discussMessage.author && <span className="mr15 color-grey-3">{discussMessage.author}</span> }
{discussMessage.commit_count===undefined?"":<span className="mr15 color-grey9">已开始做题 {discussMessage.commit_count}</span>}
{discussMessage.uncommit_count===undefined?"":<span className="mr15 color-grey9">未开始做题 {discussMessage.uncommit_count}</span>}

View File

@ -161,7 +161,7 @@ class Home extends React.Component {
{
managers && managers.map((manager) => {
return (
<Link to={`/users/${manager.login}`} key={manager.id} className="ec-school-manager-item">
<Link to={`/${manager.login}`} key={manager.id} className="ec-school-manager-item">
<Avatar size={48} src={getImageUrl(`images/${manager.image_url}`)} alt="头像"/>
<Tooltip title={manager.name} placement="bottom">
<span className="ec-school-manager-name">{ manager.name }</span>

View File

@ -34,7 +34,7 @@ class Leftdialogue extends Component{
this.props.DELETEsetreplyfun(user_id,id);
}
myCome=(e)=>{
window.location.href="/users/"+e.login;
window.location.href="/"+e.login;
}
render() {

View File

@ -272,13 +272,13 @@ class MessagSub extends Component {
return window.open(`/forums/`);
case "Watcher" :
// 用户个人中心页 :id = item.trigger_user.login
return window.open(`/users/${item.trigger_user.login}/classrooms`)
return window.open(`/${item.trigger_user.login}/classrooms`)
case "PraiseTread" :
// 这块太复杂 不好处理
return '';
case "Grade" :
//个人中心页 :id = item.trigger_user.login
// return window.open(`/users/${item.trigger_user.login}/classrooms`;
// return window.open(`/${item.trigger_user.login}/classrooms`;
return "";
case "JoinProject" :
//项目详情-申请加入项目审核页 :id = container_id
@ -484,7 +484,7 @@ class MessagSub extends Component {
if (item.tiding_type === "Apply") {
return window.open(`/admins/video_applies`);
} else if (item.tiding_type === "System") {
return window.open(`/users/${this.props.current_user.login}/videos`);
return window.open(`/${this.props.current_user.login}/videos`);
}
return '';
case "PublicCourseStart":

View File

@ -140,7 +140,7 @@ class MessagePrivate extends Component{
this.props.Modifyur(i,id);
};
myCome=(e)=>{
window.location.href="/users/"+e.target.login;
window.location.href="/"+e.target.login;
}
render() {
let{page,limit,typeysl,count,isSpin,data,modalsType}=this.state;

View File

@ -133,7 +133,7 @@ class Messagerouting extends Component{
};
myCome=(e)=>{
window.location.href="/users/"+e.target.login;
window.location.href="/"+e.target.login;
}
myxiaoxisixintab=(i)=>{

View File

@ -36,7 +36,7 @@ class Rightdialogue extends Component{
this.props.DELETEsetreplyfun(user_id,id);
}
myCome=(e)=>{
window.location.href="/users/"+e.login;
window.location.href="/"+e.login;
}
render() {

View File

@ -37,10 +37,10 @@ class LeftNav extends Component {
<div className="page--leftnav">
<div className="user-info">
<a href="/users/p69243850" alt="用户头像" className="user-info-img">
<a href="/p69243850" alt="用户头像" className="user-info-img">
<img alt="0?1442652658" height="50" src="/images/avatars/User/0?1442652658" width="50"/>
</a>
<a href="/users/p69243850" className="user-info-name">Jimmy</a>
<a href="/p69243850" className="user-info-name">Jimmy</a>
</div>
<div className="leftnav">
<ul>

View File

@ -724,16 +724,16 @@ class NewHeader extends Component {
if (new_link && (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1)) {
if (user_login) {
if (new_link.indexOf("courses") > -1) {
new_link = new_link.replace(/courses/g, "users/" + user_login + "/courses")
new_link = new_link.replace(/courses/g, user_login + "/courses")
} else if (new_link.indexOf("contests") > -1) {
new_link = new_link.replace(/contests/g, "users/" + user_login + "/contests")
new_link = new_link.replace(/contests/g, user_login + "/contests")
}
} else {
is_hidden = true
}
}
if (user_login && (new_link && new_link.indexOf("homes") > -1)) {
new_link = new_link.replace(/homes/g, "users/" + user_login + "/user_activities")
new_link = new_link.replace(/homes/g, user_login + "/user_activities")
}
var waiLian = (new_link && str.filter(item=>new_link.indexOf(item)>-1) );
@ -826,7 +826,7 @@ class NewHeader extends Component {
</span>
:
<div className="ml30 edu-menu-panel" style={{ height: "70px", lineHeight: "70px" }}>
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>
<a href={`/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>
<img alt="头像" className="radius" height="34" id="nh_user_logo" name="avatar_image"
src={getImageUrl(`images/` + user.image_url)} width="34">
</img>

View File

@ -154,7 +154,7 @@ export function TPMIndexHOC(WrappedComponent) {
tpmLoading: false
})
if (this.props.match.path === "/" && response.data.login) {
this.props.history.push(`/users/${response.data.login}`);
this.props.history.push(`/${response.data.login}`);
}
if(response.data && response.data.login){
if(response.data.need_edit_info){

View File

@ -62,7 +62,7 @@ class TPMRightSection extends Component {
<p className="font-16 mb20"><i className={"iconfont icon-chuangjianzhe1 audit_situationactive font-14"}></i> </p>
<div className="df">
<a
href={TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : `/users/${TPMRightSectionData.creator.login}/classrooms`}>
href={TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : `/${TPMRightSectionData.creator.login}/classrooms`}>
<img alt="头像" className="radius mr10" height="36"
src={getImageUrl(TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : 'images/' + TPMRightSectionData.creator.image_url + "?1532489442")}
width="36" />

View File

@ -139,7 +139,7 @@ class ShixunDiscuss extends Component {
<div className="commentItemMDEditorView commentItemMDEditorView_4220" style={{display:'none'}}>
<div className="homepagePostReplyPortrait mr15 fl imageFuzzy" id="reply_image_3097" style={{marginTop: '28px', marginRight: '0px'}}>
<a href="/users/innov" target="_blank" alt="用户头像">
<a href="/innov" target="_blank" alt="用户头像">
<img alt="0?1442652658" height="33" src="/images/avatars/User/1" width="33"/>
</a>
</div>

View File

@ -239,63 +239,63 @@ class Infos extends Component {
{/* --------------------------------------------------------------------- */}
{/* 题库 */}
<Route exact path="/users/:username/topics/:topicstype"
<Route exact path="/:username/topics/:topicstype"
render={
(props) => (<InfosTopics {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route>
{/* 课堂 */}
<Route exact path="/users/:username/classrooms"
<Route exact path="/:username/classrooms"
render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route>
{/* 实训项目 */}
<Route exact path="/users/:username/shixuns"
<Route exact path="/:username/shixuns"
render={
(props) => (<InfosShixun {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route>
{/* 实践课程 */}
<Route exact path="/users/:username/paths"
<Route exact path="/:username/paths"
render={
(props) => (<InfosPath {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route>
{/* 开发项目 */}
{/* <Route exact path="/users/:username/projects"
{/* <Route exact path="/:username/projects"
render={
(props) => (<InfosProject {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route> */}
<Route exact path="/users/:username/projects"
<Route exact path="/:username/projects"
render={
(props) => (<UserProjects {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
{/* 众包 */}
<Route exact path="/users/:username/package"
<Route exact path="/:username/package"
render={
(props) => (<InfosPackage {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route>
{/* 视频 */}
<Route exact path="/users/:username/videos"
<Route exact path="/:username/videos"
render={
(props) => (<InfosVideo {...this.props} {...props} {...this.state} {..._commonProps} />)
}
></Route>
<Route exact path="/users/:username"
<Route exact path="/:username"
render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} {..._commonProps} />)
}

View File

@ -139,22 +139,22 @@ class InfosBanner extends Component{
{/*{coursestypes===true?"":<li className={`${moduleName == 'courses' ||moduleName == undefined ? 'active' : '' }`}>*/}
{/*<Link*/}
{/*onClick={() => this.setState({moduleName: 'courses'})}*/}
{/*to={`/users/${username}/courses`}>翻转课堂</Link>*/}
{/*to={`/${username}/courses`}>翻转课堂</Link>*/}
{/*</li>}*/}
{/*{shixuntype===true?"":<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>*/}
{/*<Link*/}
{/*onClick={() => this.setState({moduleName: 'shixuns'})}*/}
{/*to={`/users/${username}/shixuns`}>实训项目</Link>*/}
{/*to={`/${username}/shixuns`}>实训项目</Link>*/}
{/*</li>}*/}
{/*{pathstype===true?"":<li className={`${moduleName == 'paths' ? 'active' : '' }`}>*/}
{/*<Link */}
{/*onClick={() => this.setState({moduleName: 'paths'})}*/}
{/*to={`/users/${username}/paths`}>实践课程</Link>*/}
{/*to={`/${username}/paths`}>实践课程</Link>*/}
{/*</li>}*/}
<li className={`${moduleName === 'projects' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'projects'})}
to={`/users/${username}`}>开发项目</Link>
to={`/${username}`}>开发项目</Link>
</li>

View File

@ -29,22 +29,22 @@ class InfosIndex extends Component {
return (
<Switch {...this.props}>
{/* 视频发布 */}
<Route exact path="/users/:username/videos/upload"
<Route exact path="/:username/videos/upload"
render={
(props) => (<VideoUploadList {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/users/:username/videos/success"
<Route exact path="/:username/videos/success"
render={
(props) => (<VideoPublishSuccess {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/users/:username/videos/protocol"
<Route exact path="/:username/videos/protocol"
render={
(props) => (<VideoProtocol {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/users/:username"
<Route path="/:username"
render={
(props) => (<UsersInfo {...this.props} {...props} {...this.state} />)
}

View File

@ -427,7 +427,7 @@ class InfosTopics extends Component{
<div className="clearfix topicsbox">
{types==="publicly"?<div className={"topcschild"}>
<a className={types==="personal"?"topicstopfont fr ":"topicstopfont fr topcsactive"}
href={`/users/${this.props.current_user&&this.props.current_user.login}/topics/personal`}>我的题库</a>
href={`/${this.props.current_user&&this.props.current_user.login}/topics/personal`}>我的题库</a>
<div className={types==="publicly"?"topicstopfont fl ":"topicstopfont fl topcsactive"}
>公共题库</div>
</div>:<div className={"topcschild"}>

View File

@ -127,7 +127,7 @@ class BanksIndex extends Component{
{
crumbData &&
<Breadcrumb separator=">" className="breadcrumb mt22">
<Breadcrumb.Item href={crumbData && crumbData.is_public == true ?`/topicbank/publicly`:`/users/${this.props.current_user && this.props.current_user.login}/topics/personal`}>{ crumbData && crumbData.is_public == true ? '公共' : '我的' }题库</Breadcrumb.Item>
<Breadcrumb.Item href={crumbData && crumbData.is_public == true ?`/topicbank/publicly`:`/${this.props.current_user && this.props.current_user.login}/topics/personal`}>{ crumbData && crumbData.is_public == true ? '公共' : '我的' }题库</Breadcrumb.Item>
{
crumbData.crumbArray && crumbData.crumbArray.map((item,key)=>{
return(

View File

@ -97,7 +97,7 @@ class BanksMenu extends Component{
if(response.data){
if(response.data.status===0){
this.props.showNotification(response.data.message)
window.location.href=`/users/${this.props.current_user.login}/topics/personal`;
window.location.href=`/${this.props.current_user.login}/topics/personal`;
}else{
this.props.showNotification(response.data.message)
}

View File

@ -153,28 +153,28 @@ class banner_out extends Component {
<li className={`${moduleName == 'classrooms' || moduleName == undefined ? 'active' : ''}`}>
<Link
onClick={() => this.setState({ moduleName: 'classrooms' })}
to={`/users/${username}/classrooms`}>课堂</Link>
to={`/${username}/classrooms`}>课堂</Link>
</li>
<li className={`${moduleName == 'shixuns' ? 'active' : ''}`}>
<Link
onClick={() => this.setState({ moduleName: 'shixuns' })}
to={`/users/${username}/shixuns`}>实训</Link>
to={`/${username}/shixuns`}>实训</Link>
</li>
<li className={`${moduleName == 'paths' ? 'active' : ''}`}>
<Link
onClick={() => this.setState({ moduleName: 'paths' })}
to={`/users/${username}/paths`}>实践课程</Link>
to={`/${username}/paths`}>实践课程</Link>
</li>
<li className={`${moduleName == 'projects' ? 'active' : ''}`}>
<Link
onClick={() => this.setState({ moduleName: 'projects' })}
to={`/users/${username}`}>开发项目</Link>
to={`/${username}`}>开发项目</Link>
</li>
<li className={`${moduleName == 'package' ? 'active' : ''}`}>
<Link
onClick={() => this.setState({ moduleName: 'package' })}
to={`/users/${username}/package`}>众包</Link>
to={`/${username}/package`}>众包</Link>
</li>
{/*{ data && data.identity!="学生" && <li> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}?type=m_bank`}>题库</a></li>}*/}

View File

@ -20,16 +20,16 @@ function EditVideoModal (props) {
}
function toList() {
history.push(`/users/${username}/videos`)
history.push(`/${username}/videos`)
}
function toUpload() {
history.push(`/users/${username}/videos/upload`)
history.push(`/${username}/videos/upload`)
}
function onOk() {
form.validateFieldsAndScroll((err, values) => {
if (!err) {
const url = link?`/course_videos/${videoId}.json`:`/users/${username}/videos/${videoId}.json`;
const url = link?`/course_videos/${videoId}.json`:`/${username}/videos/${videoId}.json`;
axios.put(url, link ? {
name:_title,

View File

@ -72,7 +72,7 @@ function InfoVideo(props) {
function toUpload() {
if (props.current_user.admin || (props.current_user.is_teacher && props.checkIfProfessionalCertification())) {
history.push(`/users/${username}/videos/upload`)
history.push(`/${username}/videos/upload`)
} else {
props.showProfessionalCertificationDialog()
}

View File

@ -42,10 +42,10 @@ function VideoInReviewItem (props) {
const username = props.match.params.username
function toList() {
history.push(`/users/${username}/videos`)
history.push(`/${username}/videos`)
}
function toUpload() {
history.push(`/users/${username}/videos/upload`)
history.push(`/${username}/videos/upload`)
}
const imgUrl = (!transcoded && !link) ? defaultImg : (cover_url || defaultImg);
return (

View File

@ -10,10 +10,10 @@ function VideoUpload (props) {
const username = props.match.params.username
function toList() {
history.push(`/users/${username}/videos`)
history.push(`/${username}/videos`)
}
function toUpload() {
history.push(`/users/${username}/videos/upload`)
history.push(`/${username}/videos/upload`)
}
return (

View File

@ -254,7 +254,7 @@ function VideoUploadList(props) {
if (flag) {
successFunc(false)
} else {
history.push(`/users/${username}/videos/success`)
history.push(`/${username}/videos/success`)
}
}
}
@ -269,9 +269,9 @@ function VideoUploadList(props) {
const { flag, CourseId } = props;
const urls =
flag ?
<Link to={`/users/${username}/videos/protocol?course=${CourseId}`} target="_blank" style={{ color: theme.foreground_select }}>上传内容协议</Link>
<Link to={`/${username}/videos/protocol?course=${CourseId}`} target="_blank" style={{ color: theme.foreground_select }}>上传内容协议</Link>
:
<Link to={`/users/${username}/videos/protocol`} style={{ color: theme.foreground_select }}>上传内容协议</Link>
<Link to={`/${username}/videos/protocol`} style={{ color: theme.foreground_select }}>上传内容协议</Link>
const protocolLine = <div>上传视频即表示您已同意{urls}不得上传未经他人授权的作品</div>
return (
<div className={flag ? "edu-back-white pb100 videoUploadList" : "educontent videoUploadList"} style={{ marginBottom: `${flag ? "0px" : "200px"}` }}>