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

dev_hss
杨树明 5 years ago
commit 8d208d4c56

@ -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={

@ -1,80 +1,81 @@
.polllisthover:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
.workList_Item{
/* padding:20px 30px; */
display: flex;
background-color: #fff;
margin-bottom: 20px;
padding-top: 10px;
}
p span{
cursor: default;
}
.mt-5{ margin-top:-5px;}
/* <20><><EFBFBD>ѡ<EFBFBD><D1A1>tab */
.bankNav li{
float: left;
margin-right: 20px;
}
.bankNav li:last-child{
margin-right: 0px;
}
.bankNav li.active a{
color: #fff!important;
background-color: #4CACFF;
}
.bankNav li a{
display: block;
padding:0px 10px;
height: 28px;
line-height: 28px;
background-color: #F5F5F5;
border-radius: 36px;
color: #666666!important;
}
.task_menu_ul{
width: 600px;
}
.task_menu_ul .ant-menu-item,.task_menu_ul .ant-menu-submenu-title{
padding:0px;
margin-right: 30px;
line-height: 68px;
font-size: 16px;
}
.ant-menu{
color: #05101a;
}
.task_menu_ul .ant-menu-horizontal{
border-bottom: none;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item:hover{
border-bottom:2px solid transparent;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item-selected{
border-bottom: 2px solid #4CACFF !important;
}
.sourceTag a{
display: block;
float: left;
background-color:#E5F3FF;
padding: 0px 10px;
height: 24px;
line-height: 24px;
color: #4E7A9B;
margin:5px 0px 5px 10px;
}
.sourceTag a.active{
color: #FFFFFF;background-color:#4CACFF;
}
.polllisthover:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
.workList_Item{
/* padding:20px 30px; */
display: flex;
background-color: #fff;
margin-bottom: 20px;
padding-top: 10px;
}
p span{
cursor: default;
}
.mt-5{ margin-top:-5px;}
/* <20><><EFBFBD>ѡ<EFBFBD><D1A1>tab */
.bankNav li{
float: left;
margin-right: 20px;
}
.bankNav li:last-child{
margin-right: 0px;
}
.bankNav li.active a{
color: #fff!important;
background-color: #4CACFF;
}
.bankNav li a{
display: block;
padding:0px 10px;
height: 28px;
line-height: 28px;
background-color: #F5F5F5;
border-radius: 36px;
color: #666666!important;
}
.task_menu_ul{
width: 600px;
}
.task_menu_ul .ant-menu-item,.task_menu_ul .ant-menu-submenu-title{
padding:0px;
margin-right: 30px;
line-height: 68px;
font-size: 16px;
}
.ant-menu{
color: #05101a;
}
.task_menu_ul .ant-menu-horizontal{
border-bottom: none;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item:hover{
border-bottom:2px solid transparent;
}
.task_menu_ul .ant-menu-horizontal > .ant-menu-item-selected{
border-bottom: 2px solid #4CACFF !important;
}
.sourceTag a{
display: block;
float: left;
background-color:#E5F3FF;
padding: 0px 10px;
height: 24px;
line-height: 24px;
color: #4E7A9B;
margin:5px 0px 5px 10px;
}
.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;

@ -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