From d9badc2d958f7dea9ad39df7b0989d68a73ca57c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 12 Sep 2019 01:26:35 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=20=E5=AE=9E=E8=AE=AD=20?=
=?UTF-8?q?=E8=AF=95=E5=8D=B7=20=20=E9=80=89=E7=94=A8=E5=AE=9E=E8=AE=ADove?=
=?UTF-8?q?r?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/coursesPublic/NewShixunModel.js | 167 ++++++-
.../courses/coursesPublic/Newshixunmodel.css | 10 +
.../coursesPublic/ShixunChooseModal.js | 240 +++++-----
.../courses/shixunHomework/shixunHomework.js | 35 +-
.../paths/PathDetail/DetailCardsEditAndAdd.js | 408 +++++++++--------
.../PathDetail/DetailCardsEditAndEdit.js | 417 +++++++++---------
6 files changed, 728 insertions(+), 549 deletions(-)
diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
index 3c64cbab1..393d714b3 100644
--- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
+++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
@@ -1,6 +1,7 @@
import React,{Component} from 'react';
-import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon,Drawer,Dropdown,Menu,Breadcrumb,Pagination,Button} from "antd";
+import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon,Drawer,Dropdown,Menu,Breadcrumb,Pagination,Button,notification} from "antd";
import axios from'axios';
+import NoneData from "../coursesPublic/NoneData";
import './Newshixunmodel.css';
const Search = Input.Search;
class NewShixunModel extends Component{
@@ -10,6 +11,7 @@ class NewShixunModel extends Component{
shixun_list:undefined,
shixuns_count:undefined,
Grouplist:[],
+ allGrouplist:[{page:1,list:[]}],
page:1,
type:'all',
status:'all',
@@ -20,11 +22,18 @@ class NewShixunModel extends Component{
}
}
componentDidMount() {
- let{page,type,status,search,order,diff,limit}=this.state;
+ let{page,type,search,order,diff,limit}=this.state;
+ let status=this.props.statustype===undefined?'all':'published';
+ this.setState({
+ status:status
+ })
this.getdatalist(page,type,status,search,order,diff,limit)
}
getdatalist=(page,type,status,search,order,diff,limit)=>{
+ this.setState({
+ isspinning:true
+ })
let url="/shixuns/shixun_list.json"
axios.get(url,{params:{
page,
@@ -39,9 +48,13 @@ class NewShixunModel extends Component{
this.setState({
shixun_list:response.data.shixun_list,
shixuns_count:response.data.shixuns_count,
+ isspinning:false
})
}
-
+ }).catch((error) => {
+ this.setState({
+ isspinning:false
+ })
})
}
@@ -66,17 +79,54 @@ class NewShixunModel extends Component{
}
getGrouplist=(Grouplist)=>{
+ let {page,allGrouplist}=this.state;
+ let newallGrouplist=allGrouplist;
+ var a=newallGrouplist.find((value,index,arr)=>{
+ return value.page==page
+ });
+
+ if(a!=undefined){
+ newallGrouplist.map((item,key)=>{
+ if(item.page===page){
+ item.list=Grouplist
+ }
+ })
+ }
+
+
+ let newGrouplist=[];
+
+ newallGrouplist.map((item,key)=>{
+ item.list.map((items,ke)=>{
+ newGrouplist.push(items)
+ })
+ })
+
+
this.setState({
- Grouplist: Grouplist,
+ Grouplist: newGrouplist,
+ allGrouplist:newallGrouplist
})
}
PaginationCourse=(pageNumber)=>{
- this.setState({
- page:pageNumber
- })
+ let {allGrouplist}=this.state;
+ let newallGrouplist=allGrouplist;
+ var v=newallGrouplist.find((value,index,arr)=>{
+ return value.page==pageNumber
+ });
+
+ if(v===undefined){
+ newallGrouplist.push({page:pageNumber,list:[]})
+ }
+
let{type,status,search,order,diff,limit}=this.state;
this.getdatalist(pageNumber,type,status,search,order,diff,limit)
+ this.setState({
+ page:pageNumber,
+ allGrouplist:newallGrouplist
+ })
+
}
belongto=(value)=>{
@@ -117,7 +167,16 @@ class NewShixunModel extends Component{
let{type,page,status,diff,order,limit}=this.state;
this.getdatalist(page,type,status,value,order,diff,limit)
}
-
+ showNotification = (description, message = "提示", icon) => {
+ const data = {
+ message,
+ description
+ }
+ if (icon) {
+ data.icon = icon;
+ }
+ notification.open(data);
+ }
savecouseShixunModal=()=>{
this.setState({
@@ -129,11 +188,32 @@ class NewShixunModel extends Component{
this.setState({
hometypepvisible:false
})
- this.props.showNotification("请先选择实训")
+ this.showNotification("请先选择实训")
return
}
+ if (this.props.chooseShixun) {
+ if(Grouplist.length>1){
+ this.setState({
+ hometypepvisible:false
+ })
+ this.showNotification("试卷选择的实训数不能大于1")
+ return
+ }
+ this.props.chooseShixun(Grouplist)
+ this.setState({
+ hometypepvisible:false
+ })
+ return;
+ }
+ if (this.props.pathShixun) {
+ this.setState({
+ hometypepvisible:false
+ })
+ this.props.pathShixun(Grouplist)
+ return;
+ }
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
axios.post(url, {
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
@@ -145,7 +225,7 @@ class NewShixunModel extends Component{
}else{
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
- this.props.showNotification("选择成功")
+ this.showNotification("操作成功")
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
this.props.hideNewShixunModelType()
@@ -157,14 +237,48 @@ class NewShixunModel extends Component{
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
}).catch((error) => {
console.log(error)
+ this.setState({
+ hometypepvisible:false
+ })
+ })
+ }
+
+ poststatus=(status)=>{
+ this.setState({
+ status:status
})
+ let{page,type,search,order,diff,limit}=this.state;
+ this.getdatalist(page,type,status,search,order,diff,limit)
}
render() {
- let {diff,Grouplist,shixun_list,shixuns_count,page,type,order}=this.state;
+ let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order}=this.state;
// let {visible,patheditarry}=this.props;
+ // console.log(Grouplist)
+ // console.log(allGrouplist)
+ const statusmenus=(
+
+ );
const menus = (