分组作业调整

dev_aliyun_beta
杨树林 6 years ago
parent d316a52a0f
commit 2d4021a8e0

@ -1,25 +1,26 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn} from 'educoder';
import {BrowserRouter as Router,Route,Switch,Link, NavLin} from 'react-router-dom';
import {WordsBtn, ActionBtn,getImageUrl} from 'educoder';
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form } from "antd";
import axios from 'axios';
import {
notification
} from "antd";
import CoursesListType from '../coursesPublic/CoursesListType';
import Groupjobbandetails from './Groupjobbandetails';
import Groupjobquesanswer from './Groupjobquesanswer';
import SendTopics from '../../modals/SendTopics';
import Modals from '../../modals/Modals';
import BanksMenu from '../../user/usersInfo/banks/banksMenu'
import Loadable from 'react-loadable';
import Loading from '../../../Loading';
import '../css/members.css';
import "../common/formCommon.css";
import '../css/Courses.css';
import '../css/busyWork.css';
import '../poll/pollStyle.css';
import Generaljobdetails from "../questionbank/Generaljobdetails";
// 问卷内容
const Groupjobbandetails = Loadable({
loader: () => import('./Groupjobbandetails'),
loading: Loading,
})
// 试卷详情
const Groupjobquesanswer = Loadable({
loader: () => import('./Groupjobquesanswer'),
loading: Loading,
});
class GroupjobbankPage extends Component {
//分组作业内容详情
constructor(props) {
@ -30,48 +31,16 @@ class GroupjobbankPage extends Component {
workid:1,
isSpin:false,
datas:[],
visible:false
}
}
//切换tab
ChangeTab = (e) => {
// console.log(e);
this.setState({
tab: e
})
try {
var currenturl = window.location.href;
var newUrl = (currenturl.split("?"))[0];
window.history.pushState('','',newUrl+'?tab='+e);
}catch (e) {
console.log(e);
console.log("44");
visible:false,
banksMenu:undefined
}
this.getonedata();
}
componentDidMount() {
// console.log("父组件加载框");
const query = this.props.location.search;
const type = query.split('?tab=');
// let sum = []
// sum.push(type[1])
// console.log("componentDidMountcomponentDidMount");
// console.log(type);
this.setState({
tab: type[1],
})
let querys = this.props.location.pathname;
const types = querys.split('/');
// console.log(types);
this.setState({
shixuntypes: types[3]
})
this.getonedata();
}
getonedata=()=>{
if( this.props.match.params.workid){
this.setState({
@ -79,8 +48,8 @@ class GroupjobbankPage extends Component {
})
}
this.getdata(this.props.match.params.workid);
}
///获取数据的地方
};
//获取数据的地方
getdata=(workid)=>{
var workids= workid;
if(workids){
@ -106,7 +75,20 @@ class GroupjobbankPage extends Component {
crumbArray:[
{content:'详情'}
]
};
const menuData={
tab:'0',//tab选中的index
menuArray:[//tab以及tab路由
{to:`/banks/normal/${workids}/${this.props.match.params.type}/details`,content:'内容详情'},
{to:`/banks/normal/${workids}/${this.props.match.params.type}/answer`,content:'参考答案'}
],
category:'normal',//毕设选题
tos:`/banks/normal/${workids}/edit/${this.props.match.params.type}`,
id:workids,
}
this.setState({
banksMenu:menuData
})
this.props.initPublic(crumbData);
}catch (e) {
@ -134,134 +116,54 @@ class GroupjobbankPage extends Component {
isSpin:false,
})
});
}
//发送至相关
sendTopics=()=>{
this.setState({
visible:true
})
}
topicscancelmodel=()=>{
this.setState({
Modalstype:false,
Loadtype:false,
visible:false,
Modalstopval:"",
ModalCancel:"",
ModalSave:"",
checkBoxValues:[],
checkedtype:false
})
}
//删除相关
deletecheckBoxValues=()=>{
this.setState({
Modalstype:true,
Modalstopval:"是否确认删除?",
ModalCancel:this.topicscancelmodel,
ModalSave:this.topicssavedelete,
})
}
topicssavedelete=()=>{
const url = `/question_banks/multi_delete.json`;
axios.delete(url, { data: {
object_id: [this.props.match.params.workid],
object_type:"group"
}})
.then((response) => {
if(response.data.status===0){
this.props.showNotification(response.data.message)
window.location.href=`/users/${this.props.current_user.login}/topics/personal`;
}else{
this.props.showNotification(response.data.message)
}
})
.catch(function (error) {
console.log(error);
});
this.topicscancelmodel()
}
};
// initPublic = (crumbData,menuData) =>{
// this.setState({
// banksMenu:menuData
// })
// this.props.initPublic(crumbData);
// }
render() {
let {tab,datas,visible} = this.state;
let user_id=this.props.current_user&&this.props.current_user.user_id;
let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id;
let{
banksMenu
}=this.state
//
// const common={
// initPublic:this.initPublic,
// }
return (
<div className="newMain clearfix ">
{this.state.Modalstype&&this.state.Modalstype===true?<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype}
/>:""}
{/*发送至弹窗*/}
<React.Fragment>
{
visible&&visible===true?
<SendTopics
{...this.state}
banksMenu &&
<BanksMenu
banksMenu={banksMenu}
{...this.props}
visible={visible}
category={"group"}
checkBoxValues={[this.props.match.params.workid]}
topicscancelmodel={()=>this.topicscancelmodel()}
/>:""
{...this.state}
></BanksMenu>
}
<Switch {...this.props}>
<Route path={`/banks/group/:workid/${this.props.match.params.type}/details`}
render={
(props) => {
return (<Groupjobbandetails {...this.props} {...props} {...this.state} datas={datas} />)
}
}></Route>
<Route path={`/banks/group/:workid/${this.props.match.params.type}/answer`}
render={
(props) => {
return (<Groupjobquesanswer {...this.props} {...props} {...this.state} datas={datas} />)
}
}></Route>
<div className={"educontent mt10 mb20"} style={{width: "1200px"}}>
{/*<div className="educontent mb20">*/}
{/* <p className="clearfix mb20 mt10">*/}
{/* <a className="btn colorgrey fl hovercolorblue ">题库</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <a*/}
{/* className=" btn colorgrey fl hovercolorblue "*/}
{/* >详情</a>*/}
{/* </p>*/}
{/*</div>*/}
{/*<div className="educontent mb20">*/}
{/* <p className=" fl color-black summaryname" style={{heigth: "33px"}}>*/}
{/* {datas&&datas.name}*/}
{/* </p>*/}
{/* <CoursesListType*/}
{/* typelist={datas.is_public===true?["公开"]:["私有"]}*/}
{/* />*/}
{/*</div>*/}
<div className="edu-back-white " id="yslgroup1">
<div className="stud-class-set bor-bottom-greyE ">
<div className=" clearfix edu-back-white poll_list">
<a className={parseInt(tab) === 0 ? "active ml12" : "ml12"} onClick={(e) => this.ChangeTab(0)}>内容详情</a>
<a className={parseInt(tab) === 1 ? "active ml12" : "ml12"} onClick={(e) => this.ChangeTab(1)}>参考答案</a>
<a className="fr color-blue font-16 pointer" onClick={()=>this.sendTopics()}>发送</a>
<Link className="fr color-blue font-16 pointer" to={`/banks/group/${this.props.match.params.workid}/edit`} >编辑</Link>
<a className="fr color-blue font-16 pointer" onClick={()=>this.deletecheckBoxValues()}>删除</a>
</div>
</div>
</div>
<Spin size="large" spinning={this.state.isSpin} id={"cdiv"}>
{parseInt(tab) === 0 ? <Groupjobbandetails {...this.props} {...this.state} datas={datas}/>:""}
{parseInt(tab) === 1 ? <Groupjobquesanswer {...this.props} {...this.state} datas={datas}/>:""}
</Spin>
</div>
</div>
</Switch>
</React.Fragment>
)
}
}
export default GroupjobbankPage;

@ -1,4 +1,3 @@
import React, {Component} from "react";
import {BrowserRouter as Router,Route,Switch,Link, NavLin} from 'react-router-dom';
import {WordsBtn, ActionBtn,getImageUrl} from 'educoder';

@ -489,7 +489,7 @@ class InfosTopics extends Component{
<a title={item.name.length>55?item.name:""} className="ml10 fl mt3 font-16 color-dark maxwidth900" href={
category==="normal"?`/banks/normal/${item.id}/${types}/details`:
category==="group"?`/banks/group/${item.id}/${types}/tab=0`:
category==="group"?`/banks/group/${item.id}/${types}/details`:
category==="poll"?`/banks/poll/${item.id}/${types}`:
category==="exercise"?`/banks/exercise/${item.id}/${types}`:
category==="gtask"?`/banks/gtask/${item.id}/${types}`:

Loading…
Cancel
Save