forked from Gitlink/forgeplus-react
merge
This commit is contained in:
parent
9a2c3f1754
commit
ff7d191011
|
@ -98,6 +98,8 @@ class ForkUsers extends Component {
|
||||||
<Link
|
<Link
|
||||||
to={`/projects/${item.login}/${item.identifier}`}
|
to={`/projects/${item.login}/${item.identifier}`}
|
||||||
className="font-16 text-primary task-hide max-w-200"
|
className="font-16 text-primary task-hide max-w-200"
|
||||||
|
style={{display:"block"}}
|
||||||
|
title={item.name}
|
||||||
>
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { getImageUrl } from "educoder";
|
import { getImageUrl } from "educoder";
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
import FocusButton from "./focus_button";
|
import FocusButton from "./focus_button";
|
||||||
import { Button } from "antd";
|
import { Button } from "antd";
|
||||||
import "./list.css";
|
import "./list.css";
|
||||||
|
@ -25,12 +26,14 @@ class UserList extends Component {
|
||||||
</div>
|
</div>
|
||||||
<div className="ml12">
|
<div className="ml12">
|
||||||
<div>
|
<div>
|
||||||
<a
|
<Link
|
||||||
href={`/users/${item.login}`}
|
to={`/users/${item.login}`}
|
||||||
className="font-16 text-primary task-hide max-w-200"
|
className="font-16 text-primary task-hide max-w-200"
|
||||||
|
style={{display:"block"}}
|
||||||
|
title={item.name}
|
||||||
>
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
</a>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="font-12 text-gray grid-item pb5">
|
<div className="font-12 text-gray grid-item pb5">
|
||||||
<i className="iconfont icon-shijian user-join-time"></i>
|
<i className="iconfont icon-shijian user-join-time"></i>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||||
import { Modal , Checkbox , Spin , Input } from 'antd';
|
import { Modal , Checkbox , Spin , Input } from 'antd';
|
||||||
import Axios from 'axios';
|
import Axios from 'axios';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { values } from 'lodash';
|
||||||
|
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
const limit = 20;
|
const limit = 20;
|
||||||
|
@ -15,13 +16,20 @@ function ConcentrateBox({ visible , onCancel , onSure , username , choosed }) {
|
||||||
const [ value , setValue ]= useState([]);
|
const [ value , setValue ]= useState([]);
|
||||||
const [ isSpin , setIsSpin ]= useState(true);
|
const [ isSpin , setIsSpin ]= useState(true);
|
||||||
const [ disable , setDisable ] = useState(false);
|
const [ disable , setDisable ] = useState(false);
|
||||||
|
|
||||||
|
const [ copyList , setCopyList ] = useState([]);
|
||||||
|
const [ copyAllList , setCopyAllList ] = useState([]);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(visible){
|
if(visible){
|
||||||
setIsSpin(true);
|
setIsSpin(true);
|
||||||
getProjectList();
|
getProjectList();
|
||||||
|
}else{
|
||||||
|
setSearch(undefined);
|
||||||
|
setCopyAllList([]);
|
||||||
|
setCopyList([]);
|
||||||
|
setList([]);
|
||||||
}
|
}
|
||||||
setSearch(undefined);
|
|
||||||
},[visible])
|
},[visible])
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
@ -31,12 +39,6 @@ function ConcentrateBox({ visible , onCancel , onSure , username , choosed }) {
|
||||||
}
|
}
|
||||||
},[page])
|
},[page])
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
if(search !== undefined){
|
|
||||||
setIsSpin(true);
|
|
||||||
getProjectList(1,search);
|
|
||||||
}
|
|
||||||
},[search])
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(visible && choosed && choosed.length >0 ){
|
if(visible && choosed && choosed.length >0 ){
|
||||||
|
@ -60,11 +62,11 @@ function ConcentrateBox({ visible , onCancel , onSure , username , choosed }) {
|
||||||
}
|
}
|
||||||
}).then(result=>{
|
}).then(result=>{
|
||||||
if(result && result.data){
|
if(result && result.data){
|
||||||
let e = page > 1 ? mergeArrayMerge(list,result.data.projects) : result.data.projects;
|
let e = !search ? mergeArrayMerge(list,result.data.projects) : result.data.projects;
|
||||||
|
setCopyAllList(!search ? e : copyAllList);
|
||||||
setTotal(result.data.count);
|
setTotal(result.data.count);
|
||||||
setList(e);
|
setList(e);
|
||||||
setIsSpin(false);
|
setIsSpin(false);
|
||||||
|
|
||||||
// 查看更多需要页数
|
// 查看更多需要页数
|
||||||
let s = parseInt(result.data.count/limit,0);
|
let s = parseInt(result.data.count/limit,0);
|
||||||
let y = result.data.count%limit;
|
let y = result.data.count%limit;
|
||||||
|
@ -86,28 +88,39 @@ function ConcentrateBox({ visible , onCancel , onSure , username , choosed }) {
|
||||||
return array1
|
return array1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveList(c) {
|
||||||
|
// 将选中的复制下来保存到copyList数组里
|
||||||
|
if(c && c.length > 0){
|
||||||
|
let l = []
|
||||||
|
for(var i=0;i<c.length;i++){
|
||||||
|
let filter = copyAllList.filter(j=>j.id === c[i]);
|
||||||
|
if(filter && filter.length>0){
|
||||||
|
l.push(filter[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setCopyList(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onOk() {
|
function onOk() {
|
||||||
onSure && onSure(value);
|
onSure && onSure(value);
|
||||||
setValue([]);
|
setValue([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function chooseProject(e,p) {
|
function chooseProject(e) {
|
||||||
setValue(e);
|
setValue(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索
|
// 搜索
|
||||||
function onSearch(params) {
|
function onSearch(params) {
|
||||||
|
setCopyAllList(list);
|
||||||
|
value && value.length > 0 ? saveList(value) : setCopyList([]);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
setList([]);
|
|
||||||
setSearch(params);
|
setSearch(params);
|
||||||
// if(params){
|
getProjectList(1,params);
|
||||||
// setValueCopy(value);
|
|
||||||
// }else{
|
|
||||||
// setValue(valueCopy);
|
|
||||||
// setValueCopy([]);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
|
@ -133,21 +146,26 @@ function ConcentrateBox({ visible , onCancel , onSure , username , choosed }) {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="listbox">
|
<div className="listbox">
|
||||||
{
|
<Checkbox.Group value={value} onChange={chooseProject} style={{width:"100%"}}>
|
||||||
list && list.length > 0 &&
|
{
|
||||||
<Checkbox.Group value={value} onChange={chooseProject} style={{width:"100%"}}>
|
copyList && copyList.length >0 && copyList.map((i,k)=>{
|
||||||
{
|
return(
|
||||||
list.map((i,k)=>{
|
<Checkbox value={i.id} disabled={disable && (value.filter(j=>j === i.id).length===0)}>{i.author && i.author.name}/{i.name}</Checkbox>
|
||||||
return(
|
)
|
||||||
<Checkbox value={i.id} disabled={disable && (value.filter(j=>j === i.id).length===0)}>{i.name}</Checkbox>
|
})
|
||||||
)
|
}
|
||||||
})
|
{
|
||||||
}
|
list && list.length > 0 && list.map((i,k)=>{
|
||||||
</Checkbox.Group>
|
let c = copyList && copyList.length >0 && copyList.filter(j=>j.id === i.id).length !== 0;
|
||||||
}
|
return(
|
||||||
|
!c && <Checkbox value={i.id} disabled={disable && (value.filter(j=>j === i.id).length===0)}>{i.author && i.author.name}/{i.name}</Checkbox>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Checkbox.Group>
|
||||||
</div>
|
</div>
|
||||||
{ total > limit && page < pageSize && <div className="morelist" onClick={()=>setPage(page+1)}>查看更多</div> }
|
{ total > limit && page < pageSize && <div className="morelist" onClick={()=>setPage(page+1)}>查看更多</div> }
|
||||||
{ list && list.length === 0 && <div style={{textAlign:"center"}}>您还没有公开的{search && `“${search}”`}项目,先去<Link to={`/projects/deposit/new`} className="color-blue">新建项目</Link></div> }
|
{ (list && list.length === 0) && (copyList && copyList.length === 0) && <div style={{textAlign:"center"}}>您还没有公开的{search && `“${search}”`}项目,先去<Link to={`/projects/deposit/new`} className="color-blue">新建项目</Link></div> }
|
||||||
</Spin>
|
</Spin>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
|
||||||
import { FlexAJ , AlignCenter } from '../../Component/layout';
|
import { FlexAJ , AlignCenter } from '../../Component/layout';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import Box from './ConcentrateBox';
|
import Box from './ConcentrateBox';
|
||||||
|
|
||||||
function ConcentrateProject({userLogin,current}) {
|
function ConcentrateProject({userLogin,current}) {
|
||||||
|
|
|
@ -119,6 +119,11 @@ $flex:flex;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
&>div{
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
i{
|
i{
|
||||||
color: #DEDEDE;
|
color: #DEDEDE;
|
||||||
font-size: 15px!important;
|
font-size: 15px!important;
|
||||||
|
|
|
@ -183,17 +183,11 @@ class Infos extends Component {
|
||||||
this.props.history.push(`/users/${user && user.login}/organizes`)
|
this.props.history.push(`/users/${user && user.login}/organizes`)
|
||||||
}
|
}
|
||||||
|
|
||||||
resetUser=()=>{
|
|
||||||
const { resetUserInfo } = this.props;
|
|
||||||
|
|
||||||
this.fetchUser();
|
|
||||||
resetUserInfo && resetUserInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { current_user, mygetHelmetapi , resetUserInfo } = this.props;
|
const { current_user, mygetHelmetapi } = this.props;
|
||||||
const { username } = this.props.match.params;
|
const { username } = this.props.match.params;
|
||||||
const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state;
|
const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="newMain clearfix">
|
<div className="newMain clearfix">
|
||||||
<Spin spinning={isSpin}>
|
<Spin spinning={isSpin}>
|
||||||
|
@ -213,7 +207,7 @@ class Infos extends Component {
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div className="text-center mt15 font-24 task-hide" title={user && user.username}>
|
<div className="text-center mt15 font-16 fwb task-hide" title={user && user.username}>
|
||||||
{user && user.username}
|
{user && user.username}
|
||||||
</div>
|
</div>
|
||||||
<div className="userDescription">
|
<div className="userDescription">
|
||||||
|
@ -342,7 +336,7 @@ class Infos extends Component {
|
||||||
<Route
|
<Route
|
||||||
path="/users/:username/info"
|
path="/users/:username/info"
|
||||||
render={() => {
|
render={() => {
|
||||||
return <UpdateInfo {...this.props} {...this.state} resetUser={this.resetUser}/>;
|
return <UpdateInfo {...this.props} {...this.state} resetUser={this.fetchUser}/>;
|
||||||
}}
|
}}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
|
|
|
@ -10,16 +10,15 @@ export default Form.create()(
|
||||||
forwardRef((props)=>{
|
forwardRef((props)=>{
|
||||||
const { getFieldDecorator, validateFields , setFieldsValue } = props && props.form;
|
const { getFieldDecorator, validateFields , setFieldsValue } = props && props.form;
|
||||||
const { username } = props && props.match && props.match.params;
|
const { username } = props && props.match && props.match.params;
|
||||||
const { current_user , resetUser } = props;
|
const { user , resetUser } = props;
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(current_user && current_user.login){
|
if(user && user.login){
|
||||||
setFieldsValue({
|
setFieldsValue({
|
||||||
...current_user,
|
...user,
|
||||||
location:current_user.province && [current_user.province,current_user.city]
|
location:user.province && [user.province,user.city]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},[current_user])
|
},[user])
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
validateFields((error,values)=>{
|
validateFields((error,values)=>{
|
||||||
|
@ -71,7 +70,7 @@ export default Form.create()(
|
||||||
{getFieldDecorator("real_name",{
|
{getFieldDecorator("real_name",{
|
||||||
rules:[{required:true,message:"请输入姓名"}]
|
rules:[{required:true,message:"请输入姓名"}]
|
||||||
})(
|
})(
|
||||||
<Input placeholder="请输入您的姓名" style={{width:"400px"}}/>
|
<Input placeholder="请输入您的姓名" maxLength={"20"} style={{width:"400px"}}/>
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div>
|
<div>
|
||||||
|
@ -90,7 +89,7 @@ export default Form.create()(
|
||||||
{getFieldDecorator("custom_department",{
|
{getFieldDecorator("custom_department",{
|
||||||
rules:[{required:true,message:"请输入单位名称"}]
|
rules:[{required:true,message:"请输入单位名称"}]
|
||||||
})(
|
})(
|
||||||
<Input placeholder="请输入单位名称" style={{width:"400px"}}/>
|
<Input placeholder="请输入单位名称" maxLength="30" style={{width:"400px"}}/>
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="">
|
<Form.Item label="">
|
||||||
|
@ -120,7 +119,7 @@ export default Form.create()(
|
||||||
{getFieldDecorator("description",{
|
{getFieldDecorator("description",{
|
||||||
rules:[]
|
rules:[]
|
||||||
})(
|
})(
|
||||||
<TextArea placeholder="请输入您的自我理解" rows={4} maxLength="140" style={{width:"600px"}}/>
|
<TextArea placeholder="请输入您的自我简介" rows={4} maxLength="140" style={{width:"600px"}}/>
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<AlignCenter>
|
<AlignCenter>
|
||||||
|
|
|
@ -47,6 +47,15 @@ function Team(props){
|
||||||
<Menu.Item value="num_users" key="num_users">用户数排序</Menu.Item>
|
<Menu.Item value="num_users" key="num_users">用户数排序</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function newFunc() {
|
||||||
|
const { checkIfLogin , showLoginDialog } = props;
|
||||||
|
if(checkIfLogin()){
|
||||||
|
props.history.push(`/organize/new`);
|
||||||
|
}else{
|
||||||
|
showLoginDialog && showLoginDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<div className="headerbox">
|
<div className="headerbox">
|
||||||
|
@ -54,7 +63,7 @@ function Team(props){
|
||||||
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
|
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>
|
<a onClick={newFunc}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</a>
|
||||||
<Dropdown overlay={menu}>
|
<Dropdown overlay={menu}>
|
||||||
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
|
@ -29,26 +29,24 @@ class CommonList extends Component {
|
||||||
isSpin: true,
|
isSpin: true,
|
||||||
});
|
});
|
||||||
axios.get(url, {
|
axios.get(url, {
|
||||||
params: {
|
params: {
|
||||||
page,
|
page,
|
||||||
limit,
|
limit,
|
||||||
search,
|
search,
|
||||||
},
|
},
|
||||||
})
|
}).then((result) => {
|
||||||
.then((result) => {
|
if (result && result.data) {
|
||||||
if (result) {
|
|
||||||
this.setState({
|
|
||||||
users: result.data.users,
|
|
||||||
total: result.data.count,
|
|
||||||
isSpin: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: false,
|
users: result.data.users,
|
||||||
|
total: result.data.count,
|
||||||
|
isSpin: false
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
this.setState({
|
||||||
|
isSpin: false,
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//切换页数
|
//切换页数
|
||||||
|
@ -63,6 +61,12 @@ class CommonList extends Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
successFunc=()=>{
|
||||||
|
const { fetchUser } = this.props;
|
||||||
|
this.get_watchers();
|
||||||
|
fetchUser && fetchUser();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { users, isSpin, total, search, limit, page } = this.state;
|
const { users, isSpin, total, search, limit, page } = this.state;
|
||||||
const { userType, login, current_user } = this.props;
|
const { userType, login, current_user } = this.props;
|
||||||
|
@ -103,7 +107,7 @@ class CommonList extends Component {
|
||||||
|
|
||||||
{users && users.length > 0 ? (
|
{users && users.length > 0 ? (
|
||||||
<div className="w-100 inline-block">
|
<div className="w-100 inline-block">
|
||||||
<UserList users={users} userClass={"w-33"} type_title={'关注列表'} current_user={current_user} successFunc={this.get_watchers}></UserList>
|
<UserList users={users} userClass={"w-33"} type_title={'关注列表'} current_user={current_user} successFunc={this.successFunc}></UserList>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Nodata _html={`暂时没有数据~`} />
|
<Nodata _html={`暂时没有数据~`} />
|
||||||
|
|
|
@ -3,10 +3,10 @@ import CommonLists from "./common_lists"
|
||||||
class FanUsers extends Component {
|
class FanUsers extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {user, current_user} = this.props
|
const {user, current_user , fetchUser} = this.props
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{user && user.login && <CommonLists userType="fan_users" login={user.login} current_user={current_user} />}
|
{user && user.login && <CommonLists userType="fan_users" login={user.login} current_user={current_user} fetchUser={fetchUser}/>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import React, { Component } from "react";
|
||||||
import CommonLists from "./common_lists"
|
import CommonLists from "./common_lists"
|
||||||
class WatcherUsers extends Component {
|
class WatcherUsers extends Component {
|
||||||
render() {
|
render() {
|
||||||
const {user, current_user} = this.props
|
const {user, current_user , fetchUser } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className="minH-650">
|
<div className="minH-650">
|
||||||
{user && user.login && <CommonLists userType="watch_users" login={user.login} current_user={current_user} />}
|
{user && user.login && <CommonLists userType="watch_users" login={user.login} current_user={current_user} fetchUser={fetchUser}/>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue