Merge branch 'develop_new' into develop_educoder

This commit is contained in:
caishi 2021-03-19 15:54:10 +08:00
commit 90be5ad793
7 changed files with 218 additions and 101 deletions

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react';
import { Spin, Tooltip } from 'antd';
import { Link, Route, Switch } from 'react-router-dom';
import { Content } from '../Component/layout';
import DetailBanner from './sub/DetailBanner';
import '../css/index.scss'
import './list.css';
@ -257,6 +258,7 @@ class Detail extends Component {
getDetail = () => {
const { projectsId , owner } = this.props.match.params;
this.getBanner();
const url = `/${owner}/${projectsId}/detail.json`;
axios.get(url).then((result) => {
if (result && result.data) {
@ -278,6 +280,19 @@ class Detail extends Component {
}).catch((error) => { })
}
// 获取动态导航栏菜单
getBanner(){
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/menu_list.json`;
axios.get(url).then(result=>{
if(result){
this.setState({
bannerList:result.data
})
}
}).catch(error=>{})
}
// 关注和取消关注
focusFunc = (flag) => {
const { platform } = this.state;
@ -374,7 +389,7 @@ class Detail extends Component {
const { projectDetail, watchers_count, praises_count,
forked_count, firstSync , secondSync ,
isManager, watched, praised,
project , open_devops , platform , defaultBranch } = this.state;
project , open_devops , platform , defaultBranch , bannerList } = this.state;
const url = this.props.history.location.pathname;
const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3);
@ -494,79 +509,25 @@ class Detail extends Component {
</div>
{
firstSync ? "" :
<div className="f-wrap-between mt15">
<ul className="headerMenu-wrapper">
<li className={pathname==="about" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/about`, state }}>
<i className={(pathname==="" || urlFlag) ? "iconfont icon-zhuye1 color-grey-3 mr5 font-14":"iconfont icon-zhuye1 color-grey-6 font-14 mr5"}></i>
<span>主页</span>
</Link>
</li>
<li className={(pathname==="" || urlFlag) ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}`, state }}>
<i className={(pathname==="" || urlFlag) ? "iconfont icon-daimaku color-grey-3 mr5 font-14":"iconfont icon-daimaku color-grey-6 font-14 mr5"}></i>
<span>代码库</span>
</Link>
</li>
<li className={pathname==="issues" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/issues`, state }}>
<i className={pathname==="issues" ? "iconfont icon-renwu color-grey-3 mr5 font-14":"iconfont icon-renwu color-grey-6 font-14 mr5"}></i>
<span>易修 (Issue)</span>
{projectDetail && projectDetail.issues_count ? <span className="num">{projectDetail.issues_count}</span> : ""}
</Link>
</li>
{
projectDetail && parseInt(projectDetail.type) !== 2 && platform &&
<li className={pathname==="pulls" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/pulls`, state }}>
<i className={pathname==="pulls" ? "iconfont icon-hebingqingqiu1 color-grey-3 mr5 font-14":"iconfont icon-hebingqingqiu1 color-grey-6 font-14 mr5"}></i>
<span>合并请求</span>
{projectDetail && projectDetail.pull_requests_count ? <span className="num">{projectDetail.pull_requests_count}</span> : ""}
</Link>
</li>
}
{
platform &&
<li className={pathname==="devops" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/devops${open_devops ? `/dispose`:""}`, state }}>
<i className="iconfont icon-gongzuoliu font-13 mr8"></i>(beta)
{projectDetail && projectDetail.ops_count ? <span>{projectDetail.ops_count}</span> : ""}
</Link>
</li>
}
<li className={pathname==="milestones" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/milestones`, state }}>
<i className={pathname==="milestones" ? "iconfont icon-lichengbei color-grey-3 mr5 font-14":"iconfont icon-lichengbei color-grey-6 font-14 mr5"}></i>
<span>里程碑</span>
{projectDetail && projectDetail.versions_count ? <span className="num">{projectDetail.versions_count}</span> :""}
</Link>
</li>
<li className={pathname==="activity" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/activity`, state }}>
<i className={pathname==="activity" ? "iconfont icon-tongzhi color-grey-3 mr5 font-14":"iconfont icon-tongzhi color-grey-6 font-14 mr5"}></i>
<span>动态</span>
</Link>
</li>
{
isManager && platform &&
<li className={url.indexOf("/setting") > 0 ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/setting`}>
<i className={url.indexOf("/setting") > 0 ? "iconfont icon-cangku color-grey-3 mr5 font-14":"iconfont icon-cangku color-grey-6 font-14 mr5"}></i>
<span>仓库设置</span>
</Link>
</li>
}
</ul>
</div>
<DetailBanner
list={bannerList}
owner={owner}
projectsId={projectsId}
pathname={pathname}
state={state}
projectDetail={projectDetail}
open_devops={open_devops}
platform={platform}
urlFlag={urlFlag}
isManager={isManager}
/>
}
</div>
</div>
{
firstSync ?
<Content className="spincontent">
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large">
</Spin>
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
</Content>
:
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">

View File

@ -0,0 +1,108 @@
import React, { useEffect, useState } from 'react';
import { Skeleton } from 'antd';
import { Link } from 'react-router-dom';
function DetailBanner({ list , owner , projectsId , isManager , url , pathname , state , urlFlag , projectDetail , platform ,open_devops }){
const [ menuName , setMenuName ] = useState(undefined);
useEffect(()=>{
if(list){
setMenuName(list);
}
},[list]);
return(
<div className="f-wrap-between mt15">
{
menuName && projectDetail ?
<ul className="headerMenu-wrapper">
{
menuName.map((item,key)=>{
return(
<React.Fragment>
{
item.menu_name === "home" &&
<li className={pathname==="about" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/about`, state }}>
<i className={(pathname==="" || urlFlag) ? "iconfont icon-zhuye1 color-grey-3 mr5 font-14":"iconfont icon-zhuye1 color-grey-6 font-14 mr5"}></i>
<span>主页</span>
</Link>
</li>
}
{
item.menu_name === "code" &&
<li className={(pathname==="" || urlFlag) ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}`, state }}>
<i className={(pathname==="" || urlFlag) ? "iconfont icon-daimaku color-grey-3 mr5 font-14":"iconfont icon-daimaku color-grey-6 font-14 mr5"}></i>
<span>代码库</span>
</Link>
</li>
}
{
item.menu_name === "issues" &&
<li className={pathname==="issues" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/issues`, state }}>
<i className={pathname==="issues" ? "iconfont icon-renwu color-grey-3 mr5 font-14":"iconfont icon-renwu color-grey-6 font-14 mr5"}></i>
<span>易修 (Issue)</span>
{projectDetail && projectDetail.issues_count ? <span className="num">{projectDetail.issues_count}</span> : ""}
</Link>
</li>
}
{
item.menu_name === "pulls" && projectDetail && parseInt(projectDetail.type) !== 2 && platform ?
<li className={pathname==="pulls" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/pulls`, state }}>
<i className={pathname==="pulls" ? "iconfont icon-hebingqingqiu1 color-grey-3 mr5 font-14":"iconfont icon-hebingqingqiu1 color-grey-6 font-14 mr5"}></i>
<span>合并请求</span>
{projectDetail && projectDetail.pull_requests_count ? <span className="num">{projectDetail.pull_requests_count}</span> : ""}
</Link>
</li>:""
}
{
item.menu_name === "devops" && platform ?
<li className={pathname==="devops" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/devops${open_devops ? `/dispose`:""}`, state }}>
<i className="iconfont icon-gongzuoliu font-13 mr8"></i>工作流(beta版)
{projectDetail && projectDetail.ops_count ? <span>{projectDetail.ops_count}</span> : ""}
</Link>
</li>
:""
}
{
item.menu_name === "versions" &&
<li className={pathname==="milestones" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/milestones`, state }}>
<i className={pathname==="milestones" ? "iconfont icon-lichengbei color-grey-3 mr5 font-14":"iconfont icon-lichengbei color-grey-6 font-14 mr5"}></i>
<span>里程碑</span>
{projectDetail && projectDetail.versions_count ? <span className="num">{projectDetail.versions_count}</span> :""}
</Link>
</li>
}
{
item.menu_name === "activity" &&
<li className={pathname==="activity" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/activity`, state }}>
<i className={pathname==="activity" ? "iconfont icon-tongzhi color-grey-3 mr5 font-14":"iconfont icon-tongzhi color-grey-6 font-14 mr5"}></i>
<span>动态</span>
</Link>
</li>
}
</React.Fragment>
)
})
}
{
isManager && platform ?
<li className={pathname === "setting" ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/setting`}>
<i className={url && url.indexOf("/setting") > 0 ? "iconfont icon-cangku color-grey-3 mr5 font-14":"iconfont icon-cangku color-grey-6 font-14 mr5"}></i>
<span>仓库设置</span>
</Link>
</li>:""
}
</ul>
:
<Skeleton paragraph={false} active={true}/>
}
</div>
)
}
export default DetailBanner;

View File

@ -272,8 +272,8 @@ class merge extends Component {
</React.Fragment>
);
return (
<div className="main">
<div className="topWrapper" style={{borderBottom:"none"}}>
<div className="main" style={{padding:"0px"}}>
<div className="topWrapper" style={{borderBottom:"none",padding:"20px"}}>
<div className="target-detail-search">
<Search
placeholder="输入关键字搜索合并请求"

View File

@ -1,6 +1,7 @@
.screenWrap{
background:rgba(250,250,250,1);
border:1px solid rgba(221,221,221,1);
border-top:1px solid rgba(221,221,221,1);
border-bottom:1px solid rgba(221,221,221,1);
padding-left: 20px;
box-sizing: border-box;
}

View File

@ -524,7 +524,8 @@ class order extends Component {
} = this.state;
return (
<div className="main">
<div className="main" style={{padding:"0px"}}>
<div style={{padding:"10px 20px 0px 20px"}}>
<div className="topWrapper" style={{ paddingTop: "10px" }}>
<ul className="topWrapper_type">
<li>
@ -568,6 +569,7 @@ class order extends Component {
<DatePicker value={end ? moment(end, 'YYYY-MM-DD') : ""} placeholder="请选择结束时间" onChange={this.changeEndTime} />
</div>
</div>
</div>
<Spin spinning={isSpin}>
<div className="f-wrap-between screenWrap">
<div className="df">

View File

@ -82,7 +82,7 @@ class Index extends Component {
>
<p>
<Link to={`/projects/${owner}/${projectsId}/setting/tags`} className="w-100">
<i className="iconfont icon-biaoqian3 font-18 mr10"></i>
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
项目标签
</Link>
</p>

View File

@ -2,11 +2,20 @@ import React, { Component } from "react";
import { Form, Input, Checkbox, Select , Spin } from "antd";
import Title from '../Component/Title';
import {WhiteBack} from '../Component/layout';
import axios from "axios";
import "./setting.scss";
const { TextArea } = Input;
const { Option } = Select;
const menu = [
{name:"主页",index:"home"},
{name:"代码库",index:"code"},
{name:"易修 (Issue)",index:"issues"},
{name:"合并请求",index:"pulls"},
{name:"工作流(beta版)",index:"devops"},
{name:"里程碑",index:"versions"},
{name:"动态",index:"activity"},
]
class Setting extends Component {
constructor(props) {
super(props);
@ -14,7 +23,8 @@ class Setting extends Component {
CategoryList: undefined,
LanguageList: undefined,
private_check: undefined,
loading:true
loading:true,
project_units:['home',"activity"]
};
}
@ -51,12 +61,18 @@ class Setting extends Component {
.get(url)
.then((result) => {
if (result) {
const { project_units } = this.state;
let units = result.data.project_units;
units.push(...project_units);
this.props.form.setFieldsValue({
...result.data,
project_units:units
});
this.setState({
private_check: result.data.private,
loading:false
loading:false,
project_units:units
});
}
})
@ -104,36 +120,46 @@ class Setting extends Component {
loading:true
})
const { projectsId , owner } = this.props.match.params;
const navUrl = `/${owner}/${projectsId}/project_units.json`;
const { private_check } = this.state;
const url = `/${owner}/${projectsId}.json`;
axios
.put(url, {
name: values.project_name,
description: values.project_description,
private: private_check,
...values,
})
.then((result) => {
if (result) {
this.props.showNotification(`仓库信息修改成功!`);
const { getDetail } = this.props;
getDetail && getDetail();
this.setState({
loading:false
})
}
})
.catch((error) => {
console.log(error);
this.setState({
loading:false
})
});
let unit = values.project_units.filter(item => (item !== "home" && item!== "activity"));
axios.post(navUrl, {
unit_types:unit
}).then((result) => {
if (result) {
this.update(values);
}
}).catch(error=>{})
}
});
};
update=(values)=>{
const { projectsId , owner } = this.props.match.params;
const { private_check } = this.state;
const url = `/${owner}/${projectsId}.json`;
axios.put(url, {
name: values.project_name,
description: values.project_description,
private: private_check,
...values,
}).then((result) => {
if (result) {
this.props.showNotification(`仓库信息修改成功!`);
const { getDetail } = this.props;
getDetail && getDetail();
this.setState({
loading:false
})
}
}).catch((error) => {
console.log(error);
this.setState({
loading:false
})
});
}
// 删除本仓库
deleteProject = () => {
this.props.confirm({
@ -224,6 +250,25 @@ class Setting extends Component {
],
})(<Select>{LanguageList}</Select>)}
</Form.Item>
<Form.Item label="项目导航">
{getFieldDecorator("project_units", {
rules: [],
})(
<Checkbox.Group>
{
menu.map((item,key)=>{
return(
<Checkbox
key={key}
value={item.index}
disabled={item.index === "home" || item.index === "activity"}
>{item.name}</Checkbox>
)
})
}
</Checkbox.Group>
)}
</Form.Item>
<p className="clearfix">
<a className="submitBtn" onClick={this.resetSetting}>
更新仓库设置