forked from Gitlink/forgeplus-react
get user
This commit is contained in:
parent
f87c60d2ef
commit
17d0e3c1a2
|
@ -39,7 +39,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 || 'admin'
|
||||
window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || ''
|
||||
}
|
||||
// 超管
|
||||
// debugType="admin";
|
||||
|
|
|
@ -33,14 +33,8 @@ const ProjectDetail = Loadable({
|
|||
})
|
||||
|
||||
class Index extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
}
|
||||
|
||||
|
||||
|
||||
render(){
|
||||
console.log("123",this.props);
|
||||
return(
|
||||
<div className="newMain clearfix">
|
||||
<Switch {...this.props}>
|
||||
|
|
|
@ -138,7 +138,7 @@ class Detail extends Component{
|
|||
forked_count:undefined,
|
||||
http_url: undefined,
|
||||
author:undefined,
|
||||
current_user:undefined,
|
||||
// current_user:undefined,
|
||||
|
||||
branchs:undefined,
|
||||
branchList:undefined,
|
||||
|
@ -161,15 +161,10 @@ class Detail extends Component{
|
|||
|
||||
|
||||
componentDidMount=()=>{
|
||||
this.getUserInfo();
|
||||
// this.getUserInfo();
|
||||
this.getDetail();
|
||||
}
|
||||
|
||||
// componentDidUpdate=(provState)=>{
|
||||
// if(provState.match.params.projectsId !== this.props.match.params.projectsId){
|
||||
// this.getDetail();
|
||||
// }
|
||||
// }
|
||||
|
||||
getDetail=()=>{
|
||||
const { projectsId } = this.props.match.params;
|
||||
|
@ -274,7 +269,6 @@ class Detail extends Component{
|
|||
branchList:result.data,
|
||||
branchs,
|
||||
branchLastCommit:result.data[0],
|
||||
// http_url:result.data[0].http_url
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{})
|
||||
|
@ -282,14 +276,16 @@ class Detail extends Component{
|
|||
|
||||
render(){
|
||||
|
||||
const { projectDetail , watchers_count , praises_count , forked_count , project_id , current_user } = this.state;
|
||||
const { projectDetail , watchers_count , praises_count , forked_count } = this.state;
|
||||
const url = this.props.history.location.pathname;
|
||||
const urlArr= url.split("/");
|
||||
const urlFlag = (urlArr.length === 3);
|
||||
const { isManager , isDeveloper } = this.props;
|
||||
|
||||
const { isManager } = this.props;
|
||||
const { projectsId } = this.props.match.params;
|
||||
|
||||
const { state } = this.props.history.location;
|
||||
|
||||
return(
|
||||
<div>
|
||||
<div className="detailHeader-wrapper">
|
||||
|
@ -344,55 +340,55 @@ class Detail extends Component{
|
|||
{/* 新建文件 */}
|
||||
<Route path="/projects/:projectsId/coders/:branch/newfile/:path"
|
||||
render={
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders/:branch/newfile"
|
||||
render={
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 标签列表 */}
|
||||
<Route path="/projects/:projectsId/orders/tags"
|
||||
render={
|
||||
(props) => (<TagList {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<TagList {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 仓库设置 */}
|
||||
<Route path="/projects/:projectsId/setting"
|
||||
render={
|
||||
(props) => (<Setting {...this.props} {...props} {...this.state} getDetail={this.getDetail} current_user={current_user}/>)
|
||||
(props) => (<Setting {...this.props} {...props} {...this.state} getDetail={this.getDetail}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 工单详情 */}
|
||||
<Route path="/projects/:projectsId/orders/:orderId/detail"
|
||||
render={
|
||||
(props) => (<OrderDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrderDetail {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 里程碑 */}
|
||||
<Route path="/projects/:projectsId/orders/Milepost"
|
||||
render={
|
||||
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrderMilepost {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 新建里程碑 */}
|
||||
<Route path="/projects/:projectsId/orders/meilpost"
|
||||
render={
|
||||
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
{/*里程碑详情*/ }
|
||||
<Route path="/projects/:projectsId/orders/:meilid/MilepostDetail"
|
||||
render={
|
||||
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<MilepostDetail {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
{/*修改里程碑*/}
|
||||
<Route path="/projects/:projectsId/orders/:meilid/meilpost"
|
||||
render={
|
||||
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
@ -401,28 +397,28 @@ class Detail extends Component{
|
|||
|
||||
<Route path="/projects/:projectsId/orders/new"
|
||||
render={
|
||||
(props) => (<OrderNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrderNew {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 修改详情 */}
|
||||
<Route path="/projects/:projectsId/orders/:orderId/updatedetail"
|
||||
render={
|
||||
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 复制详情 */}
|
||||
<Route path="/projects/:projectsId/orders/:orderId/copyetail"
|
||||
render={
|
||||
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 动态 */}
|
||||
<Route path="/projects/:projectsId/trends"
|
||||
render={
|
||||
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<TrendsIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
@ -430,66 +426,66 @@ class Detail extends Component{
|
|||
{/* 代码Index */}
|
||||
<Route path="/projects/:projectsId/orders"
|
||||
render={
|
||||
(props) => (<OrderIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<OrderIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/merge/new"
|
||||
render={
|
||||
(props) => (<CreateMerge {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<CreateMerge {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/merge/:mergeId/UpdateMerge"
|
||||
render={
|
||||
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<UpdateMerge {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/merge/:mergeId/Messagecount"
|
||||
render={
|
||||
(props) => (<MessageCount {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<MessageCount {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/merge/:mergeId/MergeSubmit"
|
||||
render={
|
||||
(props) => (<MergeSubmit {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<MergeSubmit {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/version/new"
|
||||
render={
|
||||
(props) => (<NewVersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<NewVersionIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
||||
<Route path="/projects/:projectsId/version/:versionId/upversion"
|
||||
render={
|
||||
(props) => (<UpVersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<UpVersionIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
||||
<Route path="/projects/:projectsId/version"
|
||||
render={
|
||||
(props) => (<VersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<VersionIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/merge"
|
||||
render={
|
||||
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders"
|
||||
render={
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId"
|
||||
render={
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
@ -177,6 +177,7 @@ class Index extends Component{
|
|||
}
|
||||
|
||||
render(){
|
||||
const { current_user } = this.props;
|
||||
const menu=(
|
||||
<Menu onClick={this.ChangeSoryBy}>
|
||||
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
|
||||
|
@ -200,6 +201,8 @@ class Index extends Component{
|
|||
<Pagination simple defaultCurrent={page} total={total} pageSize={limit} onChange={this.ChangePage}></Pagination>
|
||||
</div>:""
|
||||
)
|
||||
|
||||
|
||||
return(
|
||||
<div style={{background:"#fafafa"}}>
|
||||
<p className="t_project_banner"></p>
|
||||
|
@ -218,12 +221,14 @@ class Index extends Component{
|
|||
<Spin spinning={isSpin}>
|
||||
<div className="list-r-operation">
|
||||
<div>
|
||||
|
||||
<Dropdown overlay={newItem} trigger={["click"]} placement='bottomRight' className="mr30">
|
||||
<a className="ant-dropdown-link">
|
||||
<span className="color-blue font-16"><img src={img_new} alt="" width="13px"/> 新建</span>
|
||||
</a>
|
||||
</Dropdown>
|
||||
{
|
||||
current_user && current_user.login &&
|
||||
<Dropdown overlay={newItem} trigger={["click"]} placement='bottomRight' className="mr30">
|
||||
<a className="ant-dropdown-link">
|
||||
<span className="color-blue font-16"><img src={img_new} alt="" width="13px"/> 新建</span>
|
||||
</a>
|
||||
</Dropdown>
|
||||
}
|
||||
|
||||
<Dropdown overlay={menu} trigger={['click']} placement='bottomRight'>
|
||||
<a className="ant-dropdown-link">
|
||||
|
|
|
@ -23,7 +23,6 @@ class Index extends Component{
|
|||
GitignoreList:undefined,
|
||||
LicensesList:undefined,
|
||||
isSpin:false,
|
||||
current_user:undefined
|
||||
}
|
||||
}
|
||||
getUserInfo=()=>{
|
||||
|
@ -40,7 +39,7 @@ class Index extends Component{
|
|||
})
|
||||
}
|
||||
componentDidMount=()=>{
|
||||
this.getUserInfo();
|
||||
// this.getUserInfo();
|
||||
// 获取项目类别
|
||||
this.getCategory();
|
||||
// 获取项目语言
|
||||
|
@ -116,7 +115,7 @@ class Index extends Component{
|
|||
})
|
||||
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||
if(!err){
|
||||
const { current_user } = this.state;
|
||||
const { current_user } = this.props;
|
||||
const { projectsType } =this.props.match.params;
|
||||
const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json";
|
||||
axios.post(url,{
|
||||
|
@ -129,7 +128,7 @@ class Index extends Component{
|
|||
isSpin:false
|
||||
})
|
||||
this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`);
|
||||
this.props.history.push(`/projects/${result.data.identifier}/${current_user && current_user.login}/coders`);
|
||||
this.props.history.push(`/projects/${result.data.id}/coders`);
|
||||
}
|
||||
}
|
||||
}).catch((error)=>{
|
||||
|
@ -148,7 +147,6 @@ class Index extends Component{
|
|||
|
||||
render(){
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
console.log(this.props);
|
||||
// 项目类型:deposit-托管项目,mirror-镜像项目
|
||||
const { projectsType } =this.props.match.params;
|
||||
const {
|
||||
|
@ -165,6 +163,8 @@ class Index extends Component{
|
|||
LicensesList,
|
||||
isSpin
|
||||
}=this.state;
|
||||
|
||||
console.log("current_user",this.props);
|
||||
return(
|
||||
<div className="main back-white">
|
||||
<div className="newPanel">
|
||||
|
|
|
@ -730,21 +730,18 @@ submittojoinclass=(value)=>{
|
|||
try {
|
||||
var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
|
||||
var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
|
||||
// console.log("NewHeaderNewHeaderNewHeader");
|
||||
// console.log(chromesettingArray);
|
||||
// console.log(chromesettingresponseArray);
|
||||
|
||||
this.setState({
|
||||
mygetHelmetapi2:chromesettingArray
|
||||
});
|
||||
if (chromesettingArray.tab_logo_url) {
|
||||
this.gettablogourldata(chromesettingresponseArray);
|
||||
} else {
|
||||
this.gettablogourlnull();
|
||||
}
|
||||
|
||||
this.setState({
|
||||
mygetHelmetapi2:chromesettingArray
|
||||
});
|
||||
if (chromesettingArray.tab_logo_url) {
|
||||
this.gettablogourldata(chromesettingresponseArray);
|
||||
} else {
|
||||
this.gettablogourlnull();
|
||||
}
|
||||
}catch (e) {
|
||||
console.log("head获取游览器配置失败 重新请求开始读取配置");
|
||||
this.geturlsdata();
|
||||
// console.log("head获取游览器配置失败 重新请求开始读取配置");
|
||||
this.geturlsdata();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue