调整增加退出刷新浏览器 谷歌/实践课程调整

dev_cs_new
杨树明 6 years ago
parent 66bdd23951
commit 8fcd326566

@ -20,16 +20,16 @@ let hashTimeout
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType ="" let debugType =""
// if (isDev) { if (isDev) {
// const _search = window.location.search; const _search = window.location.search;
// let parsed = {}; let parsed = {};
// if (_search) { if (_search) {
// parsed = queryString.parse(_search); parsed = queryString.parse(_search);
// } }
// debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
// window.location.search.indexOf('debug=s') != -1 ? 'student' : window.location.search.indexOf('debug=s') != -1 ? 'student' :
// window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
// } }
window._debugType = debugType; window._debugType = debugType;
export function initAxiosInterceptors(props) { export function initAxiosInterceptors(props) {

@ -426,7 +426,7 @@ class PathDetailIndex extends Component{
</div> </div>
} }
{ {
detailInfoList === undefined ? "" : detailInfoList.progress === null ? "" : this.props.checkIfLogin()===false?"":detailInfoList === undefined ? "" : detailInfoList.progress === null ? "" :
<div className="edu-back-white myProgress padding40-20 mb10"> <div className="edu-back-white myProgress padding40-20 mb10">
<p className="mb20"> <p className="mb20">
<span className="font-16 mr10">我的进展</span> <span className="font-16 mr10">我的进展</span>

@ -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;

@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
// /images/educoder/icon/search.svg // /images/educoder/icon/search.svg
import { getImageUrl, toPath } from 'educoder' import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educoder'
import axios from 'axios'; import axios from 'axios';
@ -30,8 +30,6 @@ import 'antd/lib/input/style/index.css';
import './TPMIndex.css'; import './TPMIndex.css';
import { trigger, broadcastChannelPostMessage } from 'educoder';
const $ = window.$ const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用 // TODO 这部分脚本从公共脚本中直接调用
@ -316,6 +314,7 @@ class NewHeader extends Component {
// this.setState({ // this.setState({
// isRender:true // isRender:true
// }) // })
broadcastChannelPostMessage('refreshPage')
window.location.href = "/"; window.location.href = "/";
} }
}).catch((error) => { }).catch((error) => {

Loading…
Cancel
Save