forked from Gitlink/forgeplus-react
new
This commit is contained in:
parent
3b85567a1a
commit
cae10cec2a
|
@ -3,13 +3,13 @@ import { getImageUrl } from 'educoder';
|
|||
import { Link } from 'react-router-dom';
|
||||
import './Component.scss';
|
||||
|
||||
function Cards({img , title, desc , rightBtn}){
|
||||
function Cards({img , title, desc , rightBtn , src}){
|
||||
return(
|
||||
<div className="cards">
|
||||
<div className="img"><img src={getImageUrl(`images/${img}`)} alt=""/></div>
|
||||
{img &&<div className="img"><img src={getImageUrl(`images/${img}`)} alt=""/></div>}
|
||||
<div className="content">
|
||||
<p className="titles">
|
||||
<Link to={`/organize/${title}`}>{title}</Link>
|
||||
<Link to={src}>{title}</Link>
|
||||
{rightBtn}
|
||||
</p>
|
||||
<div className="desc">
|
||||
|
|
|
@ -19,6 +19,7 @@ li.ant-menu-item{
|
|||
padding:20px 34px;
|
||||
background-color: #fff;
|
||||
margin-bottom:18px;
|
||||
min-height: 130px;
|
||||
.img{
|
||||
margin-right: 20px;
|
||||
width: 190px;
|
||||
|
|
|
@ -10,6 +10,7 @@ import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
|
|||
|
||||
|
||||
import '../css/index.scss';
|
||||
import Detail from './Sub/Detail';
|
||||
|
||||
const New = Loadable({
|
||||
loader: () => import("./New"),
|
||||
|
@ -28,18 +29,25 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
|||
return (
|
||||
<div className="newMain">
|
||||
<Switch>
|
||||
{/* 组织团队 */}
|
||||
{/* 组织团队-子级(不包含组织团队列表) */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId"
|
||||
render={(p) => {
|
||||
return <SubDetail {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-子级(包含组织团队列表) */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group"
|
||||
render={(p) => {
|
||||
return <SubDetail {...props} {...p}/>
|
||||
return <DetailIndex {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织成员 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/member"
|
||||
render={(p) => {
|
||||
return <SubDetail {...props} {...p}/>
|
||||
return <DetailIndex {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 新建组织 */}
|
||||
|
|
|
@ -17,7 +17,7 @@ const radioStyle = {
|
|||
lineHeight: '30px',
|
||||
};
|
||||
export default Form.create()(
|
||||
forwardRef(({ form , organizeDetail , showNotification , history , current_user })=>{
|
||||
forwardRef(({ form , organizeDetail , showNotification , history , current_user , updateFunc })=>{
|
||||
const [ image , setImage ] = useState(undefined);
|
||||
const [ imageFlag , setImageFlag ] = useState(false);
|
||||
const [ password , setPassword ] = useState(undefined);
|
||||
|
@ -55,7 +55,11 @@ export default Form.create()(
|
|||
}).then(result=>{
|
||||
if(result && result.data){
|
||||
showNotification("组织信息更新成功!");
|
||||
history.push(`/organize/${values.name}/setting`);
|
||||
if(values.name !== organizeDetail.name){
|
||||
console.log("false111");
|
||||
history.push(`/organize/${values.name}/setting`);
|
||||
}
|
||||
updateFunc && updateFunc(values.name,values.description);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
|
|
@ -7,6 +7,14 @@ import Cards from '../../Component/Cards';
|
|||
import axios from 'axios';
|
||||
import '../Index.scss';
|
||||
|
||||
const Group = Loadable({
|
||||
loader: () => import("../TeamGroup"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Member = Loadable({
|
||||
loader: () => import("../TeamMember"),
|
||||
loading: Loading,
|
||||
});
|
||||
const DetailIndex = Loadable({
|
||||
loader: () => import("../List"),
|
||||
loading: Loading,
|
||||
|
@ -25,7 +33,7 @@ function Detail(props){
|
|||
// 设置页面:顶部不需要设置按钮了
|
||||
useEffect(()=>{
|
||||
if(pathname){
|
||||
if(pathname.indexOf("/setting") && pathname.indexOf("/organize")){
|
||||
if(pathname.indexOf("/setting")>-1 && pathname.indexOf("/organize")>-1){
|
||||
setFlag(false);
|
||||
}else{
|
||||
setFlag(true);
|
||||
|
@ -47,11 +55,19 @@ function Detail(props){
|
|||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
||||
function updateDetail(name,desc){
|
||||
let d = detail;
|
||||
d.name = name;
|
||||
d.description = desc;
|
||||
setDetail(d);
|
||||
}
|
||||
return(
|
||||
<div className="teamDetail">
|
||||
{
|
||||
detail &&
|
||||
<Cards
|
||||
src={`/organize/${detail.name}`}
|
||||
title={detail.name}
|
||||
desc={detail.description}
|
||||
img={detail.avatar_url}
|
||||
|
@ -59,10 +75,25 @@ function Detail(props){
|
|||
/>
|
||||
}
|
||||
<Switch {...props}>
|
||||
|
||||
{/* 组织成员 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/member"
|
||||
render={(p) => {
|
||||
return <Member {...props} {...p} organizeDetail={detail}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group"
|
||||
render={(p) => {
|
||||
return <Group {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/setting"
|
||||
render={(p) => {
|
||||
return <Setting {...props} {...p} organizeDetail={detail} />
|
||||
return <Setting {...props} {...p} organizeDetail={detail} updateFunc={updateDetail}/>
|
||||
}}
|
||||
></Route>
|
||||
<Route
|
||||
|
|
|
@ -4,7 +4,6 @@ import Loadable from "react-loadable";
|
|||
import Loading from "../../../Loading";
|
||||
import '../Index.scss';
|
||||
import axios from 'axios';
|
||||
import { getImageUrl } from 'educoder';
|
||||
|
||||
import Cards from '../../Component/Cards';
|
||||
|
||||
|
@ -12,14 +11,6 @@ const GroupNew = Loadable({
|
|||
loader: () => import("../Group/GroupNew"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Group = Loadable({
|
||||
loader: () => import("../TeamGroup"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Member = Loadable({
|
||||
loader: () => import("../TeamMember"),
|
||||
loading: Loading,
|
||||
});
|
||||
const GroupDetails = Loadable({
|
||||
loader: () => import("../Group/GroupDetails"),
|
||||
loading: Loading,
|
||||
|
@ -50,13 +41,13 @@ export default ((props)=>{
|
|||
},[pathname])
|
||||
|
||||
useEffect(()=>{
|
||||
if(OIdentifier){
|
||||
getDetail(OIdentifier);
|
||||
if(OIdentifier && groupId){
|
||||
getDetail(OIdentifier,groupId);
|
||||
}
|
||||
},[OIdentifier]);
|
||||
},[OIdentifier,groupId]);
|
||||
|
||||
function getDetail(id) {
|
||||
const url = `/organizations/${id}.json`;
|
||||
function getDetail(id,gId) {
|
||||
const url = `/organizations/${id}/teams/${gId}.json`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result && result.data){
|
||||
setDetail(result.data);
|
||||
|
@ -64,10 +55,17 @@ export default ((props)=>{
|
|||
}).catch(error=>{})
|
||||
}
|
||||
return(
|
||||
<div className="teamDetail">
|
||||
<div className="teamDetail" style={{paddingTop:"0px"}}>
|
||||
<div>
|
||||
<i className="iconfont icon-zuobiao mr5"></i>
|
||||
<Link to={`/organize/${OIdentifier}`}>{OIdentifier}</Link>
|
||||
<i className="iconfont icon-youjiantou ml3 mr3 font-12"></i>
|
||||
<span>{detail && detail.name}</span>
|
||||
</div>
|
||||
{
|
||||
detail &&
|
||||
<Cards
|
||||
src={`/organize/${OIdentifier}/group/${groupId}`}
|
||||
title={detail.name}
|
||||
rightBtn={
|
||||
flag && <span className="subNavs">
|
||||
|
@ -75,7 +73,6 @@ export default ((props)=>{
|
|||
<Link to={`/organize/${OIdentifier}/group`} className={pathname ===`/organize/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
|
||||
</span>
|
||||
}
|
||||
img={detail.avatar_url}
|
||||
desc={!flag && detail.description}
|
||||
/>
|
||||
}
|
||||
|
@ -87,34 +84,20 @@ export default ((props)=>{
|
|||
return <GroupSetting {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织-新建团队 */}
|
||||
{/* 组织团队-新建 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/new"
|
||||
render={(p) => {
|
||||
return <GroupNew {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-成员 */}
|
||||
{/* 组织团队-详情 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId"
|
||||
render={(p) => {
|
||||
return <GroupDetails {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织成员 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/member"
|
||||
render={(p) => {
|
||||
return <Member {...props} {...p} organizeDetail={detail}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group"
|
||||
render={(p) => {
|
||||
return <Group {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
</Switch>
|
||||
</div>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue