Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_local_cqdsj
daiao 6 years ago
commit 9eb1dbe101

@ -46,12 +46,12 @@ class Admins::UserStatisticQuery < ApplicationQuery
finish_challenge = finish_challenge.where(updated_at: time_range) finish_challenge = finish_challenge.where(updated_at: time_range)
end end
study_myshixun_map = study_myshixun.group(:user_id).count study_myshixun_map = study_myshixun.reorder(nil).group(:user_id).count
finish_myshixun_map = finish_myshixun.group(:user_id).count finish_myshixun_map = finish_myshixun.reorder(nil).group(:user_id).count
study_challenge_map = study_challenge.group(:user_id).count study_challenge_map = study_challenge.reorder(nil).group(:user_id).count
finish_challenge_map = finish_challenge.group(:user_id).count finish_challenge_map = finish_challenge.reorder(nil).group(:user_id).count
evaluate_count_map = study_challenge.group(:user_id).sum(:evaluate_count) evaluate_count_map = study_challenge.reorder(nil).group(:user_id).sum(:evaluate_count)
cost_time_map = study_challenge.group(:user_id).sum(:cost_time) cost_time_map = study_challenge.reorder(nil).group(:user_id).sum(:cost_time)
users.each do |user| users.each do |user|
user._extra_data = { user._extra_data = {

@ -25,3 +25,4 @@ json.excellent @course.excellent
if @course.is_end == 0 if @course.is_end == 0
json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i
end end
json.teacher_applies_count CourseMessage.unhandled_join_course_requests_by_course(@course).size if @user_course_identity < Course::ASSISTANT_PROFESSOR

@ -150,16 +150,16 @@ export function initAxiosInterceptors(props) {
throw new axios.Cancel('Operation canceled by the user.'); throw new axios.Cancel('Operation canceled by the user.');
} else { } else {
// hash跳转 // hash跳转
var hash = window.location.hash; // var hash = window.location.hash;
if (hash) { // if (hash) {
hashTimeout && window.clearTimeout(hashTimeout) // hashTimeout && window.clearTimeout(hashTimeout)
hashTimeout = setTimeout(() => { // hashTimeout = setTimeout(() => {
var element = document.querySelector(hash); // var element = document.querySelector(hash);
if (element) { // if (element) {
element.scrollIntoView(); // element.scrollIntoView();
} // }
}, 400) // }, 400)
} // }
} }
// if(response.data.status === 401){ // if(response.data.status === 401){
// console.log("401401401") // console.log("401401401")

@ -68,7 +68,8 @@ class Registration extends React.Component {
mutiple_limited: false, mutiple_limited: false,
teamutiple_limited: false, teamutiple_limited: false,
members_count: 0, members_count: 0,
mode: 0 mode: 0,
region_schools: [],
} }
} }
@ -82,8 +83,8 @@ class Registration extends React.Component {
// //// //////console.log(this.props.isAdmin()) // //// //////console.log(this.props.isAdmin())
try { try {
const {keyword, page, per_page} = this.state; const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);// 获取列表数据
this.GetenrollmentAPI(); this.GetenrollmentAPI();//获取我的报名配置
} catch (e) { } catch (e) {
// const {keyword, page, per_page} = this.state; // const {keyword, page, per_page} = this.state;
// this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.Getdata(keyword, page, per_page, this.props.isAdmin());
@ -104,6 +105,8 @@ class Registration extends React.Component {
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);
//取报名配置 //取报名配置
this.GetenrollmentAPI(); this.GetenrollmentAPI();
//取模式
this.Getdataheader();
} }
} }
@ -116,6 +119,7 @@ class Registration extends React.Component {
if (result.data) { if (result.data) {
this.setState({ this.setState({
mode: result.data.mode, mode: result.data.mode,
region_schools: result.data.region_schools
}) })
} }
@ -454,6 +458,37 @@ class Registration extends React.Component {
return return
} }
let {region_schools} = this.state;
//判断是否是否是同一个学校数组元素为0就不用判断
try {
if (region_schools.length > 0) {
let i = 0;
for (var r = 0; r < region_schools.length; r++) {
if (region_schools[r] === this.props.user.user_school) {
// 终止循环
break;
}
i = i + 1;
}
if (i === region_schools.length) {
//如果i 等于region_schools.length说明本次循环中没有相同的学校本人不支持报名
try {
this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`);
} catch (e) {
}
this.Getdataheader();
return
}
}
} catch (e) {
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {
try { try {
@ -541,6 +576,34 @@ class Registration extends React.Component {
return return
} }
let {region_schools} = this.state;
//判断是否是否是同一个学校数组元素为0就不用判断
try {
if (region_schools.length > 0) {
let i = 0;
for (var r = 0; r < region_schools.length; r++) {
if (region_schools[r] === this.props.user.user_school) {
// 终止循环
break;
}
i = i + 1;
}
if (i === region_schools.length) {
//如果i 等于region_schools.length说明本次循环中没有相同的学校本人不支持报名
try {
this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`);
} catch (e) {
}
this.Getdataheader();
return
}
}
} catch (e) {
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large" size="large"
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<a href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null} <a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"} this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
> >
@ -181,7 +181,7 @@ class CompetitionsIndex extends Component{
<List.Item.Meta <List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a className={"competitionstitles"} <a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null} href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a> >{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/} {/*<span>{item.sub_title===null?"":*/}

@ -31,6 +31,9 @@ class CompetitionCommon extends Component{
window.document.title = '竞赛'; window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){ if(this.props.match.params.identifier!=null){
this.getbannerdata(); this.getbannerdata();
// this.setState({
// thiskeys:this.props.location.search.replace('?menu=', '')
// })
// let url=`/competitions/${this.props.match.params.identifier}.json`; // let url=`/competitions/${this.props.match.params.identifier}.json`;
// axios.get(url).then((response) => { // axios.get(url).then((response) => {
// if(response.status===200){ // if(response.status===200){
@ -45,19 +48,34 @@ class CompetitionCommon extends Component{
} }
getbannerdata=()=>{ getbannerdata=()=>{
let menuid=this.props.location.search.replace('?menu=', '');
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.status===200){ if(response.status===200){
this.setState({ this.setState({
data:response.data, data:response.data,
thiskeys:response.data.competition_modules[0].id thiskeys:menuid===undefined||menuid===""?response.data.competition_modules[0].id:menuid
}) })
this.getrightdata( if(menuid===undefined||menuid===""){
response.data.competition_modules[0].id, this.getrightdata(
response.data.competition_modules[0].module_type, response.data.competition_modules[0].id,
response.data.competition_modules[0].module_url, response.data.competition_modules[0].module_type,
response.data.competition_modules[0].has_url response.data.competition_modules[0].module_url,
) response.data.competition_modules[0].has_url
)
}else{
let newlist=response.data.competition_modules;
newlist.map((item,key)=>{
if(`${item.id}`===`${menuid}`){
this.getrightdata(
item.id,
item.module_type,
item.module_url,
item.has_url
)
}
})
}
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -83,6 +101,7 @@ class CompetitionCommon extends Component{
getrightdatas=(e)=>{ getrightdatas=(e)=>{
let keys=parseInt(e.key); let keys=parseInt(e.key);
this.getlistdata(keys) this.getlistdata(keys)
this.props.history.replace(`?menu=${keys}`);
} }
getlistdata=(keys,listkey)=>{ getlistdata=(keys,listkey)=>{
@ -109,7 +128,7 @@ class CompetitionCommon extends Component{
if(response.status===200){ if(response.status===200){
this.setState({ this.setState({
chart_rules:response.data, chart_rules:response.data,
tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey
}) })
@ -121,6 +140,7 @@ class CompetitionCommon extends Component{
} }
getrightdata=(id,typeid,module_url,has_url,listkey)=>{ getrightdata=(id,typeid,module_url,has_url,listkey)=>{
// if(typeid==="enroll"){ // if(typeid==="enroll"){
// this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`); // this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`);
// return // return
@ -234,7 +254,7 @@ class CompetitionCommon extends Component{
} }
render() { render() {
let {data,has_url,module_type,Competitionedittype,mdContentdata}=this.state; let {data,thiskeys,Competitionedittype}=this.state;
return ( return (
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>
@ -327,7 +347,7 @@ class CompetitionCommon extends Component{
<Layout className={'teamsLayout mt40'}> <Layout className={'teamsLayout mt40'}>
<Sider> <Sider>
<Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={[`${this.state.thiskeys}`]} onClick={(e)=>this.getrightdatas(e)}> <Menu mode="inline" className="CompetitionMenu" selectedKeys={[`${this.state.thiskeys}`]} onClick={(e)=>this.getrightdatas(e)}>
{data&&data.competition_modules.map((item,key)=>{ {data&&data.competition_modules.map((item,key)=>{
if(item.module_type!="enroll"){ if(item.module_type!="enroll"){
return( return(

@ -9,20 +9,19 @@ class CompetitionContents extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state={
hash:undefined
} }
} }
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; window.document.title = '竞赛';
this.props.MdifHasAnchorJustScorll();
} }
render() { render() {
let{mdContentdata}=this.props; let{mdContentdata}=this.props;
// //mdhash滚动
this.props.MdifHasAnchorJustScorll();
return ( return (
<div className={"fr"}> <div className={"fr"}>

@ -30,6 +30,7 @@ class CompetitionContents extends Component{
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
this.props.MdifHasAnchorJustScorll();
} }
derivefun=(url)=>{ derivefun=(url)=>{
@ -65,6 +66,7 @@ class CompetitionContents extends Component{
}); });
} }
render() { render() {
this.props.MdifHasAnchorJustScorll();
const operations = <div> const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
@ -76,40 +78,40 @@ class CompetitionContents extends Component{
title: 'usersum', title: 'usersum',
dataIndex: 'usersum', dataIndex: 'usersum',
key: 'name', key: 'name',
render: text => <a className={"color-blue"}>{text}</a>, render: text => <span className={"color-blue"}>{text}</span>,
}, },
{ {
title: 'userimg', title: 'userimg',
dataIndex: 'userimg', dataIndex: 'userimg',
key: 'userimg', key: 'userimg',
render: (text, record) =>( render: (text, record) =>(
<a href={`/users/${record.user_login}`} className="color-dark"> <span href={`/users/${record.user_login}`} className="color-dark">
<img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/> <img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/>
</a>), </span>),
}, },
{ {
title: 'username', title: 'username',
dataIndex: 'username', dataIndex: 'username',
key: 'username', key: 'username',
render: text => <a title={text}>{text}</a>, render: text => <span title={text}>{text}</span>,
}, },
{ {
title: 'school', title: 'school',
dataIndex: 'school', dataIndex: 'school',
key: 'school', key: 'school',
render: text => <a title={text}>{text}</a>, render: text => <span title={text}>{text}</span>,
}, },
{ {
title: 'spendtime', title: 'spendtime',
dataIndex: 'spendtime', dataIndex: 'spendtime',
key: 'spendtime', key: 'spendtime',
render: text => <a>{text}</a>, render: text => <span>{text}</span>,
}, },
{ {
title: 'score', title: 'score',
dataIndex: 'score', dataIndex: 'score',
key: 'score', key: 'score',
render: text => <a className={"color-blue"}>{text}</a>, render: text => <span className={"color-blue"}>{text}</span>,
}, },
]; ];

@ -477,8 +477,9 @@ class CoursesBanner extends Component {
render() { render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state; let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state;
const isCourseEnd = this.props.isCourseEnd()
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name; const isCourseEnd = this.props.isCourseEnd();
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
return ( return (
<div> <div>
{/*{*/} {/*{*/}
@ -705,18 +706,29 @@ class CoursesBanner extends Component {
`} `}
</style> </style>
<Breadcrumb separator="|" className={"mt5"}> <Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")} className={"pointer"}>
<span className="color-grey-c font-16"><span className={"mr10"}>教师</span> <span className={"mr10"}>{coursedata.teacher_count}</span></span> <Breadcrumb.Item className={"pointer"}>
<Tooltip visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
placement="topLeft"
title={<pre>{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?<span>您有{coursedata.teacher_applies_count}条新的加入申请<a className={"daishenp"} onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>待审批</a></span>:""}</pre>}>
<span className="color-grey-c font-16" onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<span className={"mr10"}>教师</span>
<span className={"mr10"}>{coursedata.teacher_count}</span>
</span>
</Tooltip>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item <Breadcrumb.Item
className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"} className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"}
onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")} onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}
> >
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"": <Breadcrumb.Item>{coursedata.credit===null?"":
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span>
}</Breadcrumb.Item> }</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
{/*<li className={"mt7 teachersbox"} >*/} {/*<li className={"mt7 teachersbox"} >*/}

@ -391,9 +391,8 @@ class OneSelfOrderModal extends Component{
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF"> || this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF">
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}> <li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
<span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name ml50">分班名称</span> <span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name color-grey-9">分班名称</span>
<span style={{"float":"right","color":"#05101A","margin-right": "145px"}} className="task-hide color-grey-name color-grey-9">截止时间</span>
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</span>
</li> </li>
</div>} </div>}
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2

@ -1745,3 +1745,8 @@ input.ant-input-number-input:focus {
color: #fff; color: #fff;
margin: 0 auto; margin: 0 auto;
} }
.daishenp{
color: #F79946 !important;
text-decoration: underline !important;
}

@ -542,6 +542,7 @@ class Exercise extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
style="grey" style="grey"
single={true}
checkBoxValues={this.state.checkBoxValues} checkBoxValues={this.state.checkBoxValues}
action={this.reloadList} action={this.reloadList}
></ImmediatelyEnd> ></ImmediatelyEnd>

@ -421,8 +421,8 @@ class Testpapersettinghomepage extends Component{
className={"btn fr color-blue font-16 mt20 mr20"} className={"btn fr color-blue font-16 mt20 mr20"}
checkBoxValues={[parseInt(this.props.match.params.Id)]} checkBoxValues={[parseInt(this.props.match.params.Id)]}
Exercisetype={"exercise"} Exercisetype={"exercise"}
// single={true}
action={this.Commonheadofthetestpaper} action={this.Commonheadofthetestpaper}
single={true}
></ImmediatelyEnd>:"":""} ></ImmediatelyEnd>:"":""}
{isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish {isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish
{...this.props} {...this.props}

@ -50,10 +50,14 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
application_id: record.application_id, application_id: record.application_id,
approval: approval, approval: approval,
group_id: arg_course_groups group_id: arg_course_groups
}) }).then((result) => {
props.showNotification(`${approval == 1? '同意' : '拒绝'}`) if (result.data.status === 0) {
fetchAll(1) props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
modalEl.current.setVisible(false) fetchAll(1)
modalEl.current.setVisible(false)
window.location.reload();
}})
} }
return ( return (
<ModalWrapper <ModalWrapper

@ -258,7 +258,7 @@ class studentsList extends Component{
// approval 2 - 拒绝 // approval 2 - 拒绝
onAgree = (record, approval = 1) => { onAgree = (record, approval = 1) => {
const isAdminOrCreator = this.props.isAdminOrCreator() const isAdminOrCreator = this.props.isAdminOrCreator()
const { course_groups } = this.state const { course_groups ,filterKey} = this.state
if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) { if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) {
this.setState({ clickRecord: record}, () => { this.setState({ clickRecord: record}, () => {
this.setGroupChooserModalVisible(true) this.setGroupChooserModalVisible(true)
@ -280,7 +280,7 @@ class studentsList extends Component{
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification(`${approval == 1? '同意' : '拒绝'}`) this.props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
this.fetchAll(1) this.fetchAll(1,filterKey)
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -299,7 +299,20 @@ class studentsList extends Component{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
this.fetchAll(1); let newmenuid=this.props.location.search.replace('?tab=', '');
if(newmenuid===undefined||newmenuid===""||newmenuid==="1"||newmenuid===1){
this.setState({
filterKey:'1'
})
this.fetchAll(1,'1');
}else{
this.setState({
filterKey:'2'
})
this.fetchAll(1,'2');
}
const isAdminOrTeacher = this.props.isAdminOrTeacher() const isAdminOrTeacher = this.props.isAdminOrTeacher()
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
@ -319,10 +332,11 @@ class studentsList extends Component{
this.getCourseGroups() this.getCourseGroups()
} }
addTeacherSuccessListener = (e, data) => { addTeacherSuccessListener = (e, data) => {
// const params = JSON.parse(data) // const params = JSON.parse(data)
// const coursesId = this.props.match.params.coursesId // const coursesId = this.props.match.params.coursesId
if (window.location.pathname.endsWith('teachers')) { if (window.location.pathname.endsWith('teachers')) {
this.fetchAll(1) this.fetchAll(1,this.state.filterKey)
} else { } else {
// this.props.history.push(`/courses/${coursesId}/teachers`) // this.props.history.push(`/courses/${coursesId}/teachers`)
} }
@ -382,9 +396,11 @@ class studentsList extends Component{
}); });
} }
onChangeRoleSuccess = () => { onChangeRoleSuccess = () => {
this.fetchAll() this.fetchAll(undefined,this.state.filterKey)
} }
fetchAll = async (argPage) => { fetchAll = async (argPage,filterKey) => {
let { searchValue }=this.state
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
@ -395,7 +411,7 @@ class studentsList extends Component{
const sortedInfo = this.state.sortedInfo; const sortedInfo = this.state.sortedInfo;
let page = argPage || this.state.page let page = argPage || this.state.page
let { searchValue, filterKey }=this.state
let order = 1; let order = 1;
if (sortedInfo.columnKey == 'role') { if (sortedInfo.columnKey == 'role') {
order = 1; order = 1;
@ -464,7 +480,7 @@ class studentsList extends Component{
// join_graduation_group // join_graduation_group
joinGraduationGroup = (graduation_group_id) => { joinGraduationGroup = (graduation_group_id) => {
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
let { filterKey }=this.state
let url= `/courses/${courseId}/join_graduation_group.json`; let url= `/courses/${courseId}/join_graduation_group.json`;
axios.post(url, { axios.post(url, {
course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }), course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }),
@ -472,7 +488,7 @@ class studentsList extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status==0){ if(result.data.status==0){
this.props.showNotification('操作成功。') this.props.showNotification('操作成功。')
this.fetchAll() this.fetchAll(undefined,filterKey)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -480,6 +496,7 @@ class studentsList extends Component{
} }
onInputSearchChange = (e) => { onInputSearchChange = (e) => {
let {filterKey}=this.state;
this.setState({ this.setState({
searchValue: e.target.value searchValue: e.target.value
}) })
@ -488,12 +505,12 @@ class studentsList extends Component{
clearTimeout(this.timeoutHandler) clearTimeout(this.timeoutHandler)
} }
this.timeoutHandler = setTimeout(() => { this.timeoutHandler = setTimeout(() => {
this.fetchAll(1) this.fetchAll(1,filterKey)
}, 1200) }, 1200)
} }
onPressEnter = (e) => { onPressEnter = (e) => {
this.fetchAll(1) this.fetchAll(1,this.state.filterKey)
} }
@ -530,7 +547,7 @@ class studentsList extends Component{
changeRole = (member, role) => { changeRole = (member, role) => {
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
let {filterKey}=this.state;
let url= `/courses/${courseId}/change_course_teacher.json`; let url= `/courses/${courseId}/change_course_teacher.json`;
axios.post(url, { axios.post(url, {
course_member_id: member.course_member_id course_member_id: member.course_member_id
@ -543,7 +560,7 @@ class studentsList extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status==0){ if(result.data.status==0){
this.props.showNotification('操作成功。') this.props.showNotification('操作成功。')
this.fetchAll() this.fetchAll(undefined,filterKey)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -559,9 +576,11 @@ class studentsList extends Component{
this.refs.addAdminModal.setVisible(true) this.refs.addAdminModal.setVisible(true)
} }
changeAdminSuccess = () => { changeAdminSuccess = () => {
this.fetchAll() let {filterKey}=this.state;
this.fetchAll(undefined,filterKey)
} }
onDelete = (member) => { onDelete = (member) => {
let {filterKey}=this.state;
this.props.confirm({ this.props.confirm({
content: `确认要将“${member.name}”从教师列表中移除吗?`, content: `确认要将“${member.name}”从教师列表中移除吗?`,
onOk: () => { onOk: () => {
@ -577,7 +596,7 @@ class studentsList extends Component{
// {"status":1,"message":"删除成功"} // {"status":1,"message":"删除成功"}
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
trigger('updatabanner') trigger('updatabanner')
this.fetchAll() this.fetchAll(undefined,filterKey)
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -602,12 +621,13 @@ class studentsList extends Component{
} }
onTableChange = (pagination, filters, sorter) => { onTableChange = (pagination, filters, sorter) => {
let {filterKey}=this.state;
console.log('Various parameters', pagination, filters, sorter); console.log('Various parameters', pagination, filters, sorter);
this.setState({ this.setState({
page: pagination.current, page: pagination.current,
sortedInfo: sorter, sortedInfo: sorter,
}, () => { }, () => {
this.fetchAll() this.fetchAll(undefined,filterKey)
}); });
}; };
clearSelection = () => { clearSelection = () => {
@ -620,7 +640,7 @@ class studentsList extends Component{
page:1, page:1,
isSpin:true isSpin:true
}, () => { }, () => {
this.fetchAll(); this.fetchAll(undefined,e.key);
}) })
} }
setGroupChooserModalVisible = (visible) => { setGroupChooserModalVisible = (visible) => {
@ -655,6 +675,8 @@ class studentsList extends Component{
const hasGraduationModule = this.hasGraduationModule() const hasGraduationModule = this.hasGraduationModule()
const coursesId = this.props.match.params.coursesId const coursesId = this.props.match.params.coursesId
return( return(
<React.Fragment> <React.Fragment>
{/* <AddTeacherModal ref="addTeacherModal" {/* <AddTeacherModal ref="addTeacherModal"
@ -693,7 +715,7 @@ class studentsList extends Component{
} }
secondRowLeft={ secondRowLeft={
isAdminOrTeacher ? <div className="fl mt6 task_menu_ul " style={{ width: '600px' }}> isAdminOrTeacher ? <div className="fl mt6 task_menu_ul " style={{ width: '600px' }}>
<Menu mode="horizontal" defaultSelectedKeys="1" onClick={this.selectedStatus}> <Menu mode="horizontal" selectedKeys={[`${this.state.filterKey}`]} onClick={this.selectedStatus}>
<Menu.Item key="1">已审批({total_count})</Menu.Item> <Menu.Item key="1">已审批({total_count})</Menu.Item>
<Menu.Item key="2">待审批({apply_size})</Menu.Item> <Menu.Item key="2">待审批({apply_size})</Menu.Item>
</Menu> </Menu>
@ -740,9 +762,11 @@ class studentsList extends Component{
<div className="mt20 edu-back-white padding20 teacherList"> <div className="mt20 edu-back-white padding20 teacherList">
{ course_groups && !!course_groups.length && <CourseGroupChooserModal { course_groups && !!course_groups.length && <CourseGroupChooserModal
{...this.state}
{...this.props}
props={{match: this.props.match, showNotification: this.props.showNotification}} props={{match: this.props.match, showNotification: this.props.showNotification}}
record={this.state.clickRecord} record={this.state.clickRecord}
fetchAll={this.fetchAll} fetchAll={(e)=>this.fetchAll(e,this.state.filterKey)}
course_groups={course_groups} course_groups={course_groups}
visible={this.state.groupChooserModalVisible} visible={this.state.groupChooserModalVisible}
setVisible={this.setGroupChooserModalVisible} setVisible={this.setGroupChooserModalVisible}

@ -563,6 +563,7 @@ class Poll extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
style="grey" style="grey"
single={true}
checkBoxValues={this.state.checkBoxValues} checkBoxValues={this.state.checkBoxValues}
action={this.successFun} action={this.successFun}
></ImmediatelyEnd> ></ImmediatelyEnd>

@ -202,7 +202,7 @@ class PollDetailIndex extends Component{
className={"font-16"} className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]} checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo} action={this.getPollInfo}
single={true} // single={true}
></ImmediatelyEnd> ></ImmediatelyEnd>
</li> </li>
:"" :""

@ -14,6 +14,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
imageSrc: '' imageSrc: ''
} }
} }
onDelegateClick = (event) => { onDelegateClick = (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片 // 判断imageSrc是否是图片
@ -35,6 +36,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
return false; return false;
} }
} }
// jQuery._data( $('.newMain')[0], "events" ) // jQuery._data( $('.newMain')[0], "events" )
componentDidMount() { componentDidMount() {
this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef']) this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef'])
@ -45,6 +47,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
.delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick); .delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick);
}, 1200) }, 1200)
} }
componentWillUnmount() { componentWillUnmount() {
$(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick) $(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick)
} }
@ -56,8 +59,23 @@ export function ImageLayerOfCommentHOC(options = {}) {
}) })
} }
render() { MdifHasAnchorJustScorll=()=>{
//mdhash滚动
let anchor = decodeURI(this.props.location.hash).replace('#', '');
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length!=0) {
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}
}
render() {
this.MdifHasAnchorJustScorll();
return ( return (
<React.Fragment> <React.Fragment>
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer> <ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>

@ -609,6 +609,21 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading = () => { hideGlobalLoading = () => {
this.setState({ globalLoading: false }) this.setState({ globalLoading: false })
} }
MdifHasAnchorJustScorll=()=>{
//mdhash滚动
let anchor = decodeURI(this.props.location.hash).replace('#', '');
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length>0){
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}
}
render() { render() {
let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state; let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state;
const common = { const common = {
@ -643,6 +658,7 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading: this.hideGlobalLoading, hideGlobalLoading: this.hideGlobalLoading,
yslslowCheckresults:this.yslslowCheckresults, yslslowCheckresults:this.yslslowCheckresults,
yslslowCheckresultsNo:this.yslslowCheckresultsNo, yslslowCheckresultsNo:this.yslslowCheckresultsNo,
MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll
}; };
// console.log("this.props.mygetHelmetapi"); // console.log("this.props.mygetHelmetapi");

Loading…
Cancel
Save