const columns = [
{ title: '班级名称', dataIndex: 'className', key: 'className',align:'center'},
{ title: '学生人数', dataIndex: 'studentCount', key: 'studentCount',align:'center'},
{
title: '操作', dataIndex: 'classId', key: 'classId', align: "center",
render: (text, record, index) => <div className='action vertical_j'>
<span onClick={()=>this.manageGrade(record)}>管理班级</span>
<span onClick={() =>this.renameGrade(record)}>重命名</span>
<span onClick={() => this.delClass(index, record.classId)}>删除 </span>
</div>
}
]
方法:
//管理班级
manageGrade = (record) => {
this.props.history.push(`/main/training/trainingTeaching/manageGrade?${encodeURI(JSON.stringify(
{classId: record.classId,className: record.className, courseInfo: this.state.courseInfo}))}`)
}
//地址栏获取数据
componentDidMount() {
const data = this.props.location.search; //地址栏截取
if (data) {
const param = data.split("?")[1];
const codeParam = param && param.includes("%") ? decodeURI(param) : param;
const jsonparam = JSON.parse(codeParam);
this.setState({
courseInfo: jsonparam.courseInfo,
className: jsonparam.className,
classId:jsonparam.classId,
userInfo: JSON.parse(localStorage.getItem("userInfo"))
}, () => {
this.StudentList()
})
}
}