Merge branch 'newVersion_forge' into dev_chain

This commit is contained in:
sylor_huang@126.com 2020-06-12 18:00:36 +08:00
commit 6f7288729b
47 changed files with 2599 additions and 2003 deletions

View File

@ -538,10 +538,6 @@ a:hover.leftnav-box-inner .btn-cir {
/*右侧头部*/
/*右侧内容*/
.content {
min-width: 1000px;
}
/* tab */
@ -1568,6 +1564,9 @@ a.edu-txt-w80,
.font-50 {
font-size: 50px !important;
}
.font-80 {
font-size: 80px !important;
}
/*a标签的下划线*/
a.decoration {
@ -2662,7 +2661,18 @@ a.color-green:hover {
.width89 {
width: 89%;
}
.width50 {
width: 50%;
}
.width40 {
width: 40%;
}
.width45 {
width: 45%;
}
.width10 {
width: 10%;
}
.width20 {
width: 20%;
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
.CodeMirror-merge {
/* .CodeMirror-merge {
position: relative;
white-space: pre;
}
@ -163,4 +163,34 @@
}
.color-grey {
color: #888 !important;
} */
.maxW50{max-width: 50%;}
.minW50{min-width: 50%;}
.width70{width: 70%;}
.width30{width: 30%;}
.custom-commit-tabs .ant-tabs-bar{border-bottom: none;}
.maxW200px{max-width: 200px;}
.pr_tags_open{
background: #28BD6C !important;
color: #fff !important;
border: none !important;
}
.pr_tags_closed{
background: #FA6400 !important;
color: #fff !important;
border: none !important;
}
.pr_tags_merged{
background: #4C9ED3 !important;
color: #fff !important;
border: none !important;
}
.ant-btn-success{
border: 1px solid #28BD6C !important;
color: #28BD6C !important;
}
.ant-btn-success:hover{
background: #28BD6C !important;
color:#fff !important;
}

View File

@ -12,7 +12,6 @@ import LoginDialog from './modules/login/LoginDialog';
import Notcompletedysl from './modules/user/Notcompletedysl';
import Trialapplicationysl from './modules/login/Trialapplicationysl';
import Trialapplicationreview from './modules/user/Trialapplicationreview';
import Addcourses from "./modules/courses/coursesPublic/Addcourses";
import AccountProfile from "./modules/user/AccountProfile";
import Accountnewprofile from './modules/user/Accountnewprofile';
import Certifiedprofessional from './modules/modals/Certifiedprofessional';
@ -20,8 +19,7 @@ import Certifiedprofessional from './modules/modals/Certifiedprofessional';
import Loading from './Loading'
import Loadable from 'react-loadable';
import marked from './common/marked'
import marked from './common/marked';
import moment from 'moment'
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
@ -48,14 +46,11 @@ const Projects = Loadable({
loader: () => import('./forge/Index'),
loading: Loading,
})
//403页面
const Shixunauthority = Loadable({
loader: () => import('./modules/403/Shixunauthority'),
loading: Loading,
})
//404页面
const Shixunnopage = Loadable({
loader: () => import('./modules/404/Shixunnopage'),
@ -67,11 +62,6 @@ const http500 = Loadable({
loader: () => import('./modules/500/http500'),
loading: Loading,
})
// 个人主页
// const InfosIndex = Loadable({
// loader: () => import('./modules/user/usersInfo/InfosIndex'),
// loading: Loading,
// })
const InfosIndex = Loadable({
loader: () => import('./forge/users/Infos'),
loading: Loading,
@ -84,7 +74,7 @@ const OrganizeIndex = Loadable({
class App extends Component {
constructor(props) {
super(props)
super(props);
this.state = {
Addcoursestype: false,
Addcoursestypes: false,
@ -92,8 +82,8 @@ class App extends Component {
occupation: 0,
mygetHelmetapi: null,
}
}
HideAddcoursestypess = (i) => {
this.setState({
Addcoursestype: false,
@ -156,7 +146,7 @@ class App extends Component {
this.setState({
mygetHelmetapi: undefined
});
document.title = "EduCoder";
document.title = "Forge";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -185,8 +175,6 @@ class App extends Component {
getAppdata = () => {
let url = "/setting.json";
axios.get(url).then((response) => {
// console.log("app.js开始请求/setting.json");
// console.log("获取当前定制信息");
if (response) {
if (response.data) {
this.setState({
@ -204,27 +192,18 @@ class App extends Component {
} catch (e) {
this.gettablogourlnull();
}
} else {
this.gettablogourlnull();
}
} else {
this.gettablogourlnull();
}
}).catch((error) => {
this.gettablogourlnull();
});
};
render() {
let { mygetHelmetapi } = this.state;
return (
<Provider store={store}>
<ConfigProvider locale={zhCN}>
@ -234,7 +213,6 @@ class App extends Component {
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>
<Addcourses {...this.props} {...this.state} HideAddcoursestypess={(i) => this.HideAddcoursestypess(i)} />
<AccountProfile {...this.props} {...this.state} />
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.ModalCancelsy} ModalshowCancelsy={this.ModalshowCancelsy} />
<Router>
@ -252,8 +230,7 @@ class App extends Component {
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500} />
<Route
path={"/organize"}
<Route path={"/organize"}
render={
(props) => {
return (<OrganizeIndex {...this.props} {...props} {...this.state} />)
@ -263,20 +240,20 @@ class App extends Component {
{/*404*/}
<Route path="/nopage" component={Shixunnopage} />
{/* 个人主页 */}
<Route path="/users/:username"
<Route path="/users/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...props} {...this.state} />)
}
}></Route>
}></Route>
<Route exact path="/"
render={
(props) => (<Projects {...this.props} {...props} {...this.state}></Projects>)
(props) => (
<Projects {...this.props} {...props} {...this.state}></Projects>
)
}
/>
<Route component={Shixunnopage} />
</Switch>
</Router>
</MuiThemeProvider>

View File

@ -100,7 +100,7 @@ export function initAxiosInterceptors(props) {
// TODO 读取到package.json中的配置
var proxy = "http://localhost:3000"
// proxy = "https://pre-newweb.educoder.net"
proxy = "https://testforgeplus.trustie.net/"
// proxy = "https://testforgeplus.trustie.net/"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制

View File

@ -0,0 +1,19 @@
import React from 'react';
import './Component.scss';
export default (({img , title, desc , rightBtn})=>{
return(
<div className="cards">
<div className="img"><img src={img} alt=""/></div>
<div className="content">
<p className="titles">
<span>{title}</span>
{rightBtn}
</p>
<div className="desc">
{desc}
</div>
</div>
</div>
)
})

View File

@ -1,10 +1,66 @@
ul.ant-menu{
border-right: none;
ul.ant-menu{
border-right: none;
}
ul.ant-menu li:last-child{
border-bottom: none;
}
li.ant-menu-item{
margin:0px!important;
border-bottom: 1px solid #eee;
}
// Cards
.cards{
display: flex;
align-items: center;
padding:20px 34px;
background-color: #fff;
margin:18px 0px;
.img{
margin-right: 20px;
width: 190px;
height: 90px;
border:1px solid rgba(238,238,238,1);
display: flex;
justify-content: center;
align-items: center;
img{
max-width: 100%;
}
}
ul.ant-menu li:last-child{
border-bottom: none;
.content{
flex:1;
width: 0;
.titles{
display: flex;
justify-content: space-between;
margin-bottom: 10px!important;
align-items: center;
&>span{
font-size:18px ;
color: #333;
}
}
.desc{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
}
li.ant-menu-item{
margin:0px!important;
border-bottom: 1px solid #eee;
}
}
// Tabs
.tabsStyle{
.ant-tabs-bar.ant-tabs-top-bar{
padding-left: 35px;
margin-bottom: 0px;
}
.ant-tabs-nav .ant-tabs-tab{
padding:19px 0px;
margin-right: 40px;
}
.ant-tabs-ink-bar{
width:25px!important;
bottom: 10px;
}
}

View File

@ -0,0 +1,41 @@
import React from 'react';
import styled from 'styled-components';
export default (({fork,parise})=>{
const DivStyle = styled.div`{
display:flex;
align-item:center;
}`;
const SpanStylefork = styled.span`{
display:flex;
align-item:center;
margin-left:30px;
padding:0px 12px;
border-radius:13px;
background-color:#EBF4FE;
height:24px;
line-height:24px;
font-size:12px;
}`;
const SpanStyleparise = styled.span`{
display:flex;
align-item:center;
margin-left:30px;
padding:0px 12px;
border-radius:13px;
background-color:#FFF3DC;
height:24px;
line-height:24px;
font-size:12px;
}`;
return(
<DivStyle>
{
fork || fork ===0 ? <SpanStylefork><i className="iconfont icon-fork font-15 mr3" style={{color:"#1B8FFF"}}></i>fork({fork})</SpanStylefork>:""
}
{
parise || parise ===0?<SpanStyleparise><i className="iconfont icon-guanzhu font-14 mr3" style={{color:"#FFA802"}}></i>点赞({parise})</SpanStyleparise>:""
}
</DivStyle>
)
})

View File

@ -0,0 +1,74 @@
import React from 'react';
import './Component.scss';
import styled from 'styled-components';
const Img = styled.img`{
border-radius:50%;
width:50px;
height:50px;
margin-right:14px;
}`
const Name = styled.div`{
color:#5091FF;
font-size:16px;
height:22px;
line-height:22px;
margin-bottom:7px;
}`
const Time = styled.div`{
color:#888;
font-size:12px;
height:16px;
line-height:16px;
margin-bottom:9px;
display:flex;
align-item:center;
}`
const I = styled.i`{
font-size:13px!important;
color:#60B25E;
margin-right:2px;
}`
const FocusBtn = styled.a`{
display:inline-block;
height:30px;
line-height:26px;
padding:0px 12px;
background-color:#fafafa;
border:1px solid #eee;
border-radius:2px;
color:#888!important;
}`
const Ifocused = styled.i`{
font-size:16px!important;
color:#FFA802;
margin-right:4px;
}`
const Ifocus = styled.i`{
font-size:16px!important;
color:#BBBBBB;
margin-right:4px;
}`
const Div = styled.div`{
margin-bottom: 18px;
padding:20px 16px;
display: flex;
align-items: center;
border:1px solid #eee;
}`
export default (({img,name,time, focusStatus})=>{
return(
<Div>
<Img src={img}/>
<div className="m-infos">
<Name>{name}</Name>
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>
{
focusStatus ?
<FocusBtn><Ifocused className="iconfont icon-shixing"></Ifocused>已关注</FocusBtn> :
<FocusBtn><Ifocus className="iconfont icon-kongxing"></Ifocus>关注</FocusBtn>
}
</div>
</Div>
)
})

View File

@ -0,0 +1,20 @@
import React from 'react';
import { Tabs } from 'antd';
import './Component.scss';
const { TabPane } = Tabs;
export default (({ nav, index , onChange , children })=>{
return(
nav && nav.length > 0 ?
<Tabs className="tabsStyle" animated={false} activeKey={index} onChange={onChange}>
{
nav.map((item,key)=>{
return(
<TabPane tab={item} key={`${key}`}>{children}</TabPane>
)
})
}
</Tabs>:""
)
})

View File

@ -0,0 +1,44 @@
import styled from 'styled-components';
export const Banner = styled.div`{
padding:20px 25px;
color:#333;
font-size:18px;
border-bottom:1px solid #eee;
background-color:#fff;
border-radius:5px 5px 0px 0px;
}`
export const AlignCenterBetween = styled.div`{
display:flex;
align-items: center;
padding: 14px 14px 14px 20px;
justify-content: space-between;
border-bottom:1px solid #eee;
}`
export const AlignCenter = styled.div`{
display:flex;
align-items: center;
}`
//
export const Box = styled.div`{
display:flex;
align-item:flex-start;
}`
export const Long = styled.div`{
width:72%;
border-radius:5px;
margin-bottom:30px;
}`
export const Short = styled.div`{
width:28%;
border-radius:5px;
margin-bottom:30px;
}`
export const Gap = styled.div`{
padding-left:20px;
box-sizing:border-box;
}`
export const WhiteBack = styled.div`{
background-color:#fff;
border-radius:5px;
}`

View File

@ -27,7 +27,6 @@ const ProjectDetail = Loadable({
loading: Loading,
});
class Index extends Component {
render() {
return (
@ -52,15 +51,12 @@ class Index extends Component {
<ProjectIndex {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
exact
path="/"
render={(props) => (
<ProjectIndex
{...this.props}
{...props}
{...this.state}
></ProjectIndex>
<Route exact path="/" render={(props) => (
<ProjectIndex
{...this.props}
{...props}
{...this.state}
></ProjectIndex>
)}
/>
</Switch>

View File

@ -76,7 +76,7 @@ class CoderRootCommit extends Component{
render(){
const { branch , data , dataCount , limit , page , isSpin } = this.state;
const { branchs , projectDetail } = this.props;
const { branchs , projectDetail, commit_class } = this.props;
const { projectsId } = this.props.match.params;
const title =()=>{
return(
@ -97,7 +97,7 @@ class CoderRootCommit extends Component{
}
return(
<React.Fragment>
<div className="main">
<div className={commit_class}>
<div className="f-wrap-between">
<SelectBranch
repo_id={projectDetail && projectDetail.repo_id}

View File

@ -90,6 +90,9 @@ class CoderRootDirectory extends Component {
// 页面地址返回到主目录
returnMain = (branch) => {
const { projectsId } = this.props.match.params;
this.setState({
readOnly:true
})
this.props.history.push(`/projects/${projectsId}/coders`);
this.getProjectRoot(branch);
};
@ -138,6 +141,7 @@ class CoderRootDirectory extends Component {
this.props.history.push(`/projects/${projectsId}/coders?url=${arr.path}`);
this.setState({
readOnly: readOnly,
chooseType:"file"
});
};
@ -299,6 +303,7 @@ class CoderRootDirectory extends Component {
this.setState({
branch: value,
isSpin: true,
readOnly:true
});
let { search } = this.props.history.location;
if (search && search.indexOf("?url=") > -1) {
@ -315,11 +320,18 @@ class CoderRootDirectory extends Component {
// 子目录路径返回链接
returnUlr=(url)=>{
this.setState({
chooseType:"dir"
chooseType:"dir",
readOnly:true
})
const { projectsId } = this.props.match.params;
this.props.history.push(`/projects/${projectsId}/coders?url=${url}`);
}
onEdit=(readOnly)=>{
this.setState({
readOnly
})
}
render(){
const { branchLastCommit , lastCommitAuthor , rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin , zip_url , tar_url} = this.state;
const { isManager , isDeveloper , projectDetail } = this.props;
@ -505,6 +517,7 @@ class CoderRootDirectory extends Component {
{...this.props}
{...this.state}
readOnly={this.state.readOnly}
onEdit={this.onEdit}
></CoderRootFileDetail>
)}
{/* readme.txt (isManager || isDeveloper)*/}

View File

@ -15,18 +15,16 @@ class CoderRootFileDetail extends Component {
constructor(props) {
super(props);
this.state = {
readOnly: true,
value: undefined,
language: undefined
};
}
componentDidMount = () => {
const { detail, readOnly } = this.props;
const { detail } = this.props;
this.setState({
value: detail.content,
readOnly: readOnly,
});
};
select_language = (e) => {
@ -34,16 +32,14 @@ class CoderRootFileDetail extends Component {
language: e,
});
};
EditFile = () => {
this.setState({
readOnly: false,
});
};
CancelEdit = () => {
this.setState({
readOnly: true,
});
EditFile = (flag) => {
const { onEdit } = this.props;
onEdit && onEdit(flag);
// this.setState({
// readOnly: false,
// });
};
// 编辑文件
@ -85,8 +81,8 @@ class CoderRootFileDetail extends Component {
};
render() {
const { detail, current_user, isManager, isDeveloper } = this.props;
const { readOnly, language } = this.state;
const { readOnly , detail, current_user, isManager, isDeveloper } = this.props;
const { language } = this.state;
let flag = current_user && current_user.login && (isManager || isDeveloper);
const Option = Select.Option;
const languages = [
@ -151,7 +147,7 @@ class CoderRootFileDetail extends Component {
{flag && (
<div>
{readOnly ? (
<a onClick={this.EditFile} className="ml20">
<a onClick={()=>this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
) : (
@ -171,7 +167,7 @@ class CoderRootFileDetail extends Component {
<button
type="button"
className="ant-btn ant-btn-sm ml20"
onClick={this.CancelEdit}
onClick={()=>this.EditFile(true)}
>
<span> </span>
</button>

View File

@ -48,7 +48,7 @@ class CoderRootIndex extends Component{
<Switch {...this.props}>
<Route path="/projects/:projectsId/coders/commit"
render={
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} />)
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} commit_class="main" />)
}
></Route>
{/* diff */}

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Spin, Tooltip } from 'antd';
import { Link, Route, Switch, withRouter } from 'react-router-dom';
import { Link, Route, Switch } from 'react-router-dom';
import '../css/index.css'
import './list.css';
@ -94,6 +94,11 @@ const MessageCount = Loadable({
loading: Loading,
})
const UpdateMerge = Loadable({
loader: () => import('../Merge/UpdateMerge'),
loading: Loading,
})
const MilepostDetail = Loadable({
loader: () => import('../Order/MilepostDetail'),
loading: Loading,
@ -547,7 +552,7 @@ class Detail extends Component {
<Route path="/projects/:projectsId/merge/:mergeId/UpdateMerge"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common}/>)
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -605,4 +610,4 @@ class Detail extends Component {
}
}
export default withRouter(Detail);
export default Detail;

View File

@ -1,6 +1,8 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Popconfirm } from "antd";
import { Popconfirm, Tag } from "antd";
import { getImageUrl } from "educoder";
import "./merge.css"
class MergeItem extends Component {
constructor(props) {
@ -29,7 +31,7 @@ class MergeItem extends Component {
if (issue_tags && issue_tags.length > 0) {
return issue_tags.map((item, key) => {
return (
<span className="issue-tag-show" style={{ background: item.color }}>
<span className="issue-tag-show" style={{ color: item.color }}>
{item.name}
</span>
);
@ -40,7 +42,7 @@ class MergeItem extends Component {
};
render() {
const { issues, search_count, page, limit } = this.props;
const { issues, project_name } = this.props;
const { projectsId } = this.props.match.params;
const { current_user } = this.props;
const renderList = () => {
@ -49,34 +51,66 @@ class MergeItem extends Component {
return (
<div className="issueItem">
<div className="flex-1">
<p className="mb15 df">
<span
className={
item.issue_status === "关闭"
? "issueNo"
: "issueNo issueOpen"
}
>
# {search_count - (key + (page - 1) * limit)}
</span>
<p className="mb15 df" style={{ alignItems: "center" }}>
<Link
to={`/projects/${projectsId}/merge/${item.pull_request_id}/Messagecount`}
className="flex-1 hide-1 font-16 color-grey-3 lineh-30"
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
style={{ maxWidth: "300px" }}
>
{item.name}
</Link>
<Tag className={`pr_tags_${item.pull_request_staus}`}>
{item.pull_request_staus==="merged" ? "已合并" : (item.pull_request_staus === "closed"?"已拒绝" : "开启的") }
</Tag>
</p>
<p className="color-grey-6 font-12">
<span>{item.format_time}</span>
<span className="ml5">发布</span>
{item.updated_at === item.format_time ? (
""
) : (
<span className="ml20">
<span>{item.updated_at}</span>
<span className="ml5">更新</span>
<p className="grid-item font-13">
<Link
to={`/users/${item && item.author_login}`}
className="show-user-link"
>
<img
className="radius"
src={getImageUrl(`images/${item && item.avatar_url}`)}
alt=""
width="24"
height="24"
/>
</Link>
<span>
<Link
to={`/users/${item && item.author_login}`}
className="show-user-link color-grey-8 ml5"
>
{item && item.author_name}
</Link>
<span className="ml15 color-grey-8">
{item.pull_request_staus === "open"
? "创建于"
: item.pull_request_staus === "merged"
? "合并于"
: "更新于"}
</span>
)}
<span className="color-grey-8">{item.pr_time}</span>
<span className="ml15">
<Tag>
<Link
to={`projects/${projectsId}/coders?branch=${item.pull_request_head}`} className="maxW200px hide-1 ver-middle"
>
{project_name}:{item.pull_request_head}
</Link>
</Tag>
<span className="mr8 ver-middle">
<i className={"iconfont icon-youjiang color-grey-c font-16"}></i>
</span>
<Tag>
<Link
to={`projects/${projectsId}/coders?branch=${item.pull_request_base}`} className="maxW200px hide-1 ver-middle"
>
{project_name}:{item.pull_request_base}
</Link>
</Tag>
</span>
</span>
</p>
</div>
<ul
@ -84,9 +118,8 @@ class MergeItem extends Component {
onMouseMove={() => this.onMouseMove(item.id)}
onMouseOut={() => this.onMouseOut()}
>
<li>{item.priority}</li>
<li>{this.set_issue_tags(item.issue_tags)}</li>
{/*<li>{item.issue_type || "--"}</li>*/}
<li>{item.version || "--"}</li>
<li>
{item.assign_user_name ? (
<Link
@ -99,14 +132,19 @@ class MergeItem extends Component {
"--"
)}
</li>
<li>{item.version || "--"}</li>
<li>
<div className="flex1 df" style={{justifyContent:"center"}}>
<div
className="flex1 df"
style={{ justifyContent: "center" }}
>
{item.journals_count ? (
<Link
className="mr5"
className="mr5 color-grey-8"
to={`/projects/${projectsId}/merge/${item.pull_request_id}/Messagecount`}
>
<i className="iconfont icon-pinglun1 mr3 font-16"></i>
<i className="iconfont icon-huifu1 font-15 mr5 ver-middle"></i>
{item.journals_count}
</Link>
) : (

File diff suppressed because it is too large Load Diff

View File

@ -1,431 +1,187 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Radio, Form, Menu, Dropdown, Input, Select, Table, Spin } from 'antd';
import axios from 'axios';
import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder';
import '../Order/order.css';
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
const { Button } = Radio;
import React, { Component } from "react";
import { Input, Select, Button, Spin, Alert } from "antd";
import axios from "axios";
import "../Order/order.css";
import "./merge.css";
import MergeForm from "./merge_form"
import MergeFooter from "./merge_footer"
const Option = Select.Option;
const options = [
['bold', 'italic', 'underline'],
[{ header: [1, 2, 3, false] }],
['blockquote', 'code-block'],
['link', 'image'],
['formula']
];
class NewMerge extends Component {
constructor(props) {
super(props);
this.state = {
data: undefined,
//合并 拉取
branches: undefined,
origin_branches: undefined,
merge: undefined,
pull: undefined,
//判断 是否显示创建合并请求的页面
desc: undefined,
iscreatemerge: 'none',
issue_tag_ids: "",
fixed_version_id: "",
assigned_to_id: "",
titledata: undefined,
dataCount: undefined,
limit: 50,
page: 1,
isSpin: false,
mergedata: undefined,
}
show_message: true,
default_message: "必须选择不同的分支",
};
}
componentDidMount = () => {
this.getmergelist();
this.InitData();
}
InitData = () => {
this.props.form.setFieldsValue({
...this.state
});
}
onPanelChange = (time, mode) => {
this.setState({
value: time
});
}
onSelect = (time) => {
this.setState({
value: time,
selectedValue: time,
});
}
getOption = (name, id) => {
if (id === 'branches') {
this.ischeckmerge(name, this.state.pull)
this.setState({
merge: name
})
} else {
if (this.state.iscreatemerge === 'block') {
if (this.state.merge === name) {
} else {
const { page, limit } = this.state;
this.getCommitList(name, page, limit);
}
} else {
}
this.ischeckmerge(this.state.merge, name)
this.setState({
pull: name
})
}
}
ismerge = () => {
this.setState({
iscreatemerge: 'block'
})
const { page, limit } = this.state;
this.getCommitList(this.state.pull, page, limit);
}
};
//获取新建分枝数据
getmergelist = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/new.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
data: result.data,
merge: result.data.branches[0],
pull: result.data.branches[0],
})
}
}).catch((error) => {
console.log(error);
})
}
renderMenu = (array, id) => {
return (
<Menu>
{
array && array.length > 0 && array.map((item, key) => {
return (
<Menu.Item key={item} onClick={() => this.getOption(item, id)}>{item}</Menu.Item>
)
})
}
</Menu>
)
}
renderSelect = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<Option key={key + 1} value={item.id + ''}>{item.name}</Option>
)
})
)
}
}
//创建合并请求
submit = () => {
this.setState({
isSpin: true
})
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests.json`;
if (values.issue_tag_ids.length > 0) {
values.issue_tag_ids = [parseInt(values.issue_tag_ids)]
} else {
values.issue_tag_ids = []
}
const { desc } = this.state;
axios.post(url, {
...values,
body: JSON.stringify(desc),
project_id: projectsId,
head: this.state.merge,
base: this.state.pull,
}).then(result => {
if (result) {
this.setState({
isSpin: false
})
this.props.history.push(`/projects/${projectsId}/merge`);
const { getDetail } = this.props;
getDetail && getDetail();
}
}).catch(error => {
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
isSpin: false
})
console.log(error);
})
} else {
this.setState({
isSpin: false
})
}
})
}
data: result.data,
branches: result.data.branches,
origin_branches: result.data.branches,
});
}
})
.catch((error) => {
console.log(error);
});
};
//获取提交列表
getCommitList = (branch, page, limit) => {
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/commits.json`;
axios.get(url, {
params: {
sha: branch,
page,
limit
}
}).then((result) => {
if (result) {
const array = [];
result.data && result.data.commits.length > 0 && result.data.commits.map((item, key) => {
array.push({
name: item.author && item.author.name,
login: item.author && item.author.login,
image_url: item.author && item.author.image_url,
sha: item.sha,
time_from_now: item.time_from_now,
message: item.message
})
})
this.setState({
titledata: array,
dataCount: result.data.total_count,
isSpin: false
})
}
}).catch((error) => { console.log(error) })
}
selectBrach = (type, value) => {
this.state[type] = value;
this.ischeckmerge();
};
//判断2分支是否可以合并
ischeckmerge = (head, base) => {
ischeckmerge = () => {
this.setState({ isSpin: true });
const { projectsId } = this.props.match.params;
const { pull, merge } = this.state;
const url = `/projects/${projectsId}/pull_requests/check_can_merge.json`;
axios.post(url, {
project_id: projectsId,
head: head,
base: base,
}).then(result => {
if (result) {
this.setState({
mergedata: result.data
})
}
}).catch(error => {
console.log(error);
})
}
onContentChange = (value) => {
this.setState({
desc: value
})
}
axios
.post(url, {
project_id: projectsId,
head: merge ? merge : "master",
base: pull ? pull : "master",
})
.then((result) => {
if (result) {
if (result.data.status === 0) {
this.setState({
isSpin: false,
show_message: false,
});
} else {
this.setState({
isSpin: false,
show_message: true,
default_message: result.data.message,
});
}
} else {
this.setState({
isSpin: false,
show_message: true,
default_message: "出现错误了",
});
}
})
.catch((error) => {
this.setState({ isSpin: false, show_message: true });
console.log(error);
});
};
render() {
const { getFieldDecorator } = this.props.form;
const { projectsId } = this.props.match.params;
const { current_user } = this.props;
const { issue_tag_ids, fixed_version_id, assigned_to_id, data, titledata, desc, isSpin } = this.state;
const {
data,
branches,
origin_branches,
pull,
merge,
isSpin,
show_message,
default_message,
} = this.state;
const columns = [{
title: "作者",
dataIndex: 'name',
width: "10%",
render: (text, item) => (
<span className="f-wrap-alignCenter">
<Link to={`/users/${item.login}`} className="show-user-link">
<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius" />
<label className="hide-1" style={{ maxWidth: "75px", 'vertical-align': 'middle' }}>{text}</label>
</Link>
</span>
),
}, {
title: "SHA",
dataIndex: 'sha',
render: (text) => (
<span className="commitKey">{text}</span>
)
}, {
title: "备注",
dataIndex: 'message',
render: (text) => (
<span>{text}</span>
)
}, {
title: "提交时间",
className: "edu-txt-right",
dataIndex: 'time_from_now',
render: (text) => (
<span>{text}</span>
)
}]
const title = () => {
return (
<div className="f-wrap-between" style={{ alignItems: "center" }}>
<span className="font-16">提交列表</span>
</div>
)
}
const pull = () => {
if (this.state.mergedata && this.state.mergedata.status === -2) {
return (
<div>
在这些分支直接合并请求已经存在<Link to={`/projects/${projectsId}/merge/${this.state.mergedata && this.state.mergedata.pull_request_id}/Messagecount`} style={{ color: 'blue' }}>{this.state.mergedata && this.state.mergedata.pull_request_name}</Link>
</div>
)
} else {
return (
<div>
{this.state.mergedata && this.state.mergedata.status === 0 ? <Button className="topWrapper_btn" onClick={() => this.ismerge()}>创建合并请求</Button> : ""}
</div>
)
const renderBrances = (list) => {
if (list && list.length > 0) {
return list.map((item, key) => {
return (
<Option key={key + 1} value={item}>
{item}
</Option>
);
});
}
}
};
const withHtml = (html) => {
return <div dangerouslySetInnerHTML={{ __html: html }}></div>;
};
return (
<div className="main">
<h1 className="mb10">创建合并请求</h1>
<h5 className="mb10">选择合并的目标分支和源分支</h5>
<div style={{ display: 'flex' }}>
<div className="mergediv">
<div>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(this.state.data && this.state.data.branches, 'branches')} trigger={['click']} placement="bottomCenter">
<Button>合并到{this.state.merge}</Button>
</Dropdown>
...
<Dropdown overlay={this.renderMenu(this.state.data && this.state.data.branches, 'pull')} trigger={['click']} placement="bottomCenter">
<Button>拉取从{this.state.pull}</Button>
</Dropdown>
<div >
<div className="main">
<Spin spinning={isSpin}>
<div className="merge-header width100 inline-block">
<div className="width45 pull-left">
<div className="color-grey-3 mb10 fwb">源分支:</div>
<Input.Group compact>
<Button className="merge-header-button maxW50 hide-1 task-hide">
{data && data.project_author} / {data && data.project_name}
</Button>
<Select
defaultValue={pull ? pull : "master"}
onSelect={(e) => this.selectBrach("pull", e)}
showSearch
className="minW50"
>
{renderBrances(branches)}
</Select>
</Input.Group>
</div>
</div>
</div>
<div style={{ display: this.state.iscreatemerge === 'none' ? 'block' : 'none' }}>
<div className="mergediv" style={{ marginTop: 15 }} >
{pull()}
</div>
</div>
<div style={{ display: this.state.iscreatemerge === 'none' ? 'none' : 'block' }}>
<Form>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df" style={{ padding: "0px", paddingTop: "10px" }}>
<Link to={`/users/${current_user && current_user.login}`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
</Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('title', {
rules: [{
required: true, message: '请填写请求标题'
}],
})(
<Input placeholder="标题" />
)}
</Form.Item>
<MDEditor placeholder={'请输入合并请求的描述...'} height={350}
mdID={'merge-new-description'} initValue={desc} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} isComplete={true} ></UploadComponent>
<p className="clearfix mt15">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" onClick={this.submit}>创建合并请求</a>
</Spin>
</p>
</div>
</div>
<div className="list-left" style={{ paddingRight: "0px", paddingLeft: "15px", paddingTop: "10px" }}>
<div className="list-l-panel">
<Form.Item
label="标签"
<div className="width10 pull-left text-center mt25">
<i className={"iconfont icon-youjiang color-grey-c font-32"}></i>
</div>
<div className="width45 pull-left">
<div>
<div className="color-grey-3 mb10 fwb">目标分支:</div>
<Input.Group compact>
<Button className="merge-header-button maxW50 hide-1 task-hide">
{data && data.project_author} / {data && data.project_name}
</Button>
<Select
defaultValue={merge ? merge : "master"}
onSelect={(e) => this.selectBrach("merge", e)}
showSearch
className="minW50"
>
{getFieldDecorator('issue_tag_ids', {
rules: [],
})(
<Select value={issue_tag_ids}>
<Option value="">{data && data.issue_tags.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
{this.renderSelect(data && data.issue_tags)}
</Select>
)}
</Form.Item>
<Form.Item
label="里程碑"
>
{getFieldDecorator('fixed_version_id', {
rules: [],
})(
<Select value={fixed_version_id}>
<Option value="">{data && data.issue_versions.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
{this.renderSelect(data && data.issue_versions)}
</Select>
)}
</Form.Item>
<Form.Item
label="指派成员"
>
{getFieldDecorator('assigned_to_id', {
})(
<Select value={assigned_to_id}>
<Option value="">未指派成员</Option>
{this.renderSelect(data && data.members)}
</Select>
)}
</Form.Item>
</div>
{renderBrances(branches)}
</Select>
</Input.Group>
</div>
</div>
</Form>
</div>
<div style={{ display: this.state.iscreatemerge === 'none' ? 'none' : 'block' }}>
<Table
className="mt20 wrap-commit-table"
columns={columns}
dataSource={titledata}
showHeader={false}
size="small"
pagination={false}
title={() => title()}
/>
</div>
{show_message ? (
<div className="mb50 mt50">
<Alert
description={withHtml(default_message)}
type="error"
/>
</div>
)
:
<MergeForm {...this.props} merge_type="new" data={data} merge={merge?merge:"master"} pull={pull?pull:"master"}></MergeForm>
}
</Spin>
</div>
<div className=" main">
<MergeFooter footer_type="new" {...this.props}></MergeFooter>
</div>
</div>
)
);
}
}
const WrappedNewMerge = Form.create({ name: 'NewMergeFrom' })(NewMerge);
export default WrappedNewMerge;
export default NewMerge;

View File

@ -1,275 +1,116 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder';
import { Modal, Form, Input, Select, Spin } from 'antd'
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
import Attachments from '../Upload/attachment'
import React, { Component } from "react";
import { Input, Select, Button, Spin, Empty } from "antd";
import axios from "axios";
import "../Order/order.css";
import "./merge.css";
import MergeForm from "./merge_form";
import MergeFooter from "./merge_footer";
const Option = Select.Option;
class UpdateMerge extends Component {
constructor(props) {
super(props);
this.state = {
data: undefined,
isShow: false,
imgsrc: '',
journalsdata: undefined,
//图片区域是否显示 none 隐藏 block 显示
display: 'none',
titledisplay: 'none',
subject: '',
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: 0,
issue_type: 0,
status_id: 0,
assigned_to_id: "",
priority_id: 0,
done_ratio: 0,
textcount: "",
fileList: undefined,
get_attachments: undefined,
desc: undefined,
isSpin: false
}
merge: undefined,
pull: undefined,
isSpin: false,
};
}
componentDidMount = () => {
this.getDetail();
}
this.getmergelist();
};
getDetail = () => {
//获取新建分枝数据
getmergelist = () => {
this.setState({ isSpin: true });
const { projectsId, mergeId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}/edit.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
data: result.data,
subject: result.data.issue.subject,
issue_chosen: result.data.issue.issue_chosen,
branches: result.data.issue.branches,
tracker_id: result.data.issue.tracker_id,
issue_type: result.data.issue.issue_type,
status_id: result.data.issue.status_id,
priority_id: result.data.issue.priority_id,
done_ratio: result.data.issue.done_ratio,
textcount: result.data.issue.description,
branch_name: result.data.issue.branch_name,
get_attachments: result.data.issue.attachments,
fileList: undefined,
issue_tag_ids: result.data.issue.issue_tags && result.data.issue.issue_tags[0].id,
fixed_version_id: result.data.issue.fixed_version_id,
assigned_to_id: result.data.issue.assigned_to_id
})
// this.getjournalslist();
}
}).catch((error) => {
console.log(error);
})
}
handleok = () => {
this.setState({
isShow: false
});
};
handleCancel = () => {
this.setState({
isShow: false
});
}
imgshow = () => {
this.setState({
isShow: true
});
};
onContentChange = (value) => {
this.setState({
textcount: value
})
}
changmodelname = (e) => {
this.setState({
subject: e.target.value
})
}
stringJson = (value) => {
let _value = null;
try {
_value = JSON.parse(value);
} catch (e) {
_value = value;
}
return _value
}
renderSelect = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<Option key={key + 1} value={item.id}>{item.name}</Option>
)
})
)
}
}
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({
fileList
})
}
handleSubmit = () => {
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId, mergeId } = this.props.match.params;
const { data, textcount } = this.state;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
if (values.issue_tag_ids === '') {
values.issue_tag_ids = []
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
isSpin: false,
data: result.data,
pull: result.data.head,
merge: result.data.base,
});
} else {
this.setState({ isSpin: false });
}
if (values.assigned_to_id === 0) {
values.assigned_to_id = ""
}
axios.put(url, {
project_id: projectsId,
id: data.issue.id,
attachment_ids: fileList,
body: textcount,
...values
}).then(result => {
if (result) {
this.props.history.push(`/projects/${projectsId}/merge`);
this.setState({
textcount: ''
})
}
}).catch(error => {
console.log(error);
})
}
})
}
})
.catch((error) => {
this.setState({ isSpin: false });
console.log(error);
});
};
render() {
const { projectsId, mergeId } = this.props.match.params;
const { getFieldDecorator } = this.props.form;
const { current_user } = this.props;
const { issue_tag_ids, fixed_version_id, assigned_to_id, issue_chosen, subject, textcount, get_attachments, isSpin } = this.state;
const { data, isSpin, pull, merge } = this.state;
return (
<div className="main">
<div>
<Form>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df" >
<Link to={`/users/${current_user && current_user.login}`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
</Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('title', {
rules: [{
required: true, message: '请填写任务标题'
}],
initialValue: subject
})(
<Input placeholder="标题" onChange={this.changmodelname} />
)}
</Form.Item>
<MDEditor placeholder={'请输入合并请求的描述...'} height={350}
mdID={`orderdetail-add-description`} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{
get_attachments ?
<Attachments attachments={get_attachments} showNotification={this.props.showNotification} canDelete={true} />
:
""
}
<p className="clearfix mt15 text-right">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" style={{ marginLeft: 5 }} onClick={this.handleSubmit}>保存</a>
<Link to={`/projects/${projectsId}/merge/${mergeId}/Messagecount`} className="a_btn cancel_btn fr">取消</Link>
</Spin>
</p>
<div>
<div className="main">
<Spin spinning={isSpin}>
{data ? (
<div>
<div className="merge-header width100 inline-block">
<div className="width45 pull-left">
<div className="color-grey-3 mb10 fwb">源分支:</div>
<Input.Group compact>
<Button className="merge-header-button maxW50 hide-1 task-hide">
{data && data.project_author} /{" "}
{data && data.project_name}
</Button>
<Select
defaultValue={pull ? pull : "master"}
className="minW50"
disabled
></Select>
</Input.Group>
</div>
<div className="width10 pull-left text-center mt25">
<i
className={"iconfont icon-youjiang color-grey-c font-32"}
></i>
</div>
<div className="width45 pull-left">
<div>
<div className="color-grey-3 mb10 fwb">目标分支:</div>
<Input.Group compact>
<Button className="merge-header-button maxW50 hide-1 task-hide">
{data && data.project_author} /{" "}
{data && data.project_name}
</Button>
<Select
defaultValue={merge ? merge : "master"}
className="minW50"
disabled
></Select>
</Input.Group>
</div>
</div>
</div>
<MergeForm
{...this.props}
merge_type="edit"
data={data}
merge={merge}
pull={pull}
></MergeForm>
</div>
<div className="list-left" style={{ paddingRight: "0px", paddingLeft: "15px", paddingTop: "10px" }}>
<div className="list-l-panel">
<Form.Item
label="标签"
>
{getFieldDecorator('issue_tag_ids', {
initialValue: issue_tag_ids ? [issue_tag_ids] : '',
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_tag)}
</Select>
)}
</Form.Item>
<Form.Item
label="里程碑"
>
{getFieldDecorator('fixed_version_id', {
initialValue: fixed_version_id ? fixed_version_id : "",
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_version)}
</Select>
)}
</Form.Item>
<Form.Item
label="指派成员"
>
{getFieldDecorator('assigned_to_id', {
initialValue: assigned_to_id ? assigned_to_id : "",
})(
<Select>
<Option value={''}>未指派成员</Option>
{this.renderSelect(issue_chosen && issue_chosen.assign_user)}
</Select>
)}
</Form.Item>
</div>
</div>
</div>
</Form>
) : (
""
)}
</Spin>
</div>
<div className=" main">
<MergeFooter footer_type="new" {...this.props}></MergeFooter>
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{ textAlign: 'center' }}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" />
</Modal>
</div>
)
);
}
}
const UpdateMergeForm = Form.create({ name: 'UpdateMergeForm' })(UpdateMerge);
export default UpdateMergeForm;
export default UpdateMerge;

View File

@ -37,4 +37,7 @@
}
form .ant-cascader-picker, form .ant-select {
width: 100%;
}
.merge-header-button{
background:rgba(241,248,255,1);
}

View File

@ -1,12 +1,12 @@
import React, { Component } from "react";
import { Input, Dropdown, Menu, Icon, Pagination, Spin } from 'antd';
import './merge.css';
import '../Order/order.css';
import NoneData from '../Nodata';
import OrderItem from './MergeItem';
import { Input, Dropdown, Menu, Icon, Pagination, Spin } from "antd";
import "./merge.css";
import "../Order/order.css";
import "../Order/index.scss";
import NoneData from "./no_data";
import OrderItem from "./MergeItem";
import axios from 'axios';
import axios from "axios";
const Search = Input.Search;
/**
@ -37,68 +37,75 @@ class merge extends Component {
// page: 1,
search_count: undefined,
issue_type: undefined,
status_type: '1',
status_type: undefined,
//设置选择高亮
openselect: 1,
closeselect: undefined,
issue_tag_ids: '标签',
fixed_version_ids: '里程碑',
assigned_to_ids: '指派人',
paix: '排序',
issue_tag_ids: "标签",
fixed_version_ids: "里程碑",
assigned_to_ids: "审查人员",
paix: "排序",
priority_ids: "优先级",
select_params: {
status_type: "1", //开启中和关闭中,默认为开启中的
status_type: undefined, //开启中和关闭中,默认为开启中的
assigned_to_id: undefined, // 指派人
fixed_version_id: undefined,
priority_id: undefined,
order_name: undefined,
order_type: undefined,
search: undefined,
page: 1,
limit: 15,
},
}
};
}
componentDidMount = () => {
this.getSelectList();
this.getIssueList();
}
};
getSelectList = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen: result.data.issue_chosen
})
}
}).catch((error) => {
console.log(error);
})
}
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
issue_chosen: result.data.issue_chosen,
});
}
})
.catch((error) => {
console.log(error);
});
};
// 获取列表数据
getIssueList = () => {
const { select_params } = this.state;
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests.json`;
axios.get(url, {
params: select_params,
}).then((result) => {
if (result) {
this.setState({
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false
})
}
}).catch((error) => {
console.log(error);
})
}
axios
.get(url, {
params: select_params,
})
.then((result) => {
if (result) {
this.setState({
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false,
});
}
})
.catch((error) => {
console.log(error);
});
};
getMenu = (e, id, name) => {
this.setState({
@ -145,22 +152,29 @@ class merge extends Component {
this.state.select_params.page = 1;
this.state[`${id}s`] = name;
this.getIssueList();
}
};
renderMenu = (array, name, id) => {
return (
<Menu>
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>{name}</Menu.Item>
{
array && array.length > 0 && array.map((item, key) => {
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>
{name}
</Menu.Item>
{array &&
array.length > 0 &&
array.map((item, key) => {
return (
<Menu.Item key={item.id} onClick={(e) => this.getOption(e, id, item.name)}>{item.name}</Menu.Item>
)
})
}
<Menu.Item
key={item.id}
onClick={(e) => this.getOption(e, id, item.name)}
>
{item.name}
</Menu.Item>
);
})}
</Menu>
)
}
);
};
// 翻页
ChangePage = (page) => {
@ -169,7 +183,7 @@ class merge extends Component {
});
this.state.select_params.page = page;
this.getIssueList();
}
};
// 搜索
searchFunc = (value) => {
@ -180,69 +194,51 @@ class merge extends Component {
this.state.select_params.search = value;
this.state.select_params.page = 1;
this.getIssueList();
}
};
openorder = (type) => {
// if (type) {
// if (type === 1) {
// this.setState({
// status_type: '1',
// closeselect: undefined,
// openselect: '123',
// issue_tag_ids: '标签',
// fixed_version_ids: '里程碑',
// assigned_to_ids: '指派人',
// paix: '排序'
// })
// this.getIssueList("", "", "", "", "", 1, "");
// } else {
// this.setState({
// status_type: '2',
// openselect: undefined,
// closeselect: '123',
// issue_tag_ids: '标签',
// fixed_version_ids: '里程碑',
// assigned_to_ids: '指派人',
// paix: '排序'
// })
// this.getIssueList("", "", "", "", "", 2, "");
// }
// }
this.setState({
isSpin: true,
});
if (type) {
this.setState({
status_type: type,
issue_tag_ids: '标签',
fixed_version_ids: '里程碑',
assigned_to_ids: '指派人',
paix: '排序'
});
this.state.select_params = {
status_type: type,
search: undefined,
page: 1,
limit: 15,
};
this.getIssueList();
}}
this.setState({
status_type: type,
issue_tag_ids: "标签",
fixed_version_ids: "里程碑",
assigned_to_ids: "审查人员",
paix: "排序",
priority_ids: "优先级",
});
this.state.select_params = {
status_type: type,
search: undefined,
page: 1,
limit: 15,
};
this.getIssueList();
};
islogin() {
const { projectsId } = this.props.match.params;
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
this.props.showLoginDialog();
return;
} else {
this.props.history.push(`/projects/${projectsId}/merge/new`);
}
}
render() {
const { issue_chosen, issues, limit, page, search_count, data, isSpin, status_type, select_params } = this.state;
const { projectsId } = this.props.match.params;
const {
issue_chosen,
issues,
limit,
page,
search_count,
data,
isSpin,
status_type,
select_params,
} = this.state;
const menu = (
<Menu onClick={(e) => this.getMenu(e)}>
<Menu.Item key={"created_on-desc"} value="desc">
@ -262,17 +258,175 @@ class merge extends Component {
const Paginations = (
<React.Fragment>
{
search_count > limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
{search_count > limit ? (
<div className="mt30 mb50 edu-txt-center">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
)
);
return (
<div className="main">
<div className="topWrapper" style={{ borderBottom: "none" }}>
<div className="topWrapper">
<div className="target-detail-search">
<Search
placeholder="输入关键字搜索合并请求"
enterButton
onSearch={this.searchFunc}
style={{ width: 300 }}
/>
</div>
<a className="topWrapper_btn ml10" onClick={() => this.islogin()}>
+&nbsp;新建合并请求
</a>
</div>
<div className="f-wrap-between screenWrap">
<div className="df">
<ul className="searchBanner">
<li
className={!status_type ? "active" : ""}
onClick={() => this.openorder(undefined)}
>
<label>搜索结果</label>
<span>{data && data.search_count}</span>
</li>
<li
className={status_type === "1" ? "active" : ""}
onClick={() => this.openorder("1")}
>
<label>开启的</label>
<span>{data && data.open_count}</span>
</li>
<li
className={status_type === "11" ? "active" : ""}
onClick={() => this.openorder("11")}
>
<label>已合并</label>
<span>{data && data.merged_issues_size}</span>
</li>
<li
className={status_type === "2" ? "active" : ""}
onClick={() => this.openorder("2")}
>
<label>已关闭</label>
<span>{data && data.close_count}</span>
</li>
</ul>
</div>
<ul className="topWrapper_select">
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.priority,
"优先级",
"priority_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.priority_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_tag,
"标签",
"issue_tag_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.issue_tag_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"审查人员",
"assigned_to_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.assigned_to_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_version,
"里程碑",
"fixed_version_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.fixed_version_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={menu}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.paix}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
</ul>
</div>
{data && data.search_count && data.search_count > 0 ? (
<div>
<Spin spinning={isSpin}>
<OrderItem
issues={issues}
search_count={search_count}
page={select_params.page}
limit={select_params.limit}
project_name={data.project_name}
{...this.props}
{...this.state}
></OrderItem>
{Paginations}
</Spin>
</div>
) : (
<NoneData _html="暂时还没有相关数据哦!" projectsId={projectsId} />
)}
{/* <div className="topWrapper" style={{ borderBottom: "none" }}>
<p className="topWrapper_type_infos">
<li className={status_type === "1" ? "active" : ""} onClick={() => this.openorder("1")}>{data && data.open_count ? data.open_count : 0}个开启中</li>
<li className={status_type === "2" ? "active" : ""} onClick={() => this.openorder("2")}>{data && data.close_count ? data.close_count : 0}个已关闭</li>
@ -326,11 +480,9 @@ class merge extends Component {
</div>
:
<NoneData _html="暂时还没有相关数据哦!" />
}
} */}
</div>
)
);
}
}
export default merge;

View File

@ -0,0 +1,47 @@
import React, { Component } from "react";
import { Tabs, Empty } from "antd";
import "../Order/order.css";
import "./merge.css";
import CodesCommit from "../Main/CoderRootCommit";
import Comments from "../comments/comments";
const { TabPane } = Tabs;
class MergeFooter extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
const { footer_type, order_id } = this.props;
return (
<div>
<Tabs
defaultActiveKey={footer_type === "show" ? "1" : "2"}
className="custom-commit-tabs"
>
{
footer_type === "show" &&
<TabPane tab={<span className="ml-3 font-16">评论</span>} key="1">
<Comments
order_id={order_id}
showNotification={this.props.showNotification}
only_show_content={true}
{...this.props}
/>
</TabPane>
}
<TabPane tab={<span className="ml-3 font-16">提交</span>} key="2">
<CodesCommit {...this.props} main_class="pd10"></CodesCommit>
</TabPane>
<TabPane tab={<span className="ml-3 font-16">文件</span>} key="3">
<Empty />
</TabPane>
</Tabs>
</div>
);
}
}
export default MergeFooter;

View File

@ -0,0 +1,404 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Button, Form, Menu, Input, Select, Tag, Checkbox } from "antd";
import axios from "axios";
import "../Order/order.css";
import "./merge.css";
import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor";
const Option = Select.Option;
class MergeForm extends Component {
constructor(props) {
super(props);
this.state = {
desc: undefined,
issue_tag_ids: undefined,
fixed_version_id: undefined,
assigned_to_id: undefined,
titledata: undefined,
isSpin: false,
mergedata: undefined,
priority_id: undefined,
title: undefined,
};
}
componentDidMount = () => {
this.set_defatul();
};
set_defatul = () => {
const { data, merge_type } = this.props;
if (data && merge_type === "edit") {
this.setState({
desc: data.body,
issue_tag_ids: data.issue_tag_ids[0],
fixed_version_id: String(data.fixed_version_id),
assigned_to_id: String(data.assigned_to_id),
priority_id: String(data.priority_id),
title: data.title,
});
}
this.InitData();
};
InitData = () => {
setTimeout(() => {
this.props.form.setFieldsValue({
...this.state,
});
}, 100);
};
onPanelChange = (time, mode) => {
this.setState({
value: time,
});
};
onSelect = (time) => {
this.setState({
value: time,
selectedValue: time,
});
};
renderMenu = (array, id) => {
return (
<Menu>
{array &&
array.length > 0 &&
array.map((item, key) => {
return (
<Menu.Item key={item} onClick={() => this.getOption(item, id)}>
{item}
</Menu.Item>
);
})}
</Menu>
);
};
renderSelect = (list) => {
if (list && list.length > 0) {
return list.map((item, key) => {
return (
<Option key={key + 1} value={item.id + ""}>
{item.name}
</Option>
);
});
}
};
//创建合并请求
handleSubmit = () => {
this.setState({
isSpin: true,
});
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId, mergeId } = this.props.match.params;
const { merge, pull, merge_type } = this.props;
if (values.issue_tag_ids && values.issue_tag_ids.length > 0) {
values.issue_tag_ids = [parseInt(values.issue_tag_ids)];
} else {
values.issue_tag_ids = [];
}
const { desc } = this.state;
if (merge_type === "new") {
let url = `/projects/${projectsId}/pull_requests.json`;
axios
.post(url, {
...values,
body: desc,
head: pull,
base: merge,
})
.then((result) => {
if (result) {
this.setState({
isSpin: false,
});
this.props.history.push(`/projects/${projectsId}/merge`);
// const { getDetail } = this.props;
// getDetail && getDetail();
} else {
this.setState({
isSpin: false,
});
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
} else {
let url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
axios
.put(url, {
...values,
body: desc,
head: pull,
base: head,
})
.then((result) => {
if (result) {
this.setState({
isSpin: false,
});
this.props.history.push(`/projects/${projectsId}/merge/${mergeId}/Messagecount`);
} else {
this.setState({
isSpin: false,
});
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
}
} else {
this.setState({
isSpin: false,
});
}
});
};
onContentChange = (value) => {
this.setState({
desc: value,
});
};
render() {
const { merge_type, data } = this.props;
const { getFieldDecorator } = this.props.form;
const { projectsId, mergeId } = this.props.match.params;
const {
issue_tag_ids,
fixed_version_id,
assigned_to_id,
priority_id,
desc,
isSpin,
title,
} = this.state;
return (
<div>
<div className="mt20 mb20">
<span className="font-16 fwb mr10 ver-middle">
{merge_type === "new" ? "新建" : "编辑"}合并请求:
</span>
<Tag color="#28BD6C" className="ver-middle">
可合并的
</Tag>
</div>
<Form>
<div className="width100 inline-block">
<div className="width70 pull-left">
<Form.Item>
{getFieldDecorator("title", {
rules: [
{
required: true,
message: "请填写请求标题",
},
],
initialValue: title,
})(<Input placeholder="标题" />)}
</Form.Item>
<MDEditor
placeholder={"请输入合并请求的描述..."}
height={350}
mdID={"merge-new-description"}
initValue={desc}
onChange={this.onContentChange}
></MDEditor>
<p className="clearfix mt20">
<Button
type="primary"
loading={isSpin}
onClick={this.handleSubmit}
>
<span className="plr10">
{merge_type === "new" ? "创建" : "提交"}
</span>
</Button>
<Button
type="default"
className="ml30"
href={
merge_type === "new"
? `/projects/${projectsId}/merge`
: `/projects/${projectsId}/merge/${mergeId}/detail`
}
>
<span className="plr10">取消</span>
</Button>
</p>
</div>
<div className="width30 pull-left">
<div className="pl30">
<Form.Item>
{getFieldDecorator("assigned_to_id", {
initialValue: assigned_to_id,
})(
<Select placeholder="审查人员" showSearch>
{this.renderSelect(data && data.members)}
</Select>
)}
</Form.Item>
<Form.Item>
{getFieldDecorator("fixed_version_id", {
initialValue: fixed_version_id,
})(
<Select
placeholder={
data && data.issue_versions.length > 0
? "未选择里程碑"
: "请添加里程碑"
}
showSearch
>
{this.renderSelect(data && data.issue_versions)}
</Select>
)}
</Form.Item>
<Form.Item>
{getFieldDecorator("issue_tag_ids", {
initialValue: issue_tag_ids,
})(
<Select
placeholder={
data && data.issue_tags.length > 0
? "未选择标签"
: "请在仓库设置里添加标签"
}
showSearch
>
{this.renderSelect(data && data.issue_tags)}
</Select>
)}
</Form.Item>
<Form.Item>
{getFieldDecorator("priority_id", {
initialValue: priority_id,
})(
<Select placeholder="优先级" showSearch>
{this.renderSelect(data && data.issue_priories)}
</Select>
)}
</Form.Item>
<Form.Item name="checkbox-group" label="其他">
<Checkbox.Group>
<div>
<Checkbox value="A">必须审查代码</Checkbox>
</div>
<div>
<Checkbox value="B">合并后删除提交分支</Checkbox>
</div>
<div>
<Checkbox value="C">合并后关闭提到的任务</Checkbox>
</div>
</Checkbox.Group>
</Form.Item>
</div>
</div>
</div>
</Form>
</div>
// <div className="main">
// <h1 className="mb10">创建合并请求</h1>
// <div style={{ display: this.state.iscreatemerge === 'none' ? 'block' : 'none' }}>
// <div className="mergediv" style={{ marginTop: 15 }} >
// {pull()}
// </div>
// </div>
// <div style={{ display: this.state.iscreatemerge === 'none' ? 'none' : 'block' }}>
// <Form>
// <div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
// <div className="list-right df" style={{ padding: "0px", paddingTop: "10px" }}>
// <Link to={`/users/${current_user && current_user.login}`} className="show-user-link">
// <img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
// </Link>
// <div className="new_context">
// <Form.Item>
// {getFieldDecorator('title', {
// rules: [{
// required: true, message: '请填写请求标题'
// }],
// })(
// <Input placeholder="标题" />
// )}
// </Form.Item>
// <MDEditor placeholder={'请输入合并请求的描述...'} height={350}
// mdID={'merge-new-description'} initValue={desc} onChange={this.onContentChange} ></MDEditor>
// <UploadComponent load={this.UploadFunc} isComplete={true} ></UploadComponent>
// <p className="clearfix mt15">
// <Spin spinning={isSpin}>
// <a className="topWrapper_btn fr" type="submit" onClick={this.submit}>创建合并请求</a>
// </Spin>
// </p>
// </div>
// </div>
// <div className="list-left" style={{ paddingRight: "0px", paddingLeft: "15px", paddingTop: "10px" }}>
// <div className="list-l-panel">
// <Form.Item
// label="标签"
// >
// {getFieldDecorator('issue_tag_ids', {
// rules: [],
// })(
// <Select value={issue_tag_ids}>
// <Option value="">{data && data.issue_tags.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
// {this.renderSelect(data && data.issue_tags)}
// </Select>
// )}
// </Form.Item>
// <Form.Item
// label="里程碑"
// >
// {getFieldDecorator('fixed_version_id', {
// rules: [],
// })(
// <Select value={fixed_version_id}>
// <Option value="">{data && data.issue_versions.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
// {this.renderSelect(data && data.issue_versions)}
// </Select>
// )}
// </Form.Item>
// <Form.Item
// label="指派成员"
// >
// {getFieldDecorator('assigned_to_id', {
// })(
// <Select value={assigned_to_id}>
// <Option value="">未指派成员</Option>
// {this.renderSelect(data && data.members)}
// </Select>
// )}
// </Form.Item>
// </div>
// </div>
// </div>
// </Form>
// </div>
// </div>
);
}
}
const WrappedNewMerge = Form.create({ name: "NewMergeForm" })(MergeForm);
export default WrappedNewMerge;

View File

@ -0,0 +1,22 @@
import React , { Component } from 'react';
import { Link } from "react-router-dom";
class Nodata extends Component{
render(){
const { _html, projectsId } = this.props;
return(
<div className="none_panels">
<div>
<div className="mb15">
<i className="iconfont icon-hebingqingqiu font-80 ver-middle color-grey-8"></i>
</div>
<h3>欢迎使用合并请求</h3>
<div className="color-grey-8">
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/projects/${projectsId}/merge/new`}>合并请求</Link>
</div>
</div>
</div>
)
}
}
export default Nodata;

View File

@ -18,7 +18,7 @@ class OrderItem extends Component {
return (
issue_tags.map((item, key) => {
return (
<Tag color={item.color} className="mlr10" key={key}>{item.name}</Tag>
<span className="mr10">{item.name}</span>
)
})
)

View File

@ -225,7 +225,7 @@
display: flex;
flex-wrap: wrap;
align-content: center;
border-bottom: 1px dashed #cecdcd;
border-bottom: 1px solid #eee;
padding: 16px 0px 16px 20px;
}
.issueNo {
@ -725,4 +725,6 @@ a.issue-type-button.active:hover {
vertical-align: middle;
}
.boder-4{border-radius: 4px;}
.pbt20{padding: 20px 0;}
.pbt20{padding: 20px 0;}
.inline-block{display: inline-block;}
.pd10{padding: 10px;}

23
src/forge/Team/Box.jsx Normal file
View File

@ -0,0 +1,23 @@
import React from 'react';
export default (({ name , count , bottom , children })=>{
return(
<div className="box">
<div className="head">
<span>{name}</span>
<span>{count}<i className="iconfont icon-youjiantou font-12 ml3"></i></span>
</div>
<div className="content">
{children}
</div>
{
bottom ?
<div className="foot">
{bottom}
</div>
:""
}
</div>
)
})

33
src/forge/Team/Detail.jsx Normal file
View File

@ -0,0 +1,33 @@
import React , { useEffect , useState } from 'react';
import { Route, Switch } from "react-router-dom";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import Cards from '../Component/Cards';
import './Index.scss';
const DetailIndex = Loadable({
loader: () => import("./List"),
loading: Loading,
});
export default ((props)=>{
return(
<div className="teamDetail">
<Cards
title="组织名称"
desc="组织名称组织名称组织名称组织名称组织名称"
rightBtn={<a className="color-blue">设置<i className="iconfont icon-shezhi2 ml3"></i></a>}
img={`https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=4193840146,2109186388&fm=26&gp=0.jpg`}
/>
<Switch {...props}>
<Route
path="/organize/:organizeId"
render={(props) => {
return <DetailIndex {...props} />
}}
></Route>
</Switch>
</div>
)
})

View File

@ -0,0 +1,35 @@
import React from 'react';
import Cards from '../Component/MemberCards';
export default (()=>{
return(
<div>
<div className="MemberBoxThree">
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={true}
/>
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={true}
/>
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={true}
/>
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={true}
/>
</div>
</div>
)
})

View File

@ -0,0 +1,35 @@
import React from 'react';
import styled from 'styled-components';
import { Link } from 'react-router-dom';
const Box=styled.div`{
padding:0px 38px;
}`
const Div = styled.div`{
display:flex;
align-items: center;
margin-left:10px;
padding:25px 0px;
border-bottom:1px solid #eee;
}`
const Imgs = styled.img`{
width:30px;
height:30px;
margin-right:12px;
border-radius:50%;
}`
export default (()=>{
return(
<Box>
<Div>
<Imgs src="https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"/>
<Link to={""}>ajdfwkerijwirjklsf</Link>
</Div>
<Div>
<Imgs src="https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"/>
<Link to={""}>ajdfwkerijwirjklsf</Link>
</Div>
</Box>
)
})

View File

@ -0,0 +1,50 @@
import React , {useState} from 'react';
import { Button } from 'antd';
import styled from 'styled-components';
import { Box , Short , Long , Gap , WhiteBack , AlignCenterBetween } from '../Component/layout';
import Tabs from '../Component/Tabs';
import Memberlist from './GroupDetailMember';
import Grouplist from './GroupDetailProject';
const Leave = styled.a`{
display:block;
border-radius:5px;
border:1px solid rgba(40,189,108,1);
color:rgba(40,189,108,1);
padding:0px 14px;
height:30px;
line-height:30px;
}`
export default ((props)=>{
const [ nav , setNav ] = useState('0');
return(
<Box className="GroupSubLevel">
<Short className="g-sub-left">
<AlignCenterBetween>
<span className="color-grey-3">Owndsknamename</span>
<Leave>离开团队</Leave>
</AlignCenterBetween>
<div className="g-desc">该团队暂无描述</div>
<div className="g-tip">
<p>管理员团队对 <span>所有仓库</span> 具有操作权限且对组织具有 <span>管理员权限</span> </p>
<p>此外该团队拥有了 <span>创建仓库</span> 的权限成员可以在组织中创建新的仓库 </p>
<Button type="primary">团队设置</Button>
</div>
</Short>
<Long>
<Gap>
<WhiteBack>
<Tabs nav={['团队成员','团队项目']} index={nav} onChange={setNav}>
{
nav === "0" ?
<Memberlist />:<Grouplist />
}
</Tabs>
</WhiteBack>
</Gap>
</Long>
</Box>
)
})

View File

@ -1,13 +1,13 @@
import React from 'react';
import { Route, Switch } from "react-router-dom";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import '../css/index.css';
@ -15,17 +15,39 @@ const New = Loadable({
loader: () => import("./New"),
loading: Loading,
});
const DetailIndex = Loadable({
loader: () => import("./Detail"),
loading: Loading,
});
const SubDetail = Loadable({
loader: () => import("./SubDetail"),
loading: Loading,
});
export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
((props)=>{
return (
<Switch {...props}>
<Route
path="/organize/new"
render={(props) => {
return <New {...props} />;
}}
></Route>
</Switch>
<div className="newMain">
<Switch {...props}>
<Route
path="/organize/:organizeId/member"
render={(props) => {
return <SubDetail {...props} />
}}
></Route>
<Route
path="/organize/new"
render={(props) => {
return <New {...props} />
}}
></Route>
<Route
path="/organize/:organizeId"
render={(props) => {
return <DetailIndex {...props} />
}}
></Route>
</Switch>
</div>
)
})
)))

View File

@ -12,13 +12,14 @@
font-size: 18px;
}
.teamBox-form{
padding:24px 40px;
padding:24px 40px 0px 40px;
}
.lables{
position: relative;
color:#333;
margin-bottom: 5px;
display: block;
font-size: 16px;
}
.lables.must::before{
content: "*";
@ -28,4 +29,247 @@
left: -15px;
height: 100%;
}
}
}
.ant-btn.grey{
background: #bbb;
color: #fff;
border: 1px solid #bbb;
}
.teamDetail{
width: 1200px;
margin:0px auto;
}
.list{
display: flex;
align-items: flex-start;
.list-l{
background-color: #fff;
max-width: 860px;
width: 72%;
.head{
padding:16px 32px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
.addBtn{
display: inline-block;
border-radius: 5px;
border:1px solid #5091FF;
color: #5091FF;
height: 30px;
line-height: 30px;
padding:0px 10px;
}
}
.team{
padding:0px 32px;
.team_project{
padding:22px 0px;
border-bottom: 1px solid #eee;
.t_p_title{
display: flex;
align-items: center;
justify-content: space-between;
.name{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 18px;
max-width: 500px;
float: left;
}
}
.desc{
color: #333;
margin-top: 6px;
margin-bottom: 3px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
&:last-child{
border-bottom: none;;
}
}
}
}
.list-r{
width: 28%;
max-width: 340px;
padding-left: 20px;
box-sizing: border-box;
}
.box{
background:rgba(255,255,255,1);
border-radius:5px;
margin-bottom: 20px;
.head{
padding:25px 20px;
display: flex;
border-bottom: 1px solid #eee;
justify-content: space-between;
color: #333;
}
.content{
padding:13px 0px;
.teammembers{
display: flex;
align-items: center;
padding:13px 20px;
.m-img{
border-radius: 50%;
width:45px;
height: 45px;
margin-right: 12px;
}
}
}
.foot{
padding:15px 20px;
border-top: 1px solid #eee;
}
}
}
.subNavs{
display: flex;
a{
display: block;
margin-left: 14px;
height: 40px;
padding:0px 22px;
border-radius: 2px;
border:1px solid #eee;
background-color: #fafafa;
color:#333;
display: flex;
align-items: center;
font-size: 14px;
span{
display: block;
height: 18px;
line-height: 18px;
}
lable{
display: block;
padding:0px 7px;
background-color:#eee;
height: 18px;
line-height: 18px;
font-size: 12px;
border-radius: 10px;
margin-left: 5px;
}
&.active{
border:1px solid #5091FF;
color: #5091FF;
lable{
background-color: #F1F8FF;
color: #5091FF;
}
}
}
}
// 组织团队
.groupBox{
display: flex;
flex-wrap: wrap;
align-items: flex-start;
background-color: #fff;
padding:30px 35px;
margin-bottom: 30px;
&>div{
border:1px solid #eee;
background-color: #fff;
width: 48.5%;
margin-right: 3%;
margin-bottom: 30px;
.g-head,.g-foot{
display: flex;
justify-content: space-between;
background-color: #F1F8FF;
padding:10px 10px 10px 25px;
align-items: center;
}
.g-foot{
background-color: #fafafa;
justify-content: left;
}
.g-body{
padding:15px 25px;
}
}
&>div:nth-child(2n){
margin-right: 0px;
}
}
// 组织成员-一行四个
.memberBox{
display: flex;
align-items: flex-start;
flex-wrap: wrap;
background-color: #fff;
padding:24px 35px;
margin-bottom: 30px;
min-height: 400px;
align-content: flex-start;
&>div{
width:22.75% ;
margin-right: 3%;
.m-infos{
flex:1;
}
}
&>div:nth-child(4n){
margin-right: 0px;
}
}
// 团队成员-一行三个
.MemberBoxThree{
display: flex;
align-items: flex-start;
flex-wrap: wrap;
background-color: #fff;
padding:24px 35px;
margin-bottom: 30px;
min-height: 400px;
align-content: flex-start;
&>div{
width:31% ;
margin-right: 3.5%;
.m-infos{
flex:1;
}
}
&>div:nth-child(3n){
margin-right: 0px;
}
}
// 团队详情成员项目
.GroupSubLevel{
display: flex;
align-items: flex-start;
.g-sub-left{
background-color: #fff;
.g-desc{
padding:18px 20px;
color:#333;
min-height: 100px;
}
.g-tip{
padding:28px 20px;
border-top: 1px solid #eee;
&>p{
margin-bottom: 10px!important;
}
&>p>span{
color:#333;
}
&>button{
margin-top: 10px;
}
}
}
}

124
src/forge/Team/List.jsx Normal file
View File

@ -0,0 +1,124 @@
import React from 'react';
import { Button } from 'antd';
import Search from '../Component/Search';
import Sort from '../Component/Sort';
import ListCount from '../Component/ListCount';
import Box from './Box';
import './Index.scss';
import styled from 'styled-components';
import { Menu } from 'antd';
const Span = styled.span`{
color:#888;
font-size:12px;
margin-right:10px;
}`
const Align = styled.div`{
display:flex;
aligin:center;
}`
const ListName = styled.div`{
font-size:14px;
color:#333;
margin-bottom:8px;
height:18px;
line-height:18px;
}`;
const ColorListName = styled.div`{
color:#5091FF;
font-size:14px;
margin-bottom:8px;
height:18px;
line-height:18px;
}`
const Img = styled.img`{
border-radius:50%;
width:45px;
height:45px;
margin-right:12px;
}`
export default (()=>{
function onSearch(value){
}
const menu=(
<Menu>
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
<Menu.Item key="created_on">项目数排序</Menu.Item>
</Menu>
)
const menu_new=(
<Menu>
<Menu.Item key="updated_on">新建托管项目</Menu.Item>
<Menu.Item key="created_on">新建镜像项目</Menu.Item>
</Menu>
)
const leftList = (
<div className="team_project">
<p className="t_p_title">
<span className="flex1">
<span className="name">react项目react项目react项目react项目</span>
<i className="iconfont icon-banbenku font-20 color-green" />
<i className="iconfont icon-jingxiang font-18 color-green" />
<i className="iconfont icon-fork font-18 color-orange" />
</span>
<ListCount fork={1} parise={0}/>
</p>
<div className="desc">
用于构建用户界面的 JavaScript
</div>
<div className="infos">
<span className="font-12 color-grey-8">更新于1天前</span>
</div>
</div>
)
return(
<div className="list">
<div className="list-l">
<div className="head">
<div style={{width:"370px"}}>
<Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/>
</div>
<p>
<Sort menu={menu_new}>
<a className="addBtn mr30">+&nbsp;新建项目</a>
</Sort>
<Sort menu={menu}>
<a className="color-blue">排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
</Sort>
</p>
</div>
<div className="team">
{leftList}
</div>
</div>
<div className="list-r">
<Box name="组织成员" count={8}>
<div className="teammembers">
<Img src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1990625098,3468619056&fm=111&gp=0.jpg" alt="" className="m-img"/>
<div>
<ListName>陈Professer</ListName>
<Align><i className="iconfont icon-shijian color-green mr3 font-13"></i><Span>加入时间2020-04-28</Span></Align>
</div>
</div>
</Box>
<Box
name="组织团队"
count={3}
bottom={<Button type={'primary'} to={``}>新建团队</Button>}
>
<div className="teammembers">
<div>
<ColorListName>陈Professer</ColorListName>
<Align>
<Span>2名成员</Span>
<Span>1个仓库</Span>
</Align>
</div>
</div>
</Box>
</div>
</div>
)
})

View File

@ -1,13 +1,17 @@
import React,{ forwardRef , useCallback } from 'react';
import './Index.scss';
import { Form , Input , Cascader , Checkbox , Upload } from "antd";
import { Form , Input , Cascader , Radio , Checkbox , Upload , Button } from "antd";
import { locData } from "../Utils/locData";
export default Form.create()(
forwardRef(({form})=>{
const { getFieldDecorator, validateFields, setFieldsValue } = form;
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
}
const helper = useCallback(
(label, name, rules, widget, isRequired = true) => (
<React.Fragment>
@ -52,11 +56,11 @@ export default Form.create()(
'可见性',
"exposure",
[{ required: true, message: "请选择可见性" }],
<Checkbox.Group>
<Checkbox value="1" key={1}>公开</Checkbox>
<Checkbox value="2" key={2}>受限<span className="color-grey-8">仅对登录用户可见</span></Checkbox>
<Checkbox value="3" key={3}>公开<span className="color-grey-8">仅对组织成员可见</span></Checkbox>
</Checkbox.Group>
<Radio.Group name="exposure">
<Radio style={radioStyle} value="1" key={1}>公开</Radio>
<Radio style={radioStyle} value="2" key={2}>受限<span className="color-grey-8">仅对登录用户可见</span></Radio>
<Radio style={radioStyle} value="3" key={3}>公开<span className="color-grey-8">仅对组织成员可见</span></Radio>
</Radio.Group>
)}
{helper(
'选择头像',
@ -72,6 +76,10 @@ export default Form.create()(
)}
</Form>
</div>
<p className="mt20">
<Button type="primary" className="mr30">创建组织</Button>
<Button className="grey">取消</Button>
</p>
</div>
</div>
)

View File

@ -0,0 +1,57 @@
import React from 'react';
import { Route, Switch , Link } from "react-router-dom";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import './Index.scss';
import Cards from '../Component/Cards';
const Group = Loadable({
loader: () => import("./TeamGroup"),
loading: Loading,
});
const Member = Loadable({
loader: () => import("./TeamMember"),
loading: Loading,
});
const GroupDetails = Loadable({
loader: () => import("./GroupDetails"),
loading: Loading,
});
export default ((props)=>{
return(
<div className="teamDetail">
<Cards
title="组织名称"
rightBtn={
<span className="subNavs">
<Link to={``} className="active"><span>组织成员</span><lable>13</lable></Link>
<Link to={``}><span>组织团队</span><lable>13</lable></Link>
</span>
}
img={`https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=4193840146,2109186388&fm=26&gp=0.jpg`}
/>
<Switch {...props}>
<Route
path="/organize/:organizeId/member/:memberId"
render={(props) => {
return <GroupDetails {...props} />
}}
></Route>
<Route
path="/organize/:organizeId/member"
render={(props) => {
return <Member {...props} />
}}
></Route>
<Route
path="/organize/:organizeId/group"
render={(props) => {
return <Group {...props} />
}}
></Route>
</Switch>
</div>
)
})

View File

@ -0,0 +1,49 @@
import React from 'react';
import { Banner } from '../Component/layout';
import styled from 'styled-components';
const SpanName = styled.span`{
font-size:16px;
color:#333;
}`
const SpanFoot = styled.span`{
margin-right:5px;
color:#333
}`
const ALink = styled.a`{
border:1px solid #F73030;
color:#F73030!important;
height:30px;
line-height:30px;
padding:0px 15px;
border-radius:5px;
}`
const ImgContent = styled.img`{
height:44px;
width:44px;
border-radius:50%;
margin:5px 20px 5px 0px;
}`
export default (()=>{
return(
<div>
<Banner>组织团队</Banner>
<div className="groupBox">
<div>
<p className="g-head">
<SpanName>oweners</SpanName>
<ALink>离开团队</ALink>
</p>
<div className="g-body">
<ImgContent src="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"/>
<ImgContent src="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"/>
</div>
<p className="g-foot">
<SpanFoot>2&nbsp;名成员</SpanFoot>
<SpanFoot>1&nbsp;个项目</SpanFoot>
</p>
</div>
</div>
</div>
)
})

View File

@ -0,0 +1,25 @@
import React from 'react';
import { Banner } from '../Component/layout';
import Cards from '../Component/MemberCards';
export default (()=>{
return(
<div>
<Banner>组织成员</Banner>
<div className="memberBox">
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={true}
/>
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={false}
/>
</div>
</div>
)
})

View File

@ -100,7 +100,7 @@ class Index extends Component {
return (
<Dragger {...upload} className={this.props.className}>
{ icon || <Icon type="inbox" />}
<p className="ant-upload-text">拖动文件或<span className="color-blue">点击此处上传</span></p>
<p className="ant-upload-text font-14">拖动文件或<span className="color-blue">点击此处上传</span></p>
</Dragger>
)
}

View File

@ -15,10 +15,10 @@
.plr-20 {
padding: 0 20px;
}
.font-18 {
/* .font-18 {
font-size: 18px;
font-weight: 600;
}
} */
.font-12 {
font-size: 12px;
}

View File

@ -26,6 +26,9 @@ export default Form.create()(
const [attachment, setAttachment] = useState(undefined);
const [options , setOptions] = useState(undefined);
const repo_id = projectDetail && projectDetail.repo_id;
const { projectsId, versionId } = match.params;
useEffect(()=>{
getBranchs(projectsId);
},[projectsId])
@ -41,9 +44,6 @@ export default Form.create()(
line-height: 35px;
`;
const repo_id = projectDetail && projectDetail.repo_id;
const { projectsId, versionId } = match.params;
useEffect(() => {
if (versionId) {

View File

@ -283,7 +283,7 @@ class comments extends Component {
orderId,
new_journal_id,
} = this.state;
const { current_user } = this.props;
const { current_user, only_show_content } = this.props;
const Paginations = (
<React.Fragment>
@ -303,10 +303,6 @@ class comments extends Component {
</React.Fragment>
);
// const comment_meditor = (
// )
const new_comment = (is_reply, item_id) => {
return (
<div className="grid-item-top pb10">
@ -466,62 +462,110 @@ class comments extends Component {
};
return (
<div className="mt20">
<div className="comment-background pd10 mb10">
<Tabs defaultActiveKey="1" className="custom-comment-tabs">
<TabPane
tab={
<span className="ml-3 font-16">
评论
{search_count > 0 && (
<span className="search-count-button">{search_count}</span>
)}
</span>
}
key="1"
>
<div className="mb10">
{is_reply && !reply_id ? (
<div className="pd20">{new_comment(is_reply, undefined)}</div>
) : (
<div className="children-comment-bg pd20 grid-item">
<img
className="radius"
src={
current_user && current_user.image_url
? getImageUrl(`images/${current_user.image_url}`)
: "images/avatars/User/b"
}
alt=""
width="30"
height="30"
/>
<span className="reply-comment-input mr20">
<Button
className="add_reply_button ml10"
onClick={() => this.add_reply(undefined)}
>
<span>添加评论...</span>
</Button>
</span>
</div>
)}
</div>
{journalsdata && journalsdata.journals_total_count > 0 && (
<List
size="large"
loading={isSpin}
header=""
dataSource={journalsdata.issue_journals}
renderItem={(item) => (
<List.Item>{renderList(item)}</List.Item>
)}
/>
<div>
{only_show_content ? (
<div>
<div className="mb10">
{is_reply && !reply_id ? (
<div className="pd20">{new_comment(is_reply, undefined)}</div>
) : (
<div className="children-comment-bg pd20 grid-item">
<img
className="radius"
src={
current_user && current_user.image_url
? getImageUrl(`images/${current_user.image_url}`)
: "images/avatars/User/b"
}
alt=""
width="30"
height="30"
/>
<span className="reply-comment-input mr20">
<Button
className="add_reply_button ml10"
onClick={() => this.add_reply(undefined)}
>
<span>添加评论...</span>
</Button>
</span>
</div>
)}
</TabPane>
</Tabs>
{Paginations}
</div>
</div>
{journalsdata && journalsdata.journals_total_count > 0 && (
<List
size="large"
loading={isSpin}
header=""
dataSource={journalsdata.issue_journals}
renderItem={(item) => <List.Item>{renderList(item)}</List.Item>}
/>
)}
{Paginations}
</div>
) : (
<div className="mt20">
<div className="comment-background pd10 mb10">
<Tabs defaultActiveKey="1" className="custom-comment-tabs">
<TabPane
tab={
<span className="ml-3 font-16">
评论
{search_count > 0 && (
<span className="search-count-button">
{search_count}
</span>
)}
</span>
}
key="1"
>
<div className="mb10">
{is_reply && !reply_id ? (
<div className="pd20">
{new_comment(is_reply, undefined)}
</div>
) : (
<div className="children-comment-bg pd20 grid-item">
<img
className="radius"
src={
current_user && current_user.image_url
? getImageUrl(`images/${current_user.image_url}`)
: "images/avatars/User/b"
}
alt=""
width="30"
height="30"
/>
<span className="reply-comment-input mr20">
<Button
className="add_reply_button ml10"
onClick={() => this.add_reply(undefined)}
>
<span>添加评论...</span>
</Button>
</span>
</div>
)}
</div>
{journalsdata && journalsdata.journals_total_count > 0 && (
<List
size="large"
loading={isSpin}
header=""
dataSource={journalsdata.issue_journals}
renderItem={(item) => (
<List.Item>{renderList(item)}</List.Item>
)}
/>
)}
</TabPane>
</Tabs>
{Paginations}
</div>
</div>
)}
</div>
);
}

View File

@ -1338,15 +1338,6 @@ samp {
padding: 16px 0px;
}
/* FORM START */
.ant-form label {
/* 为了覆盖antd的样式这里使用了importantTODO */
font-size: 16px !important;
}
.ant-form label.font-18 {
font-size: 18px !important;
}
.ant-form label.font-14 {
font-size: 14px !important;

View File

@ -7,7 +7,6 @@ import { CenterBtnGrp, SaveBtn, CancelBtn } from "../util/GeneralButton";
import { useLoaded } from "../util/hooks";
import { updateResume } from "../data/updateResume";
import { getResume } from "../data/getResume";
import Nav from "../util/Nav";
const Backgroud = styled(FullScreen)`
background: rgba(245, 246, 249, 1);

View File

@ -8,13 +8,13 @@ import './TPMIndex.css';
import LoginDialog from '../login/LoginDialog';
import AccountProfile from '../user/AccountProfile';
import AccountPhoneemail from '../user/AccountPhoneemail';
const $ = window.$;
import cookies from 'react-cookies';
export function TPMIndexHOC(WrappedComponent) {
// 这里如果extends WrappedComponent 会出现 WrappedComponent mount twice的问题
return class II extends React.Component {
constructor(props) {
super(props)
console.log("cook ",cookies.load("autologin_trustie"));
super(props);
window.$('#root').css('position', 'relative')
this.state = {
@ -43,47 +43,8 @@ export function TPMIndexHOC(WrappedComponent) {
current_user: newUser
})
}
showShixun = () => {
const { shixunId } = this.props.match.params
const url = `/api/v1/shixuns/${shixunId}/show_shixun`
this.setState({ tpmLoading: true })
axios.get(url,
{
withCredentials: true
}
).then((response) => {
if (response.data && response.data.shixun) {
this.initCommonState(response.data.current_user)
response.data.tpmLoading = false;
this.setState(response.data);
}
}).catch((error) => {
console.log(error)
})
}
aboutFocus = () => {
const { creator, watched } = this.state
/*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
const focusUrl = `/api/v1/users/${creator.owner_id}/${watched ? 'unwatch' : 'watch'}?object_id=${creator.owner_id}&object_type=user`
axios.get(focusUrl, {
})
.then((response) => {
const status = response.data.status;
if (status == 1) {
const new_author_info = Object.assign({}, creator)
this.setState({
watched: !watched
})
}
}).catch((error) => {
console.log(error)
})
}
keyupListener = (e) => {
if (e.key === "Escape") {
this.setState({ globalLoading: false })
@ -92,10 +53,11 @@ export function TPMIndexHOC(WrappedComponent) {
componentWillUnmount() {
window.removeEventListener('keyup', this.keyupListener)
}
componentWillMount(){
this.fetchUsers();
}
componentDidMount() {
// console.log("TPMIndexHOC========");
// console.log(this.props);
window.addEventListener('keyup', this.keyupListener)
if (this.props.match.path === "/") {
@ -112,99 +74,9 @@ export function TPMIndexHOC(WrappedComponent) {
document.title = "教学课堂";
}
$.ajaxSetup({
cache: true
});
//帮助后台传参数
const query = this.props.location.search;
var dataqueryss = {}
try {
var foqus = this.foo(query);
if (JSON.stringify(foqus) === "{}") {
this.setState({
dataquerys: {},
});
} else {
this.setState({
dataquerys: foqus,
});
dataqueryss = foqus;
}
} catch (e) {
this.setState({
dataquerys: {},
})
}
this.fetchUsers(dataqueryss);
///请求定制化的信息
this.getAppdata();
}
/**
课堂权限相关方法暂时写这里了 ----------------------------------------START
ADMIN = 0 # 超级管理员
CREATOR = 1 # 课程创建者
PROFESSOR = 2 # 课程老师
ASSISTANT_PROFESSOR = 3 # 课程助教
STUDENT = 4 # 学生
NORMAL = 5 # 普通用户
v2
# 课程权限判断
ADMIN = 0 # 超级管理员
BUSINESS = 1 # 运营人员
CREATOR = 2 # 课程创建者 课堂管理员
PROFESSOR = 3 # 课程老师
ASSISTANT_PROFESSOR = 4 # 课程助教
STUDENT = 5 # 学生
NORMAL = 6 # 普通用户
Anonymous = 7 # 普未登录
*/
//超管0
isSuperAdmin = () => {
// return false
return this.state.coursedata && this.state.coursedata.course_identity === 0
}
isCourseAdmin = () => {
return this.state.coursedata && this.state.coursedata.course_identity === 2
}
//超管、运维0-1
isClassManagement = () => {
return this.state.coursedata && this.state.coursedata.course_identity < 2
}
//超管、运维、课堂管理0-2
isAdminOrCreator = () => {
return this.state.coursedata && this.state.coursedata.course_identity < 3
}
//超管、运维、课堂管理、老师0-3
isAdminOrTeacher = () => {
return this.state.coursedata && this.state.coursedata.course_identity < 4
}
// 助教===4
isAssistant = () => {
return this.state.coursedata && this.state.coursedata.course_identity === 4
}
// 超管、运维、课堂管理、老师、助教0-4
isAdmin = () => {
return this.state.coursedata && this.state.coursedata.course_identity < 5
}
// 学生5
isStudent = () => {
return this.state.coursedata && this.state.coursedata.course_identity === 5
}
// 超管、运维、课堂管理、老师、助教、学生0-5
isAdminOrStudent = () => {
return this.state.coursedata && this.state.coursedata.course_identity <= 5
}
// 游客未登录/非课堂成员6>
isNotMember = () => {
return this.state.coursedata && this.state.coursedata.course_identity >= 6
}
//课堂是否已结束
isCourseEnd = () => {
return this.state.current_user ? this.state.current_user.course_is_end : false
}
//获取数据为空的时候
@ -254,7 +126,6 @@ export function TPMIndexHOC(WrappedComponent) {
console.log("hoc获取游览器配置失败 重新请求开始读取配置");
this.getAppdatausr();
}
};
getAppdatausr = () => {
let url = "/setting.json";
@ -275,131 +146,26 @@ export function TPMIndexHOC(WrappedComponent) {
} catch (e) {
this.gettablogourlnull();
}
} else {
this.gettablogourlnull();
}
} else {
this.gettablogourlnull();
}
}).catch((error) => {
this.gettablogourlnull();
});
}
fetchUser = () => {
console.log("`111111");
let url = `/users/get_user_info.json`
let courseId;
let query = this.props.location.pathname;
const type = query.split('/');
if (type[1] == 'classrooms' && type[2]) {
courseId = parseInt(type[2])
}
var datay = {};
if (JSON.stringify(this.state.dataquerys) === "{}") {
datay = {
course_id: isNaN(courseId) ? undefined : courseId,
school: 1
}
} else {
datay = {
course_id: isNaN(courseId) ? undefined : courseId,
school: 1,
chinaoocTimestamp: this.state.dataquerys.chinaoocTimestamp,
websiteName: this.state.dataquerys.websiteName,
chinaoocKey: this.state.dataquerys.chinaoocKey,
}
}
axios.get(url, {
params: datay
}).then((response) => {
fetchUsers = () => {
let url = `/users/get_user_info.json`;
axios.get(url).then((response) => {
if (response && response.data) {
console.log("`111111",response.data);
this.initCommonState(response.data);
this.setState({
tpmLoading: false,
coursedata: {
course_identity: response.data.course_identity >= 0 ? response.data.course_identity : undefined,
course_public: response.data.course_public,
name: response.data.course_name,
userid: response.data.user_id
}
})
}
}).catch((error) => {
console.log(error)
})
};
fetchUsers = (yslurlobject) => {
let url = `/users/get_user_info.json`
let courseId;
let query = this.props.location.pathname;
const type = query.split('/');
if (type[1] == 'classrooms' && type[2]) {
courseId = parseInt(type[2])
// url += `?course_id=${courseId}`
}
var datay = {};
if (JSON.stringify(yslurlobject) === "{}") {
datay = {
course_id: isNaN(courseId) ? undefined : courseId,
school: 1
}
} else {
datay = {
course_id: isNaN(courseId) ? undefined : courseId,
school: 1,
chinaoocTimestamp: yslurlobject.chinaoocTimestamp,
websiteName: yslurlobject.websiteName,
chinaoocKey: yslurlobject.chinaoocKey,
}
}
axios.get(url, {
params:
datay
},
{
// withCredentials: true
}
).then((response) => {
/*
{
"username": "黄井泉",
"login": "Hjqreturn",
"user_id": 12,
"image_url": "avatar/User/12",
"admin": true,
"is_teacher": false,
"tidding_count": 0
}
*/
if (response === undefined) {
return
}
if (response.data) {
this.initCommonState(response.data)
this.setState({
tpmLoading: false,
coursedata: {
course_identity: response.data.course_identity >= 0 ? response.data.course_identity : undefined,
course_public: response.data.course_public,
name: response.data.course_name,
userid: response.data.user_id
},
tpmLoading: false
})
}
}).catch((error) => {
console.log(error)
})
@ -411,12 +177,9 @@ export function TPMIndexHOC(WrappedComponent) {
var arr;
do {
arr = regExp.exec(url);
// console.log(arr); // arr = [完整的字符串, key, 等号或'', value或'']
if (arr) {
var key = arr[1];
var value = arr[3];
// arr[2] === ''时, value = undefined
if (!arr[2])
value = undefined;
@ -581,23 +344,8 @@ export function TPMIndexHOC(WrappedComponent) {
}
render() {
let { Headertop, Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state;
let { Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state;
const common = {
isSuperAdmin: this.isSuperAdmin,
isAdminOrCreator: this.isAdminOrCreator,
isClassManagement: this.isClassManagement,
isCourseAdmin: this.isCourseAdmin,
isAdmin: this.isAdmin,
isAdminOrTeacher: this.isAdminOrTeacher,
isAssistant: this.isAssistant,
isStudent: this.isStudent,
isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember,
isCourseEnd: this.isCourseEnd,
isUserid: this.state.coursedata && this.state.coursedata.userid,
fetchUser: this.fetchUser,
showLoginDialog: this.showLoginDialog,
checkIfLogin: this.checkIfLogin,
@ -619,9 +367,7 @@ export function TPMIndexHOC(WrappedComponent) {
yslslowCheckresultsNo: this.yslslowCheckresultsNo,
MdifHasAnchorJustScorll: this.MdifHasAnchorJustScorll,
scrollToAnchor: this.scrollToAnchor
};
var mypath = this.props && this.props.match && this.props.match.path;
return (
<div className="indexHOC">
{isRender === true ? <LoginDialog
@ -643,7 +389,6 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.state}
{...this.dialogObj}
/> : ""}
<NewHeader {...this.state} {...this.props}></NewHeader>
<Spin spinning={this.state.globalLoading} delay={0} className="globalSpin"
size="large"
@ -652,7 +397,6 @@ export function TPMIndexHOC(WrappedComponent) {
<div className="newContainer newContainers">
<WrappedComponent initCommonState={(user) => this.initCommonState(user)}
{...this.props} {...this.state}
showShixun={this.showShixun} aboutFocus={this.aboutFocus}
{...common}
>
</WrappedComponent>
@ -662,7 +406,6 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.state} {...this.props}
Footerdown={Footerdown}
/>
</div>
);
}