Merge branch 'master' of https://bdgit.educoder.net/Hjqreturn/educoder
commit
9511600e03
@ -1,239 +1,239 @@
|
||||
import React,{ Component } from "react";
|
||||
import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd";
|
||||
import axios from 'axios';
|
||||
import Modals from '../../modals/Modals';
|
||||
const RadioGroup = Radio.Group;
|
||||
const Search = Input.Search;
|
||||
|
||||
class Associationmodel extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
group_ids:[],
|
||||
fileList:[],
|
||||
Modalstype:false,
|
||||
Modalstopval:"",
|
||||
ModalCancel:"",
|
||||
ModalSave:"",
|
||||
loadtype:false,
|
||||
search:undefined,
|
||||
page:1,
|
||||
limit:"",
|
||||
projects:undefined,
|
||||
projectvalue:undefined,
|
||||
projectvaluetype:false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
this.searchValue();
|
||||
}
|
||||
|
||||
searchValue=()=>{
|
||||
let {search}=this.state;
|
||||
let url="/users/search_user_projects.json";
|
||||
axios.get(url, {
|
||||
params: {
|
||||
search: search
|
||||
}
|
||||
}).then((result)=>{
|
||||
console.log(result)
|
||||
if(result.status===200){
|
||||
this.setState({
|
||||
projects:result.data.projects
|
||||
})
|
||||
}
|
||||
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
inputSearchValue=(e)=>{
|
||||
this.setState({
|
||||
search:e.target.value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
goback=()=>{
|
||||
this.props.funlist()
|
||||
this.props.Cancel()
|
||||
console.log(this.props)
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
setSaves=()=>{
|
||||
let {projectvalue}=this.state;
|
||||
let taskid=this.props.taskid;
|
||||
let url="/graduation_tasks/"+taskid+"/graduation_works/relate_project.json";
|
||||
|
||||
axios.post(url, {
|
||||
project_id: projectvalue
|
||||
}).then((result)=>{
|
||||
|
||||
if(result.status===200){
|
||||
if(result.data.status===0){
|
||||
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:result.data.message,
|
||||
ModalSave:this.goback,
|
||||
loadtype:true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
Saves=()=>{
|
||||
let {projectvalue}=this.state;
|
||||
if(projectvalue===undefined||projectvalue===""){
|
||||
this.setState({
|
||||
projectvaluetype:true,
|
||||
})
|
||||
}else{
|
||||
this.setState({
|
||||
projectvaluetype:false,
|
||||
})
|
||||
}
|
||||
let taskid=this.props.taskid;
|
||||
console.log(this.props)
|
||||
let url="/graduation_tasks/"+taskid+"/graduation_works/check_project.json";
|
||||
axios.get(url, {
|
||||
params: {
|
||||
project_id: projectvalue
|
||||
}
|
||||
}).then((result)=>{
|
||||
|
||||
if(result.status===200){
|
||||
|
||||
if(result.data.is_relate===false){
|
||||
|
||||
this.setSaves()
|
||||
|
||||
}else{
|
||||
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:"该项目已被"+result.data.relate_user+"关联",
|
||||
ModalSave:this.ModalSave,
|
||||
loadtype:true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
onChange = (e) => {
|
||||
|
||||
this.setState({
|
||||
projectvalue: e.target.value,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ModalSave=()=>{
|
||||
this.setState({
|
||||
Modalstype:false
|
||||
})
|
||||
}
|
||||
|
||||
render(){
|
||||
let {
|
||||
Modalstype,
|
||||
Modalstopval,
|
||||
ModalCancel,
|
||||
ModalSave,
|
||||
loadtype,
|
||||
search,
|
||||
projects,
|
||||
projectvalue,
|
||||
projectvaluetype
|
||||
}=this.state;
|
||||
|
||||
|
||||
|
||||
return(
|
||||
<div>
|
||||
{/*提示*/}
|
||||
<Modals
|
||||
modalsType={Modalstype}
|
||||
modalsTopval={Modalstopval}
|
||||
modalCancel={ModalCancel}
|
||||
modalSave={ModalSave}
|
||||
loadtype= {loadtype}
|
||||
|
||||
/>
|
||||
<Modal
|
||||
className={"HomeworkModal"}
|
||||
title={this.props.modalname}
|
||||
// visible={this.props.visible}
|
||||
visible={this.props.visible}
|
||||
closable={false}
|
||||
footer={null}
|
||||
keyboard={false}
|
||||
destroyOnClose={true}
|
||||
>
|
||||
<div className="task-popup-content">
|
||||
<p className="task-popup-text-center font-16">
|
||||
|
||||
<Search
|
||||
placeholder="请输入项目名称进行搜索"
|
||||
id="subject_search_input"
|
||||
value={search}
|
||||
onInput={this.inputSearchValue}
|
||||
onSearch={this.searchValue}
|
||||
autoComplete="off"
|
||||
></Search>
|
||||
|
||||
</p>
|
||||
|
||||
<div className={"Association mb20"}>
|
||||
|
||||
<RadioGroup onChange={this.onChange} value={projectvalue}>
|
||||
|
||||
{projects&&projects.map((item,key)=>{
|
||||
return(
|
||||
<div key={key} style={{
|
||||
width: '375px',
|
||||
height: '30px'
|
||||
}}>
|
||||
<Radio value={item.project_id} className="fl "></Radio>
|
||||
<div className={"fl ml5"}>{item.project_name}</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
</div>
|
||||
|
||||
{projectvaluetype===true?<span className={"color-red ml20 "}>请先选择项目</span>:""}
|
||||
|
||||
<div className="clearfix mt30 edu-txt-center mb10">
|
||||
<a className="task-btn color-white mr80" onClick={this.props.Cancel}>取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={this.Saves}>确认</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
import React,{ Component } from "react";
|
||||
import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd";
|
||||
import axios from 'axios';
|
||||
import Modals from '../../modals/Modals';
|
||||
const RadioGroup = Radio.Group;
|
||||
const Search = Input.Search;
|
||||
|
||||
class Associationmodel extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
group_ids:[],
|
||||
fileList:[],
|
||||
Modalstype:false,
|
||||
Modalstopval:"",
|
||||
ModalCancel:"",
|
||||
ModalSave:"",
|
||||
loadtype:false,
|
||||
search:undefined,
|
||||
page:1,
|
||||
limit:"",
|
||||
projects:undefined,
|
||||
projectvalue:undefined,
|
||||
projectvaluetype:false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
this.searchValue();
|
||||
}
|
||||
|
||||
searchValue=()=>{
|
||||
let {search}=this.state;
|
||||
let url="/users/search_user_projects.json";
|
||||
axios.get(url, {
|
||||
params: {
|
||||
search: search
|
||||
}
|
||||
}).then((result)=>{
|
||||
console.log(result)
|
||||
if(result.status===200){
|
||||
this.setState({
|
||||
projects:result.data.projects
|
||||
})
|
||||
}
|
||||
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
inputSearchValue=(e)=>{
|
||||
this.setState({
|
||||
search:e.target.value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
goback=()=>{
|
||||
this.props.funlist()
|
||||
this.props.Cancel()
|
||||
console.log(this.props)
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
setSaves=()=>{
|
||||
let {projectvalue}=this.state;
|
||||
let taskid=this.props.taskid;
|
||||
let url="/graduation_tasks/"+taskid+"/graduation_works/relate_project.json";
|
||||
|
||||
axios.post(url, {
|
||||
project_id: projectvalue
|
||||
}).then((result)=>{
|
||||
|
||||
if(result.status===200){
|
||||
if(result.data.status===0){
|
||||
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:result.data.message,
|
||||
ModalSave:this.goback,
|
||||
loadtype:true
|
||||
})
|
||||
this.props.funlist()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
Saves=()=>{
|
||||
let {projectvalue}=this.state;
|
||||
if(projectvalue===undefined||projectvalue===""){
|
||||
this.setState({
|
||||
projectvaluetype:true,
|
||||
})
|
||||
}else{
|
||||
this.setState({
|
||||
projectvaluetype:false,
|
||||
})
|
||||
}
|
||||
let taskid=this.props.taskid;
|
||||
console.log(this.props)
|
||||
let url="/graduation_tasks/"+taskid+"/graduation_works/check_project.json";
|
||||
axios.get(url, {
|
||||
params: {
|
||||
project_id: projectvalue
|
||||
}
|
||||
}).then((result)=>{
|
||||
|
||||
if(result.status===200){
|
||||
|
||||
if(result.data.is_relate===false){
|
||||
|
||||
this.setSaves()
|
||||
|
||||
}else{
|
||||
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:"该项目已被"+result.data.relate_user+"关联",
|
||||
ModalSave:this.ModalSave,
|
||||
loadtype:true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
onChange = (e) => {
|
||||
|
||||
this.setState({
|
||||
projectvalue: e.target.value,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ModalSave=()=>{
|
||||
this.setState({
|
||||
Modalstype:false
|
||||
})
|
||||
}
|
||||
|
||||
render(){
|
||||
let {
|
||||
Modalstype,
|
||||
Modalstopval,
|
||||
ModalCancel,
|
||||
ModalSave,
|
||||
loadtype,
|
||||
search,
|
||||
projects,
|
||||
projectvalue,
|
||||
projectvaluetype
|
||||
}=this.state;
|
||||
|
||||
|
||||
|
||||
return(
|
||||
<div>
|
||||
{/*提示*/}
|
||||
<Modals
|
||||
modalsType={Modalstype}
|
||||
modalsTopval={Modalstopval}
|
||||
modalCancel={ModalCancel}
|
||||
modalSave={ModalSave}
|
||||
loadtype= {loadtype}
|
||||
|
||||
/>
|
||||
<Modal
|
||||
className={"HomeworkModal"}
|
||||
title={this.props.modalname}
|
||||
// visible={this.props.visible}
|
||||
visible={this.props.visible}
|
||||
closable={false}
|
||||
footer={null}
|
||||
keyboard={false}
|
||||
destroyOnClose={true}
|
||||
>
|
||||
<div className="task-popup-content">
|
||||
<p className="task-popup-text-center font-16">
|
||||
|
||||
<Search
|
||||
placeholder="请输入项目名称进行搜索"
|
||||
id="subject_search_input"
|
||||
value={search}
|
||||
onInput={this.inputSearchValue}
|
||||
onSearch={this.searchValue}
|
||||
autoComplete="off"
|
||||
></Search>
|
||||
|
||||
</p>
|
||||
|
||||
<div className={"Association mb20"}>
|
||||
|
||||
<RadioGroup onChange={this.onChange} value={projectvalue}>
|
||||
|
||||
{projects&&projects.map((item,key)=>{
|
||||
return(
|
||||
<div key={key} style={{
|
||||
width: '375px',
|
||||
height: '30px'
|
||||
}}>
|
||||
<Radio value={item.project_id} className="fl "></Radio>
|
||||
<div className={"fl ml5"}>{item.project_name}</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
</div>
|
||||
|
||||
{projectvaluetype===true?<span className={"color-red ml20 "}>请先选择项目</span>:""}
|
||||
|
||||
<div className="clearfix mt30 edu-txt-center mb10">
|
||||
<a className="task-btn color-white mr80" onClick={this.props.Cancel}>取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={this.Saves}>确认</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default Associationmodel;
|
File diff suppressed because it is too large
Load Diff
@ -1,282 +1,282 @@
|
||||
import React,{ Component } from "react";
|
||||
|
||||
|
||||
import Modals from '../../../modals/Modals'
|
||||
import { WordsBtn } from 'educoder'
|
||||
import HomeworkModal from "../../coursesPublic/HomeworkModal";
|
||||
|
||||
import axios from 'axios'
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
|
||||
|
||||
class Immediatelypublish extends Component{
|
||||
constructor(props){
|
||||
super(props)
|
||||
this.state={
|
||||
modalname:undefined,
|
||||
modaltype:undefined,
|
||||
visible:false,
|
||||
Topval:undefined,
|
||||
Topvalright:undefined,
|
||||
Botvalleft:undefined,
|
||||
Botval:undefined,
|
||||
starttime:undefined,
|
||||
starttimes:undefined,
|
||||
endtime:undefined,
|
||||
Cancelname:undefined,
|
||||
Savesname:undefined,
|
||||
Cancel:undefined,
|
||||
Saves:undefined,
|
||||
course_groups:undefined,
|
||||
|
||||
modalsType:false,
|
||||
modalsTopval:"",
|
||||
loadtype:false,
|
||||
chooseId:undefined
|
||||
}
|
||||
}
|
||||
//立即发布
|
||||
homeworkstart=()=>{
|
||||
let {checkBoxValues}=this.props
|
||||
|
||||
|
||||
// console.log(this.props.Exercisetype==="exercise")
|
||||
|
||||
|
||||
if(checkBoxValues.length==0){
|
||||
this.props.showNotification("请先在列表中选择数据");
|
||||
// this.setState({
|
||||
// modalsType:true,
|
||||
// modalsTopval:"请先在列表中选择数据",
|
||||
// loadtype:true
|
||||
// })
|
||||
}else{
|
||||
let coursesId=this.props.match.params.coursesId;
|
||||
if(this.props.Exercisetype==="exercise"){
|
||||
let url=`/courses/${coursesId}/exercises/publish_modal.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
check_ids:checkBoxValues
|
||||
}
|
||||
}).then((response) => {
|
||||
if(response.status===200){
|
||||
let list=[];
|
||||
if(response.data.course_info){
|
||||
for(var i=0;i<response.data.course_info.length;i++){
|
||||
list.push({
|
||||
id:response.data.course_info[i].course_group_id,
|
||||
name:response.data.course_info[i].course_group_name,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
course_groups:list,
|
||||
})
|
||||
this.setState({
|
||||
modalname:"立即发布",
|
||||
modaltype:response.data.un_publish > 0 ? 1 : 2,
|
||||
visible:true,
|
||||
Topval:"本操作只对“未发布”的对象生效",
|
||||
Botvalleft:"暂不发布",
|
||||
Botval:"则通过后续手动设置,定时发布",
|
||||
starttime:"发布时间:"+this.props.getNowFormatDates(1),
|
||||
starttimes:this.props.getNowFormatDates(1),
|
||||
endtime:"截止时间:"+this.props.getNowFormatDates(2),
|
||||
Cancelname:"暂不发布",
|
||||
Savesname:"立即发布",
|
||||
Cancel:this.homeworkhide,
|
||||
Saves:this.homeworkstartend,
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
}else{
|
||||
let url=`/courses/${coursesId}/polls/publish_modal.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
check_ids:checkBoxValues
|
||||
}
|
||||
}).then((response) => {
|
||||
if(response){
|
||||
let list=[];
|
||||
if(response.data.course_info){
|
||||
for(var i=0;i<response.data.course_info.length;i++){
|
||||
list.push({
|
||||
id:response.data.course_info[i].course_group_id,
|
||||
name:response.data.course_info[i].course_group_name,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
course_groups:list,
|
||||
})
|
||||
this.setState({
|
||||
modalname:"立即发布",
|
||||
modaltype:response.data.un_publish > 0 ? 1 : 2,
|
||||
visible:true,
|
||||
Topval:"本操作只对“未发布”的对象生效",
|
||||
Botvalleft:"暂不发布",
|
||||
Botval:"则通过后续手动设置,定时发布",
|
||||
starttime:"发布时间:"+this.props.getNowFormatDates(1),
|
||||
starttimes:this.props.getNowFormatDates(1),
|
||||
endtime:"截止时间:"+this.props.getNowFormatDates(2),
|
||||
Cancelname:"暂不发布",
|
||||
Savesname:"立即发布",
|
||||
Cancel:this.homeworkhide,
|
||||
Saves:this.homeworkstartend,
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//取消提示弹框
|
||||
modalCancel=()=>{
|
||||
this.setState({
|
||||
modalsType:false,
|
||||
modalsTopval:"",
|
||||
loadtype:false
|
||||
})
|
||||
}
|
||||
//暂不发布
|
||||
homeworkhide=()=>{
|
||||
this.setState({
|
||||
modalname:undefined,
|
||||
modaltype:undefined,
|
||||
visible:false,
|
||||
Topval:undefined,
|
||||
Topvalright:undefined,
|
||||
Botvalleft:undefined,
|
||||
Botval:undefined,
|
||||
starttime:undefined,
|
||||
starttimes:undefined,
|
||||
endtime:undefined,
|
||||
Cancelname:undefined,
|
||||
Savesname:undefined,
|
||||
Cancel:undefined,
|
||||
Saves:undefined,
|
||||
StudentList_value:undefined,
|
||||
addname:undefined,
|
||||
addnametype:false,
|
||||
addnametab:undefined
|
||||
})
|
||||
}
|
||||
// 确定立即发布
|
||||
homeworkstartend=(ids,endtime)=>{
|
||||
|
||||
let {checkBoxValues}=this.props
|
||||
let {chooseId}=this.state;
|
||||
let coursesId=this.props.match.params.coursesId;
|
||||
|
||||
if(this.props.Exercisetype==="exercise"){
|
||||
|
||||
let url=`/courses/${coursesId}/exercises/publish.json`
|
||||
axios.post(url,{
|
||||
check_ids:checkBoxValues,
|
||||
group_ids:chooseId,
|
||||
end_time:endtime
|
||||
}).then((result)=>{
|
||||
if(result){
|
||||
this.props.showNotification(result.data.message);
|
||||
this.homeworkhide();
|
||||
|
||||
// 调用父级公共头部的接口刷新
|
||||
this.props.action()
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
|
||||
}else{
|
||||
let url=`/courses/${coursesId}/polls/publish.json`
|
||||
axios.post(url,{
|
||||
check_ids:checkBoxValues,
|
||||
group_ids:chooseId,
|
||||
end_time:endtime
|
||||
}).then((result)=>{
|
||||
if(result){
|
||||
this.props.showNotification(result.data.message);
|
||||
this.homeworkhide();
|
||||
|
||||
// 调用父级公共头部的接口刷新
|
||||
this.props.action()
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getcourse_groupslist=(id)=>{
|
||||
this.setState({
|
||||
chooseId:id
|
||||
})
|
||||
}
|
||||
|
||||
render(){
|
||||
let{
|
||||
modalname,
|
||||
modaltype,
|
||||
visible,
|
||||
Topval,
|
||||
Topvalright,
|
||||
Botvalleft,
|
||||
Botval,
|
||||
starttime,
|
||||
starttimes,
|
||||
endtime,
|
||||
Cancelname,
|
||||
Savesname,
|
||||
Cancel,
|
||||
Saves,
|
||||
course_groups,
|
||||
|
||||
modalsType,
|
||||
modalsTopval,
|
||||
loadtype,
|
||||
}=this.state
|
||||
return(
|
||||
<React.Fragment>
|
||||
<HomeworkModal
|
||||
modaltype={modaltype}
|
||||
modalname={modalname}
|
||||
visible={visible}
|
||||
Topval={Topval}
|
||||
Topvalright={Topvalright}
|
||||
Botvalleft={Botvalleft}
|
||||
Botval={Botval}
|
||||
starttime={starttime}
|
||||
starttimes={starttimes}
|
||||
endtime={endtime}
|
||||
Cancelname={Cancelname}
|
||||
Savesname={Savesname}
|
||||
Cancel={Cancel}
|
||||
Saves={Saves}
|
||||
course_groups={course_groups}
|
||||
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
|
||||
/>
|
||||
{/* 公用的提示弹框 */}
|
||||
<Modals
|
||||
modalsType={modalsType}
|
||||
modalsTopval={modalsTopval}
|
||||
modalsBottomval=""
|
||||
loadtype={loadtype}
|
||||
modalCancel={this.modalCancel}
|
||||
modalSave={this.modalCancel}
|
||||
></Modals>
|
||||
|
||||
<WordsBtn style={this.props.style} className={this.props.className} onClick={this.homeworkstart}>立即发布</WordsBtn>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
import React,{ Component } from "react";
|
||||
|
||||
|
||||
import Modals from '../../../modals/Modals'
|
||||
import { WordsBtn } from 'educoder'
|
||||
import HomeworkModal from "../../coursesPublic/HomeworkModal";
|
||||
|
||||
import axios from 'axios'
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
|
||||
|
||||
class Immediatelypublish extends Component{
|
||||
constructor(props){
|
||||
super(props)
|
||||
this.state={
|
||||
modalname:undefined,
|
||||
modaltype:undefined,
|
||||
visible:false,
|
||||
Topval:undefined,
|
||||
Topvalright:undefined,
|
||||
Botvalleft:undefined,
|
||||
Botval:undefined,
|
||||
starttime:undefined,
|
||||
starttimes:undefined,
|
||||
endtime:undefined,
|
||||
Cancelname:undefined,
|
||||
Savesname:undefined,
|
||||
Cancel:undefined,
|
||||
Saves:undefined,
|
||||
course_groups:undefined,
|
||||
|
||||
modalsType:false,
|
||||
modalsTopval:"",
|
||||
loadtype:false,
|
||||
chooseId:undefined
|
||||
}
|
||||
}
|
||||
//立即发布
|
||||
homeworkstart=()=>{
|
||||
let {checkBoxValues}=this.props
|
||||
|
||||
|
||||
// console.log(this.props.Exercisetype==="exercise")
|
||||
|
||||
|
||||
if(checkBoxValues.length==0){
|
||||
this.props.showNotification("请先在列表中选择数据");
|
||||
// this.setState({
|
||||
// modalsType:true,
|
||||
// modalsTopval:"请先在列表中选择数据",
|
||||
// loadtype:true
|
||||
// })
|
||||
}else{
|
||||
let coursesId=this.props.match.params.coursesId;
|
||||
if(this.props.Exercisetype==="exercise"){
|
||||
let url=`/courses/${coursesId}/exercises/publish_modal.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
check_ids:checkBoxValues
|
||||
}
|
||||
}).then((response) => {
|
||||
if(response.status===200){
|
||||
let list=[];
|
||||
if(response.data.course_info){
|
||||
for(var i=0;i<response.data.course_info.length;i++){
|
||||
list.push({
|
||||
id:response.data.course_info[i].course_group_id,
|
||||
name:response.data.course_info[i].course_group_name,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
course_groups:list,
|
||||
})
|
||||
this.setState({
|
||||
modalname:"立即发布",
|
||||
modaltype:response.data.un_publish > 0 ? 1 : 2,
|
||||
visible:true,
|
||||
Topval:"本操作只对“未发布”的对象生效",
|
||||
Botvalleft:"暂不发布",
|
||||
Botval:"则通过后续手动设置,定时发布",
|
||||
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
|
||||
starttimes:this.props.getNowFormatDates(1),
|
||||
endtime:"截止时间:"+this.props.getNowFormatDates(2),
|
||||
Cancelname:"暂不发布",
|
||||
Savesname:"立即发布",
|
||||
Cancel:this.homeworkhide,
|
||||
Saves:this.homeworkstartend,
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
}else{
|
||||
let url=`/courses/${coursesId}/polls/publish_modal.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
check_ids:checkBoxValues
|
||||
}
|
||||
}).then((response) => {
|
||||
if(response){
|
||||
let list=[];
|
||||
if(response.data.course_info){
|
||||
for(var i=0;i<response.data.course_info.length;i++){
|
||||
list.push({
|
||||
id:response.data.course_info[i].course_group_id,
|
||||
name:response.data.course_info[i].course_group_name,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
course_groups:list,
|
||||
})
|
||||
this.setState({
|
||||
modalname:"立即发布",
|
||||
modaltype:response.data.un_publish > 0 ? 1 : 2,
|
||||
visible:true,
|
||||
Topval:"本操作只对“未发布”的对象生效",
|
||||
Botvalleft:"暂不发布",
|
||||
Botval:"则通过后续手动设置,定时发布",
|
||||
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
|
||||
starttimes:this.props.getNowFormatDates(1),
|
||||
endtime:"截止时间:"+this.props.getNowFormatDates(2),
|
||||
Cancelname:"暂不发布",
|
||||
Savesname:"立即发布",
|
||||
Cancel:this.homeworkhide,
|
||||
Saves:this.homeworkstartend,
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//取消提示弹框
|
||||
modalCancel=()=>{
|
||||
this.setState({
|
||||
modalsType:false,
|
||||
modalsTopval:"",
|
||||
loadtype:false
|
||||
})
|
||||
}
|
||||
//暂不发布
|
||||
homeworkhide=()=>{
|
||||
this.setState({
|
||||
modalname:undefined,
|
||||
modaltype:undefined,
|
||||
visible:false,
|
||||
Topval:undefined,
|
||||
Topvalright:undefined,
|
||||
Botvalleft:undefined,
|
||||
Botval:undefined,
|
||||
starttime:undefined,
|
||||
starttimes:undefined,
|
||||
endtime:undefined,
|
||||
Cancelname:undefined,
|
||||
Savesname:undefined,
|
||||
Cancel:undefined,
|
||||
Saves:undefined,
|
||||
StudentList_value:undefined,
|
||||
addname:undefined,
|
||||
addnametype:false,
|
||||
addnametab:undefined
|
||||
})
|
||||
}
|
||||
// 确定立即发布
|
||||
homeworkstartend=(ids,endtime)=>{
|
||||
|
||||
let {checkBoxValues}=this.props
|
||||
let {chooseId}=this.state;
|
||||
let coursesId=this.props.match.params.coursesId;
|
||||
|
||||
if(this.props.Exercisetype==="exercise"){
|
||||
|
||||
let url=`/courses/${coursesId}/exercises/publish.json`
|
||||
axios.post(url,{
|
||||
check_ids:checkBoxValues,
|
||||
group_ids:chooseId,
|
||||
end_time:endtime
|
||||
}).then((result)=>{
|
||||
if(result){
|
||||
this.props.showNotification(result.data.message);
|
||||
this.homeworkhide();
|
||||
|
||||
// 调用父级公共头部的接口刷新
|
||||
this.props.action()
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
|
||||
}else{
|
||||
let url=`/courses/${coursesId}/polls/publish.json`
|
||||
axios.post(url,{
|
||||
check_ids:checkBoxValues,
|
||||
group_ids:chooseId,
|
||||
end_time:endtime
|
||||
}).then((result)=>{
|
||||
if(result){
|
||||
this.props.showNotification(result.data.message);
|
||||
this.homeworkhide();
|
||||
|
||||
// 调用父级公共头部的接口刷新
|
||||
this.props.action()
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getcourse_groupslist=(id)=>{
|
||||
this.setState({
|
||||
chooseId:id
|
||||
})
|
||||
}
|
||||
|
||||
render(){
|
||||
let{
|
||||
modalname,
|
||||
modaltype,
|
||||
visible,
|
||||
Topval,
|
||||
Topvalright,
|
||||
Botvalleft,
|
||||
Botval,
|
||||
starttime,
|
||||
starttimes,
|
||||
endtime,
|
||||
Cancelname,
|
||||
Savesname,
|
||||
Cancel,
|
||||
Saves,
|
||||
course_groups,
|
||||
|
||||
modalsType,
|
||||
modalsTopval,
|
||||
loadtype,
|
||||
}=this.state
|
||||
return(
|
||||
<React.Fragment>
|
||||
<HomeworkModal
|
||||
modaltype={modaltype}
|
||||
modalname={modalname}
|
||||
visible={visible}
|
||||
Topval={Topval}
|
||||
Topvalright={Topvalright}
|
||||
Botvalleft={Botvalleft}
|
||||
Botval={Botval}
|
||||
starttime={starttime}
|
||||
starttimes={starttimes}
|
||||
endtime={endtime}
|
||||
Cancelname={Cancelname}
|
||||
Savesname={Savesname}
|
||||
Cancel={Cancel}
|
||||
Saves={Saves}
|
||||
course_groups={course_groups}
|
||||
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
|
||||
/>
|
||||
{/* 公用的提示弹框 */}
|
||||
<Modals
|
||||
modalsType={modalsType}
|
||||
modalsTopval={modalsTopval}
|
||||
modalsBottomval=""
|
||||
loadtype={loadtype}
|
||||
modalCancel={this.modalCancel}
|
||||
modalSave={this.modalCancel}
|
||||
></Modals>
|
||||
|
||||
<WordsBtn style={this.props.style} className={this.props.className} onClick={this.homeworkstart}>立即发布</WordsBtn>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default Immediatelypublish
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue