forked from Gitlink/forgeplus-react
个人中心-我的组织
This commit is contained in:
parent
7b7b206741
commit
828cc2470d
|
@ -27,7 +27,7 @@ if (isDev) {
|
|||
}
|
||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
|
||||
}
|
||||
function clearAllCookie() {
|
||||
cookie.remove('_educoder_session', { path: '/' });
|
||||
|
|
|
@ -2,14 +2,16 @@ import React from "react";
|
|||
import { Input } from "antd";
|
||||
|
||||
const { Search } = Input;
|
||||
export default ({ placeholder , onSearch }) => {
|
||||
export default ({ placeholder , onSearch , value , onChange }) => {
|
||||
return (
|
||||
<Search
|
||||
value={value}
|
||||
allowClear
|
||||
placeholder={placeholder}
|
||||
enterButton={'搜索'}
|
||||
onSearch={onSearch}
|
||||
width="300px"
|
||||
onChange={onChange}
|
||||
></Search>
|
||||
)
|
||||
};
|
||||
|
|
|
@ -17,11 +17,12 @@ const radioStyle = {
|
|||
lineHeight: '30px',
|
||||
};
|
||||
export default Form.create()(
|
||||
forwardRef(({ form , organizeDetail , showNotification , history })=>{
|
||||
forwardRef(({ form , organizeDetail , showNotification , history , current_user })=>{
|
||||
const [ image , setImage ] = useState(undefined);
|
||||
const [ imageFlag , setImageFlag ] = useState(false);
|
||||
const [ password , setPassword ] = useState(undefined);
|
||||
const { getFieldDecorator , validateFields, setFieldsValue} = form;
|
||||
const [ passwordFlag , setPasswordFlag ] = useState(false);
|
||||
const { getFieldDecorator , validateFields , setFieldsValue } = form;
|
||||
|
||||
useEffect(()=>{
|
||||
if(organizeDetail){
|
||||
|
@ -67,7 +68,21 @@ export default Form.create()(
|
|||
|
||||
// 删除组织
|
||||
function deleteOrganize(){
|
||||
|
||||
if(!password){
|
||||
setPasswordFlag(true);
|
||||
return
|
||||
}else{
|
||||
setPasswordFlag(false);
|
||||
const url = `/organizations/${organizeDetail.id}.json`;
|
||||
axios.delete(url,{
|
||||
params:{ password }
|
||||
}).then(result=>{
|
||||
if(result && result.data){
|
||||
// 删除后跳转到个人中心的组织页面
|
||||
history.push(`/users/${current_user && current_user.login}/organizes`);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
|
@ -136,7 +151,8 @@ export default Form.create()(
|
|||
<FlexAJ>
|
||||
<div>
|
||||
<span className="required">密码:</span>
|
||||
<Input type="password" style={{width:"350px"}} value={password} onChange={(e)=>setPassword(e.target.value)}/>
|
||||
<Input type="password" placeholder="请输入当前用户的登录密码" style={{width:"350px"}} value={password} onChange={(e)=>setPassword(e.target.value)}/>
|
||||
{ passwordFlag && <span className="color-red ml10">请输入密码</span>}
|
||||
</div>
|
||||
<a className="warningDelete" onClick={deleteOrganize}>删除组织</a>
|
||||
</FlexAJ>
|
||||
|
|
|
@ -24,13 +24,17 @@ const demoData = [
|
|||
operation:"移除成员",
|
||||
}
|
||||
]
|
||||
export default (()=>{
|
||||
export default ((props)=>{
|
||||
const [ choiceId , serChoiceId ] = useState(undefined);
|
||||
const [ page , setPage ] = useState(1);
|
||||
const [ limit , setLimit ] = useState(15);
|
||||
const [ total , setTotal ] = useState(0);
|
||||
const [ data , setData ] = useState(demoData);
|
||||
|
||||
function getData(){
|
||||
const url = `/organizations/:organization/organization_users.json`;
|
||||
}
|
||||
|
||||
// 获取搜索用户框里面选择的用户ID,方便添加组织成员
|
||||
function getUser(id){
|
||||
console.log(id);
|
||||
|
|
|
@ -288,7 +288,7 @@ class Infos extends Component {
|
|||
}
|
||||
|
||||
|
||||
{/* <div className="bgcF">
|
||||
<div className="bgcF">
|
||||
<div className="list-l-Menu">
|
||||
<p className="list-l-p pd20" onClick={() => this.organize_link()} >
|
||||
<span className="font-16 color-grey-3">
|
||||
|
@ -296,11 +296,11 @@ class Infos extends Component {
|
|||
组织
|
||||
</span>
|
||||
<span className="color-blue font-16">
|
||||
{user && user.undo_events}
|
||||
{user && user.user_org_count}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
<div className="list-right">
|
||||
{user && (
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
import React from 'react';
|
||||
export default (()=>{
|
||||
import { Link } from 'react-router-dom';
|
||||
import { getImageUrl } from 'educoder';
|
||||
|
||||
function TeamItem({item}){
|
||||
return(
|
||||
<div>
|
||||
<img alt="" src="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=275377869,874401419&fm=26&gp=0.jpg"/>
|
||||
<div>
|
||||
<p className="mb5 font-18 color-grey-3 task-hide">组织名称组织名称</p>
|
||||
<img alt="" src={getImageUrl(`images/${item.avatar_url}`)}/>
|
||||
<div style={{flex:'1'}}>
|
||||
<Link to={`/organize/${item.name}`} className="mb5 font-18 color-grey-3 task-hide">{item.name}</Link>
|
||||
<div className="task-hide-2">
|
||||
组织描述内容组织描述内容组织描述内容组织描述内容组织描述内容组织描述内容组织描述内容组织描述内容组织描述内容组织描述内容组织描述内
|
||||
{item.description}
|
||||
</div>
|
||||
<p className="item-news">
|
||||
<span>项目:11</span>
|
||||
<span><i className="iconfont icon-shijian color-green mr3 font-12"></i>创建时间:2020-04-28</span>
|
||||
<span>项目:{item.num_projects}</span>
|
||||
<span><i className="iconfont icon-shijian color-green mr3 font-12"></i>创建时间:{item.created_at}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default TeamItem;
|
|
@ -1,38 +1,83 @@
|
|||
|
||||
import React from 'react';
|
||||
import {Popover , Menu} from 'antd';
|
||||
import React , { useEffect , useState } from 'react';
|
||||
import { Dropdown, Menu , Pagination } from 'antd';
|
||||
import { Link } from 'react-router-dom';
|
||||
import Search from '../Component/Search';
|
||||
import Sort from '../Component/Sort';
|
||||
|
||||
import Item from './Team-item';
|
||||
import Nodata from '../Nodata';
|
||||
import axios from 'axios';
|
||||
|
||||
export default (()=>{
|
||||
const limit = 15;
|
||||
function Team(){
|
||||
const [ list ,setList ] = useState(undefined);
|
||||
const [ page ,setPage ] = useState(1);
|
||||
const [ total ,setTotal ] = useState(0);
|
||||
const [ sort_direction , setSort_direction ] = useState("asc");
|
||||
const [ sort_by ,setSort_by ] = useState("created_at");
|
||||
const [ search ,setSearch ] = useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
getList(search);
|
||||
},[sort_by,page,sort_direction])
|
||||
|
||||
function getList(search){
|
||||
const url = `/organizations.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
search,sort_by,sort_direction,page,limit
|
||||
}
|
||||
}).then(result=>{
|
||||
if(result && result.data){
|
||||
setList(result.data.organizations);
|
||||
setTotal(result.data.total_count);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
// 搜索
|
||||
function onSearch(value){
|
||||
|
||||
function onSearch(){
|
||||
getList(search);
|
||||
}
|
||||
const menu = (
|
||||
<Menu>
|
||||
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
|
||||
<Menu.Item key="created_on">项目数排序</Menu.Item>
|
||||
<Menu onClick={(e)=>setSort_by(e.key)}>
|
||||
<Menu.Item value="created_at" key="created_at">更新时间排序</Menu.Item>
|
||||
<Menu.Item value="num_projects" key="num_projects">项目数排序</Menu.Item>
|
||||
<Menu.Item value="num_users" key="num_users">用户数排序</Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
return(
|
||||
<div>
|
||||
<div className="headerbox">
|
||||
<div>
|
||||
<Search placeholder="请输入项目名称关键字进行搜索" onSearch={onSearch}/>
|
||||
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入项目名称关键字进行搜索" onSearch={onSearch}/>
|
||||
</div>
|
||||
<p>
|
||||
<a><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</a>
|
||||
<Sort menu={menu}>
|
||||
<Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>
|
||||
<Dropdown overlay={menu}>
|
||||
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
||||
</Sort>
|
||||
</Dropdown>
|
||||
</p>
|
||||
</div>
|
||||
<div className="contentBox">
|
||||
<Item></Item>
|
||||
</div>
|
||||
{
|
||||
list && list.length > 0 ?
|
||||
<div className="contentBox">
|
||||
{
|
||||
list.map((item,key)=>{
|
||||
return(
|
||||
<Item item={item}/>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
:
|
||||
<Nodata _html="暂无数据" />
|
||||
}
|
||||
{
|
||||
total > limit &&
|
||||
<div className="mt20 pb20" style={{textAlign:"center"}}>
|
||||
<Pagination simple current={page} pageSize={limit} onChange={(page)=>setPage(page)} total={total} />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
export default Team;
|
|
@ -841,7 +841,7 @@ class NewHeader extends Component {
|
|||
}
|
||||
{
|
||||
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_organ &&
|
||||
<li><a href={`/users/${this.props.current_user.login}/organize`} target="_blank">我的组织</a></li>
|
||||
<li><a href={`/users/${this.props.current_user.login}/organizes`} target="_blank">我的组织</a></li>
|
||||
}
|
||||
<li className="bor-top-greyE">
|
||||
<a onClick={() => this.educoderloginysl()}>退出</a>
|
||||
|
|
Loading…
Reference in New Issue