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

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

@ -20,16 +20,16 @@ let hashTimeout
// TODO 开发期多个身份切换
let debugType =""
// if (isDev) {
// const _search = window.location.search;
// let parsed = {};
// if (_search) {
// parsed = queryString.parse(_search);
// }
// 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 || 'admin'
// }
if (isDev) {
const _search = window.location.search;
let parsed = {};
if (_search) {
parsed = queryString.parse(_search);
}
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 || 'admin'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {

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

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

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

Loading…
Cancel
Save