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

dev_hss
hjm 5 years ago
commit 1f09f016df

@ -284,6 +284,14 @@ const Completetaskpage =Loadable({
loader: () => import('../../modules/courses/completetaskdetails/Completetaskpage'),
loading: Loading,
});
//排序
const Ordering=Loadable({
loader: () => import('../../modules/courses/ordering/Ordering'),
loading: Loading,
});
class CoursesIndex extends Component{
constructor(props) {
super(props)
@ -470,6 +478,13 @@ class CoursesIndex extends Component{
// console.log(commons)
return (
<Switch {...this.props}>
{/*排序*/}
<Route path="/courses/:coursesId/ordering/:ordering_type/:main_id"
render={
(props) => (<Ordering {...this.props} {...props} {...this.state} />)
}
></Route>
{/*毕设任务题库详情*/}
<Route path="/banks/gtopic_topics/:workid"
render={

@ -78,3 +78,4 @@ p span{
.sourceTag a.active{
color: #FFFFFF;background-color:#4CACFF;
}

@ -574,7 +574,7 @@ class CoursesNew extends Component {
{this.props.match.params.coursesId === undefined ?"翻转课堂":dataname}
</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn className="fl cdefault">{this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}</WordsBtn>
<span className="fl cdefault">{this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}</span>
</p>

@ -696,7 +696,7 @@ class Goldsubject extends Component {
<a className="btn colorgrey fl hovercolorblue " href={Whethertocreateanewclassroom===true?"/courses":this.props.current_user&&this.props.current_user.first_category_url}
>{Whethertocreateanewclassroom===true?"翻转课堂":name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn className="fl cdefault">{Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}</WordsBtn>
<span className="fl cdefault">{Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}</span>
</p>
<div style={{width: '100%', height: '50px'}}>

@ -0,0 +1,109 @@
.color4CACFF{
color: #4CACFF !important;
}
.orderingbox{
width:1200px;
height:80px;
background:rgba(255,255,255,1);
box-shadow:3px 3px 3px rgba(237,237,237,1);
opacity:1;
border-radius:2px 2px 0px 0px;
padding: 24px;
box-sizing: border-box;
line-height: 34px;
}
.orderingbtnright{
width: 90px;
height: 38px;
background: rgba(255,255,255,1);
border: 1px solid rgba(228,228,228,1);
box-shadow: 0px 1px 1px rgba(0,0,0,0.16);
opacity: 1;
border-radius: 4px;
}
.orderingbtnleft{
width: 90px;
height: 38px;
background: rgba(76,172,255,1);
box-shadow: 0px 1px 1px rgba(0,0,0,0.16);
opacity: 1;
border-radius: 4px;
}
.pd1323s{
padding: 10px 6px 25px 40px;
cursor: pointer;
}
.orderSection{
height: 80px;
padding-top: 16px;
}
.ordermidbox{
width: 960px;
height: 120px;
background: rgba(255,255,255,1);
/* border: 1px solid rgba(205,205,205,1); */
opacity: 1;
margin-left:120px;
}
.orderfonttop{
font-size: 16px !important;
font-family: Microsoft YaHei;
font-weight: bold;
line-height: 28px;
color: rgba(5,16,26,1);
opacity: 1;
}
.orderfontbom{
font-size:14px;
font-family:Microsoft YaHei;
font-weight:400;
line-height:25px;
color:rgba(153,153,153,1);
opacity:1;
}
.ordermidbox:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
}
.mb200{
margin-bottom: 200px;
}
.maxwidth865s{
max-width: 865px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.maxwidth795 {
max-width:795px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
}
.ordermidbox:active{
background:rgba(248,247,255,1);
border:1px solid rgba(76,172,255,1);
}
.ordermidbox:focus{
background:rgba(248,247,255,1);
border:1px solid rgba(76,172,255,1);
}
.ordermiddiv{
min-height: 500px;
}

@ -0,0 +1,297 @@
import React,{ Component } from "react";
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Breadcrumb,Button } from "antd";
import { WordsBtn,on, off, trigger } from 'educoder';
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import axios from'axios';
import Modals from '../../modals/Modals';
import '../css/members.css';
import '../css/busyWork.css';
import './Ordering.css';
import NoneData from "../coursesPublic/NoneData";
const reorder = (list, startIndex, endIndex) => {
const result = Array.from(list);
const [removed] = result.splice(startIndex, 1);
result.splice(endIndex, 0, removed);
return result;
};
class Ordering extends Component{
constructor(props){
super(props);
this.state={
isSpin:false,
antIcon:false,
datas:undefined,
windowsscrollTop:false,
newtask_ids:[]
}
}
componentDidMount() {
this.setState({
isSpin:true
})
let coursesId=this.props.match.params.coursesId;
let ordering_type=this.props.match.params.ordering_type;
let url=`/courses/${coursesId}/tasks_list.json`;
axios.get((url),{params:{
container_type:ordering_type
}}).then((result)=>{
if(result){
this.setState({
datas:result.data.tasks,
isSpin:false
})
}
}).catch((error)=>{
console.log(error);
this.setState({
isSpin:false
})
})
window.addEventListener('scroll', this.handleScroll.bind(this)) //监听滚动
// window.addEventListener('resize', this.handleResize.bind(this)) //监听窗口大小改变
}
// componentWillUnmount() { //一定要最后移除监听器以防多个组件之间导致this的指向紊乱
// window.removeEventListener('scroll', this.handleScroll.bind(this))
// window.removeEventListener('resize', this.handleResize.bind(this))
// }
handleScroll=(e)=>{
// console.log(
// '浏览器滚动事件',
// e.srcElement.scrollingElement.scrollTop,
// e.srcElement.scrollingElement.scrollHeight
// )
//e.srcElement.scrollingElement.scrollTop为距离滚动条顶部高度
// e.srcElement.scrollingElement.scrollHeight为整个文档高度
if(e.srcElement.scrollingElement.scrollTop>60){
this.setState({
windowsscrollTop:true,
})
}
if(e.srcElement.scrollingElement.scrollTop===0){
this.setState({
windowsscrollTop:false
})
}
}
//
// handleResize = e => {
// console.log('浏览器窗口大小改变事件', e.target.innerWidth)
// }
onDragEnd=(result)=>{
if(result.destination!=null&&result.destination!=undefined){
let {datas}=this.state;
if (!result.destination) {
console.log('dropped outside the list')
return;
}
if (result.destination.index === result.source.index) {
console.log('the same')
return;
}
const shixuns_list = reorder(
datas,
result.source.index,
result.destination.index
);
let newtask_ids=[]
shixuns_list.map((item,key)=>{
newtask_ids.push(item.task_id)
})
this.setState({
datas:shixuns_list,
newtask_ids:newtask_ids
})
}
}
updatalist=()=>{
let {datas,newtask_ids,isSpin}=this.state;
if(newtask_ids.length===0){
this.props.showNotification("请先移动需要排序的实训作业任务");
return
}
if(isSpin===true){
return
}
this.setState({
isSpin:true
})
let coursesId=this.props.match.params.coursesId;
let ordering_type=this.props.match.params.ordering_type;
let url=`/courses/${coursesId}/update_task_position.json`;
axios.post(url,{
container_type:ordering_type,
task_ids:newtask_ids
}).then((result)=>{
if(result.data.status===0){
this.props.showNotification(result.data.message);
this.setState({
isSpin:false,
datas:datas,
newtask_ids:[]
});
this.goback()
}else{
this.setState({
isSpin:false,
});
}
}).catch((error)=>{
this.setState({
isSpin:false,
});
})
}
goback=()=>{
window.location.href=`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.props.match.params.main_id}`
}
render(){
let {
datas,
Modalstype,
windowsscrollTop,
}=this.state;
let main_id=this.props.match.params.main_id;
let category_id=this.props.match.params.category_id;
console.log(this.props)
console.log(window)
let positiontype=null;
if(windowsscrollTop===true){
positiontype={position:'fixed',zIndex:'1000',top: '0px'}
}else{
positiontype={}
}
return(
<div className={"mb200"}>
{/*提示*/}
{Modalstype&&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}
antIcon={this.state.antIcon}
/>:""}
<div className="educontent clearfix">
{windowsscrollTop===false?<div className={"mt20 mb20"}>
<Breadcrumb separator=">">
<Breadcrumb.Item href={this.props.current_user&&this.props.current_user.first_category_url}>{this.props.current_user&&this.props.current_user.course_name}</Breadcrumb.Item>
<Breadcrumb.Item href={`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.props.match.params.main_id}`}>实训作业</Breadcrumb.Item>
<Breadcrumb.Item>调整排序</Breadcrumb.Item>
</Breadcrumb>
</div>:""}
<p className="clearfix bor-bottom-greyE edu-back-white orderingbox"
style={positiontype}
>
<span>温馨提示请在列表中长按鼠标左键进行拖放排序完成排序后请点击保存</span>
<Button className="fr orderingbtnleft" type="primary" onClick={()=>this.updatalist()}>保存</Button>
<Button className="fr mr30 orderingbtnright" onClick={()=>this.goback()}>取消</Button>
</p>
</div>
<Spin size="large" spinning={this.state.isSpin} >
<DragDropContext onDragEnd={this.onDragEnd} >
<Droppable droppableId={this.props.match.params.ordering_type}>
{(provided, snapshot) => (
<div
ref={provided.innerRef}
{...provided.droppableProps}
className={"educontent mb50 mt40 droppableul ordermiddiv"}
onScroll={this.contentViewScrolledit}
>
{datas===undefined?"":
datas.map((item, index) => {
return (
<Draggable
key={item.task_id}
draggableId={item.task_id}
index={index}
className={"TabsWarps"}
>
{(provided, snapshot) => (
<div className={"mt30 edu-back-white pd1323s relativef ordermidbox"}
key={index}
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
>
<div className={"clearfix"}>
<div className={"item-body"}>
<div className={"clearfix ds pr orderSection"}>
<p title={item.task_name} className="font-16 color-dark maxwidth865s orderfonttop"
href={`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${item.task_id}/list?tab=0`}>{item.task_name}</p>
<p className={"color-grey panel-lightgrey mt16 "}>
<span className="topicswidth400">
<span className="topsics100 color-grey9 orderfontbom mr20 maxwidth795">{item.user_name}</span>
<span className="mr50 color-grey9 orderfontbom maxwidth795">{item.category}</span>
</span>
</p>
</div>
</div>
</div>
</div>
)}
</Draggable>
)
})
}
</div>
)}
</Droppable>
</DragDropContext>
{
datas===undefined?"":datas.length===0? <NoneData></NoneData>:""
}
</Spin>
</div>
)
}
}
export default Ordering;

@ -831,20 +831,7 @@ class PollNew extends Component {
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = (indexo, object,bool) => {
var thiss = this;
if(bool === true){
this.setState({
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
var poll_questionslength = this.state.poll_questions.length;
// console.log("deleteadddomtwo|||||||||||||||||||||||||||||||||||||||||\\");
@ -988,7 +975,6 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -999,11 +985,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1015,82 +1001,69 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于选项数")
// this.props.showNotification(`选择题的最大可选项不能大于选项数`);
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification(`选择题的最大可选项不能小于2项目`);
//
// return;
//
// }
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1222,7 +1195,6 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1233,11 +1205,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1249,11 +1221,11 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1266,69 +1238,56 @@ class PollNew extends Component {
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于答案数")
// this.props.showNotification('选择题的最大可选项不能大于选项数!');
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification('选择题的最大可选项不能小于2项目');
//
// return;
//
// }
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1393,6 +1352,20 @@ class PollNew extends Component {
this.state.mymainsint = this.state.mymainsint + 1;
}
if(bool === true){
this.setState({
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
this.setState({
// poll_questions: newarrpoll,
adddom: newarr,
@ -1411,11 +1384,6 @@ class PollNew extends Component {
// indexo 第几个数组
//object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => {
if(bool === true) {
this.setState({
bindingid:undefined,
})
}
this.setState({
Newdisplay:false,
newoption: false,
@ -1556,11 +1524,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1572,11 +1540,11 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1590,56 +1558,56 @@ class PollNew extends Component {
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
newarrpoll.splice(thiss.state.Insertposition, 0, question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1758,7 +1726,6 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1768,11 +1735,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1784,66 +1751,66 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
} else if (object.question.question_type === 3) {
//插入主观题
@ -1915,6 +1882,11 @@ class PollNew extends Component {
q_countst: 0,
})
}
if(bool === true) {
this.setState({
bindingid:undefined,
})
}
this.Deleteadddom(indexo);
// console.log(indexo)
}
@ -2096,6 +2068,7 @@ class PollNew extends Component {
thiss.thisinitializationdatanew();
}
})
}
//上下移到服务器中
@ -2892,7 +2865,7 @@ class PollNew extends Component {
console.log(this.state.poll_questions);
console.log(this.state.adddom);
let resultDom;
resultDom = <div>
resultDom = <div >
<p className="clearfix font-16">
<span className="color-grey-6 fl">{index + 1}</span>
<span
@ -2988,7 +2961,7 @@ class PollNew extends Component {
resultDomtwo =
<div >
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms3"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3056,7 +3029,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3091,7 +3064,7 @@ class PollNew extends Component {
<div style={{minWidth: "1100px"}}>
<div>
<span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
className="color-grey-6 mr20 ml10 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 ">
{/*可选最小1*/}
<style>
@ -3150,11 +3123,11 @@ class PollNew extends Component {
}
</div>
<div>
<div >
{itemo.question.question_type === 2 ?
(
this.state.polls_status === undefined || this.state.polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
@ -3230,7 +3203,7 @@ class PollNew extends Component {
resultDomtwo =
<div >
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms2"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3298,7 +3271,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3396,7 +3369,7 @@ class PollNew extends Component {
{itemo.question.question_type === 2 ?
(
this.state.polls_status === undefined || this.state.polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
@ -3481,7 +3454,7 @@ class PollNew extends Component {
resultDomtwo =
<div className="problemShow">
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3549,7 +3522,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{polls_status === undefined || polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3647,7 +3620,7 @@ class PollNew extends Component {
{itemo.question.question_type === 2 ?
(
polls_status === undefined || polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin } from "antd";
import { WordsBtn,on, off, trigger } from 'educoder';
import CourseLayoutcomponent from '../common/CourseLayoutComponent';
import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom';
import axios from'axios';
import HomeworkModal from "../coursesPublic/HomeworkModal";
import ShixunModal from "../coursesPublic/ShixunModal";
@ -936,6 +936,7 @@ class ShixunHomework extends Component{
let main_id=this.props.match.params.main_id;
let category_id=this.props.match.params.category_id;
return(
<React.Fragment >
<div>
@ -1036,6 +1037,13 @@ class ShixunHomework extends Component{
{/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/}
<span className="font-18 fl color-dark-21">实训作业</span>
<li className="fr">
{datas===undefined?"":datas.homeworks && datas.homeworks.length>1?this.props.isClassManagement()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>
<WordsBtn style="blue" className={"mr30 font-16"}>
<Link className="color4CACFF" to={`/courses/${this.props.match.params.coursesId}/ordering/shixun_homework/${main_id&&main_id}`}>调整排序</Link>
</WordsBtn>
</span>:"":"":""}
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>
<WordsBtn style="blue" onClick={()=>this.addDir()} className={"mr30 font-16"}>添加目录</WordsBtn>

Loading…
Cancel
Save