This commit is contained in:
caicai8 2020-03-24 15:40:22 +08:00
parent f87c60d2ef
commit 17d0e3c1a2
6 changed files with 58 additions and 66 deletions

View File

@ -39,7 +39,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 || 'admin' window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || ''
} }
// 超管 // 超管
// debugType="admin"; // debugType="admin";

View File

@ -33,14 +33,8 @@ const ProjectDetail = Loadable({
}) })
class Index extends Component{ class Index extends Component{
constructor(props){
super(props);
}
render(){ render(){
console.log("123",this.props);
return( return(
<div className="newMain clearfix"> <div className="newMain clearfix">
<Switch {...this.props}> <Switch {...this.props}>

View File

@ -138,7 +138,7 @@ class Detail extends Component{
forked_count:undefined, forked_count:undefined,
http_url: undefined, http_url: undefined,
author:undefined, author:undefined,
current_user:undefined, // current_user:undefined,
branchs:undefined, branchs:undefined,
branchList:undefined, branchList:undefined,
@ -161,15 +161,10 @@ class Detail extends Component{
componentDidMount=()=>{ componentDidMount=()=>{
this.getUserInfo(); // this.getUserInfo();
this.getDetail(); this.getDetail();
} }
// componentDidUpdate=(provState)=>{
// if(provState.match.params.projectsId !== this.props.match.params.projectsId){
// this.getDetail();
// }
// }
getDetail=()=>{ getDetail=()=>{
const { projectsId } = this.props.match.params; const { projectsId } = this.props.match.params;
@ -274,7 +269,6 @@ class Detail extends Component{
branchList:result.data, branchList:result.data,
branchs, branchs,
branchLastCommit:result.data[0], branchLastCommit:result.data[0],
// http_url:result.data[0].http_url
}) })
} }
}).catch((error)=>{}) }).catch((error)=>{})
@ -282,14 +276,16 @@ class Detail extends Component{
render(){ 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 url = this.props.history.location.pathname;
const urlArr= url.split("/"); const urlArr= url.split("/");
const urlFlag = (urlArr.length === 3); const urlFlag = (urlArr.length === 3);
const { isManager , isDeveloper } = this.props;
const { isManager } = this.props;
const { projectsId } = this.props.match.params; const { projectsId } = this.props.match.params;
const { state } = this.props.history.location; const { state } = this.props.history.location;
return( return(
<div> <div>
<div className="detailHeader-wrapper"> <div className="detailHeader-wrapper">
@ -344,55 +340,55 @@ class Detail extends Component{
{/* 新建文件 */} {/* 新建文件 */}
<Route path="/projects/:projectsId/coders/:branch/newfile/:path" <Route path="/projects/:projectsId/coders/:branch/newfile/:path"
render={ render={
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<FileNew {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/coders/:branch/newfile" <Route path="/projects/:projectsId/coders/:branch/newfile"
render={ render={
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<FileNew {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 标签列表 */} {/* 标签列表 */}
<Route path="/projects/:projectsId/orders/tags" <Route path="/projects/:projectsId/orders/tags"
render={ render={
(props) => (<TagList {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<TagList {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 仓库设置 */} {/* 仓库设置 */}
<Route path="/projects/:projectsId/setting" <Route path="/projects/:projectsId/setting"
render={ 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>
{/* 工单详情 */} {/* 工单详情 */}
<Route path="/projects/:projectsId/orders/:orderId/detail" <Route path="/projects/:projectsId/orders/:orderId/detail"
render={ render={
(props) => (<OrderDetail {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrderDetail {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 里程碑 */} {/* 里程碑 */}
<Route path="/projects/:projectsId/orders/Milepost" <Route path="/projects/:projectsId/orders/Milepost"
render={ render={
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrderMilepost {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 新建里程碑 */} {/* 新建里程碑 */}
<Route path="/projects/:projectsId/orders/meilpost" <Route path="/projects/:projectsId/orders/meilpost"
render={ render={
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrdernewMilepost {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/*里程碑详情*/ } {/*里程碑详情*/ }
<Route path="/projects/:projectsId/orders/:meilid/MilepostDetail" <Route path="/projects/:projectsId/orders/:meilid/MilepostDetail"
render={ render={
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<MilepostDetail {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/*修改里程碑*/} {/*修改里程碑*/}
<Route path="/projects/:projectsId/orders/:meilid/meilpost" <Route path="/projects/:projectsId/orders/:meilid/meilpost"
render={ render={
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
@ -401,28 +397,28 @@ class Detail extends Component{
<Route path="/projects/:projectsId/orders/new" <Route path="/projects/:projectsId/orders/new"
render={ render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrderNew {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 修改详情 */} {/* 修改详情 */}
<Route path="/projects/:projectsId/orders/:orderId/updatedetail" <Route path="/projects/:projectsId/orders/:orderId/updatedetail"
render={ render={
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrderupdateDetail {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 复制详情 */} {/* 复制详情 */}
<Route path="/projects/:projectsId/orders/:orderId/copyetail" <Route path="/projects/:projectsId/orders/:orderId/copyetail"
render={ render={
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrdercopyDetail {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
{/* 动态 */} {/* 动态 */}
<Route path="/projects/:projectsId/trends" <Route path="/projects/:projectsId/trends"
render={ render={
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<TrendsIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
@ -430,66 +426,66 @@ class Detail extends Component{
{/* 代码Index */} {/* 代码Index */}
<Route path="/projects/:projectsId/orders" <Route path="/projects/:projectsId/orders"
render={ render={
(props) => (<OrderIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<OrderIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/merge/new" <Route path="/projects/:projectsId/merge/new"
render={ render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<CreateMerge {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/merge/:mergeId/UpdateMerge" <Route path="/projects/:projectsId/merge/:mergeId/UpdateMerge"
render={ render={
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<UpdateMerge {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/merge/:mergeId/Messagecount" <Route path="/projects/:projectsId/merge/:mergeId/Messagecount"
render={ render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<MessageCount {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/merge/:mergeId/MergeSubmit" <Route path="/projects/:projectsId/merge/:mergeId/MergeSubmit"
render={ render={
(props) => (<MergeSubmit {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<MergeSubmit {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/version/new" <Route path="/projects/:projectsId/version/new"
render={ render={
(props) => (<NewVersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<NewVersionIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/version/:versionId/upversion" <Route path="/projects/:projectsId/version/:versionId/upversion"
render={ render={
(props) => (<UpVersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<UpVersionIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/version" <Route path="/projects/:projectsId/version"
render={ render={
(props) => (<VersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<VersionIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/merge" <Route path="/projects/:projectsId/merge"
render={ render={
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<MergeIndexDetail {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId/coders" <Route path="/projects/:projectsId/coders"
render={ render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<CoderRootIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
<Route path="/projects/:projectsId" <Route path="/projects/:projectsId"
render={ render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>) (props) => (<CoderRootIndex {...this.props} {...props} {...this.state}/>)
} }
></Route> ></Route>
</Switch> </Switch>

View File

@ -177,6 +177,7 @@ class Index extends Component{
} }
render(){ render(){
const { current_user } = this.props;
const menu=( const menu=(
<Menu onClick={this.ChangeSoryBy}> <Menu onClick={this.ChangeSoryBy}>
<Menu.Item key="updated_on">更新时间排序</Menu.Item> <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> <Pagination simple defaultCurrent={page} total={total} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:"" </div>:""
) )
return( return(
<div style={{background:"#fafafa"}}> <div style={{background:"#fafafa"}}>
<p className="t_project_banner"></p> <p className="t_project_banner"></p>
@ -218,12 +221,14 @@ class Index extends Component{
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<div className="list-r-operation"> <div className="list-r-operation">
<div> <div>
{
<Dropdown overlay={newItem} trigger={["click"]} placement='bottomRight' className="mr30"> current_user && current_user.login &&
<a className="ant-dropdown-link"> <Dropdown overlay={newItem} trigger={["click"]} placement='bottomRight' className="mr30">
<span className="color-blue font-16"><img src={img_new} alt="" width="13px"/> 新建</span> <a className="ant-dropdown-link">
</a> <span className="color-blue font-16"><img src={img_new} alt="" width="13px"/> 新建</span>
</Dropdown> </a>
</Dropdown>
}
<Dropdown overlay={menu} trigger={['click']} placement='bottomRight'> <Dropdown overlay={menu} trigger={['click']} placement='bottomRight'>
<a className="ant-dropdown-link"> <a className="ant-dropdown-link">

View File

@ -23,7 +23,6 @@ class Index extends Component{
GitignoreList:undefined, GitignoreList:undefined,
LicensesList:undefined, LicensesList:undefined,
isSpin:false, isSpin:false,
current_user:undefined
} }
} }
getUserInfo=()=>{ getUserInfo=()=>{
@ -40,7 +39,7 @@ class Index extends Component{
}) })
} }
componentDidMount=()=>{ componentDidMount=()=>{
this.getUserInfo(); // this.getUserInfo();
// 获取项目类别 // 获取项目类别
this.getCategory(); this.getCategory();
// 获取项目语言 // 获取项目语言
@ -116,7 +115,7 @@ class Index extends Component{
}) })
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){ if(!err){
const { current_user } = this.state; const { current_user } = this.props;
const { projectsType } =this.props.match.params; const { projectsType } =this.props.match.params;
const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json"; const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json";
axios.post(url,{ axios.post(url,{
@ -129,7 +128,7 @@ class Index extends Component{
isSpin:false isSpin:false
}) })
this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`); 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)=>{ }).catch((error)=>{
@ -148,7 +147,6 @@ class Index extends Component{
render(){ render(){
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
console.log(this.props);
// 项目类型deposit-托管项目mirror-镜像项目 // 项目类型deposit-托管项目mirror-镜像项目
const { projectsType } =this.props.match.params; const { projectsType } =this.props.match.params;
const { const {
@ -165,6 +163,8 @@ class Index extends Component{
LicensesList, LicensesList,
isSpin isSpin
}=this.state; }=this.state;
console.log("current_user",this.props);
return( return(
<div className="main back-white"> <div className="main back-white">
<div className="newPanel"> <div className="newPanel">

View File

@ -730,21 +730,18 @@ submittojoinclass=(value)=>{
try { try {
var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting')); var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse')); var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
// console.log("NewHeaderNewHeaderNewHeader");
// console.log(chromesettingArray); this.setState({
// console.log(chromesettingresponseArray); mygetHelmetapi2:chromesettingArray
});
this.setState({ if (chromesettingArray.tab_logo_url) {
mygetHelmetapi2:chromesettingArray this.gettablogourldata(chromesettingresponseArray);
}); } else {
if (chromesettingArray.tab_logo_url) { this.gettablogourlnull();
this.gettablogourldata(chromesettingresponseArray); }
} else {
this.gettablogourlnull();
}
}catch (e) { }catch (e) {
console.log("head获取游览器配置失败 重新请求开始读取配置"); // console.log("head获取游览器配置失败 重新请求开始读取配置");
this.geturlsdata(); this.geturlsdata();
} }
}; };