Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
0919202427
@ -1,216 +1,213 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Modal,Checkbox,Input } from "antd";
|
import { Modal,Checkbox,Input } from "antd";
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const Search = Input.Search;
|
const Search = Input.Search;
|
||||||
const CheckboxGroup = Checkbox.Group;
|
const CheckboxGroup = Checkbox.Group;
|
||||||
class addCollaborators extends Component{
|
class addCollaborators extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
addPartner:false,
|
addPartner:false,
|
||||||
page:1,
|
page:1,
|
||||||
partnerList:undefined,
|
partnerList:undefined,
|
||||||
search:'',
|
search:'',
|
||||||
partnerListid:[],
|
partnerListid:[],
|
||||||
checkAll: false,
|
checkAll: false,
|
||||||
optionss:[]
|
optionss:[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addBox=()=>{
|
addBox=()=>{
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
addPartner:true,
|
addPartner:true,
|
||||||
search:"",
|
search:"",
|
||||||
page:1,
|
page:1,
|
||||||
partnerList:undefined,
|
partnerList:undefined,
|
||||||
optionss:[]
|
optionss:[]
|
||||||
})
|
})
|
||||||
this.searchList("")
|
this.searchList("")
|
||||||
|
|
||||||
}
|
}
|
||||||
hideAddBox=()=>{
|
hideAddBox=()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
addPartner:false,
|
addPartner:false,
|
||||||
optionss:[],
|
optionss:[],
|
||||||
partnerListid:[]
|
partnerListid:[]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 搜索框输入
|
// 搜索框输入
|
||||||
changeSearchValue=(e)=>{
|
changeSearchValue=(e)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
search: e.target.value
|
search: e.target.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 回车搜索--搜索成功后page为1
|
// 回车搜索--搜索成功后page为1
|
||||||
searchList=()=>{
|
searchList=()=>{
|
||||||
let id=this.props.match.params.pathId;
|
let id=this.props.match.params.pathId;
|
||||||
let {search,page}=this.state;
|
let {search,page}=this.state;
|
||||||
let url='/paths/'+id+'/search_members.json?search='+search+"&page="+page;
|
let url='/paths/'+id+'/search_members.json?search='+search+"&page="+page;
|
||||||
axios.post(url).then((result)=>{
|
axios.post(url).then((result)=>{
|
||||||
if(result.status==200){
|
if(result.status==200){
|
||||||
let list=result.data.users;
|
let list=result.data.users;
|
||||||
let optionss=[]
|
let optionss=[]
|
||||||
for(var i=0; i<list.length;i++){
|
for(var i=0; i<list.length;i++){
|
||||||
optionss.push(list[i].user_id)
|
optionss.push(list[i].user_id)
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
partnerList:result.data.users,
|
partnerList:result.data.users,
|
||||||
page:1,
|
page:1,
|
||||||
optionss:optionss
|
optionss:optionss
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SaveAddBox=()=>{
|
SaveAddBox=()=>{
|
||||||
let {partnerListid} =this.state;
|
let {partnerListid} =this.state;
|
||||||
let id=this.props.match.params.pathId;
|
let id=this.props.match.params.pathId;
|
||||||
let url="/paths/"+id+"/add_subject_members.json"
|
let url="/paths/"+id+"/add_subject_members.json"
|
||||||
axios.post(url,{
|
axios.post(url,{
|
||||||
user_ids:partnerListid
|
user_ids:partnerListid
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if(response.status==200){
|
if(response.status==200){
|
||||||
this.setState({
|
this.setState({
|
||||||
addPartner:false,
|
addPartner:false,
|
||||||
optionss:[],
|
optionss:[],
|
||||||
partnerListid:[]
|
partnerListid:[]
|
||||||
})
|
})
|
||||||
this.props.updatadetailInfoLists();
|
this.props.updatadetailInfoLists();
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addCollaboratorsid=(id)=>{
|
addCollaboratorsid=(id)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
partnerListid:id
|
partnerListid:id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onCheckAllChange = (e) => {
|
onCheckAllChange = (e) => {
|
||||||
let {optionss} =this.state;
|
let {optionss} =this.state;
|
||||||
|
|
||||||
if(e.target.checked===true){
|
if(e.target.checked===true){
|
||||||
this.setState({
|
this.setState({
|
||||||
checkAll: e.target.checked,
|
checkAll: e.target.checked,
|
||||||
partnerListid:optionss
|
partnerListid:optionss
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
this.setState({
|
||||||
checkAll: e.target.checked,
|
checkAll: e.target.checked,
|
||||||
partnerListid:[]
|
partnerListid:[]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentViewScroll=(e)=>{
|
contentViewScroll=(e)=>{
|
||||||
//滑动到底判断
|
//滑动到底判断
|
||||||
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
|
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
|
||||||
// console.log("到达底部");
|
// console.log("到达底部");
|
||||||
|
|
||||||
let id=this.props.match.params.pathId;
|
let id=this.props.match.params.pathId;
|
||||||
let {search,page,partnerList,optionss}=this.state;
|
let {search,page,partnerList,optionss}=this.state;
|
||||||
let newpage=page+1;
|
let newpage=page+1;
|
||||||
let url='/paths/'+id+'/search_members.json?search='+search+"&page="+newpage;
|
let url='/paths/'+id+'/search_members.json?search='+search+"&page="+newpage;
|
||||||
|
|
||||||
axios.post(url).then((result)=>{
|
axios.post(url).then((result)=>{
|
||||||
if(result.status==200){
|
if(result.status==200){
|
||||||
let list=result.data.users;
|
let list=result.data.users;
|
||||||
let newlist=partnerList;
|
let newlist=partnerList;
|
||||||
for(var j=0; j<list.length;j++){
|
for(var j=0; j<list.length;j++){
|
||||||
newlist.push(list[j])
|
newlist.push(list[j])
|
||||||
}
|
}
|
||||||
let newoptionss=optionss
|
let newoptionss=optionss
|
||||||
for(var i=0; i<list.length;i++){
|
for(var i=0; i<list.length;i++){
|
||||||
newoptionss.push(list[i].user_id)
|
newoptionss.push(list[i].user_id)
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
partnerList:newlist,
|
partnerList:newlist,
|
||||||
page:newpage,
|
page:newpage,
|
||||||
optionss:optionss
|
optionss:optionss
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let {addPartner,search,partnerList,optionss,checkAll,partnerListid} = this.state;
|
let {addPartner,search,partnerList,optionss,checkAll,partnerListid} = this.state;
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="edu-back-white bor-top-greyE addTeamMember">
|
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_add_member===true?
|
||||||
{
|
<div className="edu-back-white bor-top-greyE addTeamMember">
|
||||||
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_add_member===true?
|
<a onClick = {this.addBox} className="color-blue">+ 添加合作者</a>
|
||||||
<a onClick = {this.addBox} className="color-blue">+ 添加合作者</a>
|
<Modal
|
||||||
:""
|
keyboard={false}
|
||||||
}
|
title="添加合作者"
|
||||||
|
visible={addPartner}
|
||||||
<Modal
|
closable={false}
|
||||||
keyboard={false}
|
footer={null}
|
||||||
title="添加合作者"
|
destroyOnClose={true}
|
||||||
visible={addPartner}
|
>
|
||||||
closable={false}
|
<div className="newupload_conbox clearfix">
|
||||||
footer={null}
|
<div className="mb20">
|
||||||
destroyOnClose={true}
|
<Search placeholder="输入用户的真实姓名进行搜索" id="search_not_collaborators" style={{"width":"100%"}}
|
||||||
>
|
autocomplete="off"
|
||||||
<div className="newupload_conbox clearfix">
|
value={search}
|
||||||
<div className="mb20">
|
onInput={this.changeSearchValue}
|
||||||
<Search placeholder="输入用户的真实姓名进行搜索" id="search_not_collaborators" style={{"width":"100%"}}
|
onSearch={search => this.searchList(search)} />
|
||||||
autocomplete="off"
|
</div>
|
||||||
value={search}
|
<p className="clearfix pt10 pl10 pr10" style={{"background":"#F4FAFF","marginBottom":"0px"}}>
|
||||||
onInput={this.changeSearchValue}
|
<Checkbox className="fl"
|
||||||
onSearch={search => this.searchList(search)} />
|
onChange={this.onCheckAllChange}
|
||||||
</div>
|
checked={this.state.checkAll}
|
||||||
<p className="clearfix pt10 pl10 pr10" style={{"background":"#F4FAFF","marginBottom":"0px"}}>
|
></Checkbox>
|
||||||
<Checkbox className="fl"
|
<span className="span1 fl edu-txt-w80 task-hide font-bd">姓名</span>
|
||||||
onChange={this.onCheckAllChange}
|
<span className="span3 fl edu-txt-w80 task-hide font-bd">昵称</span>
|
||||||
checked={this.state.checkAll}
|
<span className="span2 fl edu-txt-w80 task-hide font-bd">职位</span>
|
||||||
></Checkbox>
|
<span className="span3 fl edu-txt-w260 task-hide font-bd">单位</span>
|
||||||
<span className="span1 fl edu-txt-w80 task-hide font-bd">姓名</span>
|
</p>
|
||||||
<span className="span3 fl edu-txt-w80 task-hide font-bd">昵称</span>
|
<ul className="upload_select_box fl clearfix mb15"
|
||||||
<span className="span2 fl edu-txt-w80 task-hide font-bd">职位</span>
|
style={{"overflow-y":"auto"}}
|
||||||
<span className="span3 fl edu-txt-w260 task-hide font-bd">单位</span>
|
id="search_not_members_list"
|
||||||
</p>
|
|
||||||
<ul className="upload_select_box fl clearfix mb15"
|
onScroll={this.contentViewScroll}
|
||||||
style={{"overflow-y":"auto"}}
|
>
|
||||||
id="search_not_members_list"
|
<CheckboxGroup style={{ width: '100%' }} value={checkAll===true?optionss:partnerListid} onChange={this.addCollaboratorsid}>
|
||||||
|
{
|
||||||
onScroll={this.contentViewScroll}
|
partnerList && partnerList.map((item,key)=>{
|
||||||
>
|
return(
|
||||||
<CheckboxGroup style={{ width: '100%' }} value={checkAll===true?optionss:partnerListid} onChange={this.addCollaboratorsid}>
|
<li className="clearfix">
|
||||||
{
|
<Checkbox value={item.user_id} key={key} className="fl"></Checkbox>
|
||||||
partnerList && partnerList.map((item,key)=>{
|
<a target="_blank" className="task-hide color-grey3 fl span1 edu-txt-w80">{item.user_name}</a>
|
||||||
return(
|
<span className="task-hide fl color-grey edu-txt-w80 span2">{item.nickname}</span>
|
||||||
<li className="clearfix">
|
<span className="task-hide fl color-grey edu-txt-w80 span2">{item.identity}</span>
|
||||||
<Checkbox value={item.user_id} key={key} className="fl"></Checkbox>
|
<span className="span3 color-grey fl edu-txt-w260 task-hide">{item.school_name}</span>
|
||||||
<a target="_blank" className="task-hide color-grey3 fl span1 edu-txt-w80">{item.user_name}</a>
|
</li>
|
||||||
<span className="task-hide fl color-grey edu-txt-w80 span2">{item.nickname}</span>
|
)
|
||||||
<span className="task-hide fl color-grey edu-txt-w80 span2">{item.identity}</span>
|
})
|
||||||
<span className="span3 color-grey fl edu-txt-w260 task-hide">{item.school_name}</span>
|
}
|
||||||
</li>
|
</CheckboxGroup>
|
||||||
)
|
</ul>
|
||||||
})
|
<div className="mt20 marginauto clearfix edu-txt-center">
|
||||||
}
|
<a onClick={this.hideAddBox} className="pop_close task-btn mr30">取消</a>
|
||||||
</CheckboxGroup>
|
<a className="task-btn task-btn-orange" onClick={this.SaveAddBox} id="submit_send_shixun">确定</a>
|
||||||
</ul>
|
</div>
|
||||||
<div className="mt20 marginauto clearfix edu-txt-center">
|
</div>
|
||||||
<a onClick={this.hideAddBox} className="pop_close task-btn mr30">取消</a>
|
</Modal>
|
||||||
<a className="task-btn task-btn-orange" onClick={this.SaveAddBox} id="submit_send_shixun">确定</a>
|
</div>:""
|
||||||
</div>
|
|
||||||
</div>
|
)
|
||||||
</Modal>
|
}
|
||||||
</div>
|
}
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default addCollaborators;
|
export default addCollaborators;
|
Loading…
Reference in new issue