统计模块调整

dev_auth
杨树明 5 years ago
parent 3f3b597266
commit 5cec086da5

@ -1017,6 +1017,7 @@ class Coursesleftnav extends Component{
return(
<div key={key} >
<a>
{item.type!="statistics"?
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
@ -1050,7 +1051,7 @@ class Coursesleftnav extends Component{
</Popover>:""}
</a>
</li>
</li>:""}
{/*下拉列表*/}
@ -1154,6 +1155,7 @@ class Coursesleftnav extends Component{
<div key={key}>
{/*<Tooltip placement="bottom" title={"点击空白处展开二级菜单,点击模块名字跳转到对应模块"}>*/}
<a >
{item.type!="statistics"?
<li className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"}
onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)}
title={item.name.length<7?"":item.name}
@ -1177,7 +1179,7 @@ class Coursesleftnav extends Component{
<span className={this.props.location.pathname===item.category_url?"color-blue fr mr20 font-14":"fr mr20 color999 font-14"}>{item.task_count===0?"":item.task_count}</span>
</a>
</li>
</li>:""}
</a>
<ul style={{display:key===this.props.indexs?"":"none"}} class="droppableul">

@ -12,42 +12,138 @@ class Statistics extends Component{
nd1:60,
nd2:40,
nd3:20,
data:undefined
data:undefined,
bomdata:undefined,
topisSpin:true,
bomisSpin:true,
sort:'desc',
course_groups:[],
page:1
}
}
componentDidMount() {
this.setState({
isSpin:true,
})
let {page,group_ids,sort}=this.state;
let courseId=this.props.match.params.coursesId;
let url=`/courses/${courseId}/statistics.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data.top_scores
data:result.data.top_scores,
topisSpin:false
})
}
}).catch((error) => {
console.log(error);
this.setState({
isSpins:false,
topisSpin:false,
})
})
let courseurl=`/courses/${courseId}/all_course_groups.json`;
axios.get(courseurl).then((result) => {
if (result) {
this.setState({
course_groups:result.data.course_groups
})
let list=result.data.course_groups;
if(list.length>0){
this.setState({
group_ids:[list[0].id],
})
this.getwork_scoredata(page,[list[0].id],sort);
}
}
}).catch((error) => {
console.log(error);
})
}
getwork_scoredata=(page,group_ids,sort)=>{
let courseId=this.props.match.params.coursesId;
let url=`/courses/${courseId}/work_score.json`;
let data={
limit:20,
page:page,
group_ids:group_ids,
sort:sort
}
axios.get(url,{params:
data
}).then((result) => {
if (result) {
this.setState({
bomdata:result.data.course_members,
bomisSpin:false
})
}
}).catch((error) => {
console.log(error);
this.setState({
bomisSpin:false,
})
})
}
callback=(key)=>{
console.log(key);
}
render(){
let {nd1,nd2,nd3,data}=this.state;
let {nd1,nd2,nd3,data,bomdata,course_groups}=this.state;
let course_grouptype=false
if(this.props&&this.props.course_modules!=undefined){
{this.props&&this.props.course_modules.map((item,key)=>{
if(item.type==="course_group"){
course_grouptype=true
}
})}
}
// const columns = [
// {
// title: 'Name',
// dataIndex: 'name',
// sorter: true,
// render: name => `${name.first} ${name.last}`,
// width: '20%',
// },
// {
// title: 'Gender',
// dataIndex: 'gender',
// filters: course_groups,
// width: '20%',
// },
// {
// title: 'Email',
// dataIndex: 'email',
// },
// ];
// console.log(bomdata)
//common_score: 0
// course_group: "威风威风急急急"
// exercise_score: "0.0"
// graduation_score: 0
// group_score: 0
// practice_score: 3232
// total_score: 3232
// user_login: "p40793521"
// user_name: "李明霞"
return(
<React.Fragment >
<div>
<div className="edu-back-white">
<Spin size="large" spinning={this.state.topisSpin}>
<p className="clearfix padding30">
<Row gutter={24}>
<Col>
@ -200,18 +296,26 @@ class Statistics extends Component{
</Row>
</p>
</Spin>
</div>
<div className="mt20 edu-back-white">
<Spin size="large" spinning={this.state.bomisSpin}>
<Tabs className="statisticsTabs" defaultActiveKey="1" onChange={this.callback}>
<TabPane tab="学习成绩" key="1" className={"statisticsTabs1"}>
Content of Tab Pane 1
{/*<Table*/}
{/*columns={columns}*/}
{/*dataSource={bomdata}*/}
{/*onChange={this.handleTableChange}*/}
{/*/>*/}
</TabPane>
<TabPane tab="课堂活跃度" key="2">
Content of Tab Pane 2
</TabPane>
</Tabs>
</Spin>
</div>
</div>
</React.Fragment>
)

Loading…
Cancel
Save