From 3534d888ba5acd3a19663c8f5f3717573834a2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 22 Aug 2019 17:21:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/elearning/Elearning.js | 89 +++++++++++-------- .../src/modules/courses/new/Goldsubject.js | 38 +++++--- 2 files changed, 80 insertions(+), 47 deletions(-) diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index 81f300538..26bd35ef8 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form,Icon,message,Progress} from "antd"; +import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form,Icon,message,Progress,notification} from "antd"; import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import './myelearning.css' import axios from 'axios'; @@ -95,46 +95,63 @@ class Elearning extends Component{ }else { let {stages}=this.state; if(stages.length>0){ + var stagesdatas=[]; for(var i=0;i { - - if (response.data.status === -2) { - this.setState({ - - shixunsreplaces:true, - hidestartshixunsreplacevalues:response.data.message+".json" - }) - } else if (response.data.status === -1) { - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessages:response.data.message, - startshixunCombattypes:true, - }) - } else { - console.log("开始学习了"); - window.open("/tasks/" + response.data.game_identifier,'_blank'); - //这个是传过来 调用刷新 - this.Myreload(); - // window.location.href = path - // let path="/tasks/"+response.data.game_identifier; - // this.props.history.push(path); - } - }).catch((error) => { - - }); - break; - } - console.log("这是"+i); + for(var ki=0;ki0){ + this.kaishishixun(stagesdatas[0]); + + }else { + notification.open({ + message:"提示", + description: "实训暂未公开!" + }); + } + console.log("这是"+i); } - - } }; + kaishishixun=(id)=>{ + let url = "/shixuns/" + id + "/shixun_exec.json"; + axios.get(url).then((response) => { + console.log("精品课堂开发学习"); + console.log(response); + console.log(JSON.stringify(response)); + debugger + if (response.data.status === -2) { + this.setState({ + + shixunsreplaces:true, + hidestartshixunsreplacevalues:response.data.message+".json" + }) + } else if (response.data.status === -1) { + console.log(response) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessages:response.data.message, + startshixunCombattypes:true, + }) + } else { + console.log("开始学习了"); + window.open("/tasks/" + response.data.game_identifier,'_blank'); + //这个是传过来 调用刷新 + this.Myreload(); + // window.location.href = path + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); + } + }).catch((error) => { + + }); + } Startlearningtwo=()=>{ this.setState({ diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index 1e72d1995..c5fba9a1c 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -214,7 +214,7 @@ class Goldsubject extends Component { datatime: dateString, }); this.props.form.setFieldsValue({ - endtime: moment(dateString, dateFormat).add(1, 'days'), + endtime: moment(dateString, dateFormat), }); } @@ -237,7 +237,7 @@ class Goldsubject extends Component { datatimetwo: dateString, }) this.props.form.setFieldsValue({ - starttime: moment(dateString, dateFormat).add(1, 'days'), + starttime: moment(dateString, dateFormat), }); } @@ -318,14 +318,23 @@ class Goldsubject extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - start_date:values.starttime, - end_date: values.endtime, + start_date:moment(values.starttime).format("YYYY-MM-DD"), + end_date: moment(values.endtime).format("YYYY-MM-DD"), is_public: this.state.is_public, //这是也是带过来的值 course_module_types: values.checkboxgroup, school:values.school }; - console.log("327"); - console.log(datasysl); + try { + console.log("327"); + console.log(datasysl); + console.log(JSON.stringify(datasysl)); + console.log("88887777"); + console.log(moment(values.starttime).format("YYYY-MM-DD")); + console.log(moment(values.endtime).format("YYYY-MM-DD")); + }catch (e) { + + } + let url = "/courses/" + coursesId + ".json"; axios.put(url, datasysl @@ -392,15 +401,22 @@ class Goldsubject extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - start_date:values.starttime, - end_date: values.endtime, + start_date:moment(values.starttime).format("YYYY-MM-DD"), + end_date: moment(values.endtime).format("YYYY-MM-DD"), is_public: is_public, //这是也是带过来的值 course_module_types: values.checkboxgroup, school:values.school }; - console.log("提交的ysldatas数据"); - console.log(ysldatas); - console.log(JSON.stringify(ysldatas)); + try { + console.log("提交的ysldatas数据"); + console.log(ysldatas); + console.log(JSON.stringify(ysldatas)); + console.log(moment(values.starttime).format("YYYY-MM-DD")); + console.log(moment(values.endtime).format("YYYY-MM-DD")); + }catch (e) { + + } + axios.post(url, ysldatas ).then((response) => {