diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 07731686e..8ce285ae1 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -7,11 +7,12 @@ import Sendtofilesmodal from "../coursesPublic/SendToFilesModal"; import Selectresource from "../coursesPublic/SelectResource"; import Sendresource from "../coursesPublic/sendResource"; import Selectsetting from "../coursesPublic/SelectSetting"; -import CourseLayoutcomponent from '../common/CourseLayoutComponent'; +import HomeworkModal from "../coursesPublic/HomeworkModal"; import Fileslistitem from './Fileslistitem'; import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; import './style.css'; import '../css/members.css'; +import moment from 'moment'; class Fileslists extends Component{ constructor(props){ @@ -232,7 +233,9 @@ class Fileslists extends Component{ this.props.showNotification("请先在列表中选择要发送的资源"); }else if(value===3){ this.props.showNotification("请先在列表中选择要公开的资源"); - } + }else if(value===4){ + this.props.showNotification("请先在列表中选择要发布的资源"); + } } onDelete = () => { @@ -549,7 +552,78 @@ class Fileslists extends Component{ }) } + homeworkstart=()=>{ + let selectnum= this.testonSelect(); + if(selectnum===true){ + this.noSelect(4); + return + } + let starttime= this.props.getNowFormatDates(1); + let endtime=this.props.getNowFormatDates(2); + this.setState({ + modalname:"立即发布", + visible:true, + typs:"start", + Topval:"学生将能立即查看和下载发布资源", + // Botvalleft:"暂不发布", + // Botval:`本操作只对"未发布"的分班有效`, + // starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + // starttimes:starttime, + // endtime:"截止时间:"+endtime, + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + }) + } + // 立即发布 + homeworkstartend=(ds,endtime)=>{ + let {checkBoxValues}=this.state; + let coursesId=this.props.match.params.coursesId; + let url ="/files/bulk_publish.json"; + axios.put(url, { + course_id:coursesId, + ids :checkBoxValues, + }).then((result)=>{ + if(result.status===200){ + this.props.showNotification("发布成功") + this.setState({ + checkBoxValues:[], + checkAllValue:false + }) + this.homeworkhide() + this.props.updataleftNavfun() + this.updatafiled() + } + }).catch((error)=>{ + console.log(error); + }) + } + + homeworkhide=()=>{ + this.setState({ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + StudentList_value:undefined, + addname:undefined, + addnametype:false, + addnametab:undefined, + typs:undefined, + starttimes:undefined, + }) + } render(){ let { searchValue, @@ -582,6 +656,26 @@ class Fileslists extends Component{ return( + {/*立即发布*/} + {this.state.visible===true?:""} {/*发送*/} {this.props.isAdmin()?
  • 删除
  • :""} {this.props.isAdmin()?
  • 发送
  • :""} - {/*{this.props.isAdmin()?*/} - {/*
  • 立即发布
  • */} - {/*:""}*/} + {this.props.isAdmin()? +
  • 立即发布
  • + :""} {this.props.isAdmin()?course_is_public===true?
  • 设为公开
  • :"":""} diff --git a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js index bc2fb60b5..440d8893c 100644 --- a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js +++ b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js @@ -88,25 +88,30 @@ class HomeworkModal extends Component{ propsSaves=(ds,endtime)=>{ - if(this.props.typs!="end"){ - if(endtime === ""||endtime===undefined||endtime===null){ + if(ds.length ===0&&endtime === ""){ + this.props.Saves() + }else{ + if(this.props.typs!="end"){ + if(endtime === ""||endtime===undefined||endtime===null){ - this.setState({ - endtimetype:true, - endtimetypevalue:"截止时间不能为空" - }) - return - } + this.setState({ + endtimetype:true, + endtimetypevalue:"截止时间不能为空" + }) + return + } - if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){ - this.setState({ - endtimetype:true, - endtimetypevalue:"必须晚于发布时间" - }) - return + if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){ + this.setState({ + endtimetype:true, + endtimetypevalue:"必须晚于发布时间" + }) + return + } } + this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm")) } - this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm")) + } diff --git a/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js b/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js index d1606da51..835debddb 100644 --- a/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js +++ b/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js @@ -1,202 +1,202 @@ -import React, {Component} from 'react'; - -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; - -import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; - -// import "antd/dist/antd.css"; - -import axios from 'axios'; - -import {getUrl} from 'educoder'; - -let origin = getUrl(); - -let path = getUrl("/editormd/lib/") - -const $ = window.$; - -let timeout; - -let currentValue; - -const Option = Select.Option; - -const RadioGroup = Radio.Group; - -function create_editorMD(id, width, high, placeholder, imageUrl, callback) { - var editorName = window.editormd(id, { - width: width, - height: high, - path: path, // "/editormd/lib/" - - syncScrolling: "single", - tex: true, - tocm: true, - emoji: true, - taskList: true, - codeFold: true, - searchReplace: true, - htmlDecode: "style,script,iframe", - sequenceDiagram: true, - autoFocus: false, - toolbarIcons: function () { - // Or return editormd.toolbarModes[name]; // full, simple, mini - // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] - }, - toolbarCustomIcons: { - testIcon: "
    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - placeholder: placeholder, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs"); - - callback && callback() - } - }); - return editorName; -} - - -export default class TPMUpdatepropaede extends Component { - constructor(props) { - super(props) - this.state = { - shixunId:undefined - } - } - - updatepropaedeMD(initValue, id) { - - this.contentChanged = false; - const placeholder = ""; - // amp; - // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; - // 创建editorMd - - const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { - setTimeout(() => { - Updatepropaede_editormd.resize() - Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - Updatepropaede_editormd.setValue(initValue) - } - Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - this.Updatepropaede_editormd = Updatepropaede_editormd; - window.Updatepropaede_editormd = Updatepropaede_editormd; - } - - componentDidMount() { - let id = this.props.match.params.shixunId; - let url="/shixuns/"+id+"/propaedeutics.json"; - axios.get(url).then((response) => { - console.log(response) - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.setState({ - shixunId:id - }) - - if(response.data.content[0]!=null){ - this.updatepropaedeMD(response.data.content[0], "UpdatepropaedeMD"); - }else{ - this.updatepropaedeMD("", "UpdatepropaedeMD"); - } - } - }).catch((error) => { - console.log(error) - }); - - } - - updatepropaedeuticsvalue=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/"+id+"/update_propaedeutics.json"; - const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue(); - axios.post(url,{ - content:update_propaedeuticsvalue - } - ).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.props.showSnackbar(response.data.message); - } - }).catch((error) => { - console.log(error) - }); - } - render() { - - let {shixunId} = this.state; - - - return ( - -
    - -
    -
    - 背景知识 - 返回 -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    - 保存 - 取消 -
    - -
    -
    - ) - } -} - - +import React, {Component} from 'react'; + +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +// import "antd/dist/antd.css"; + +import axios from 'axios'; + +import {getUrl} from 'educoder'; + +let origin = getUrl(); + +let path = getUrl("/editormd/lib/") + +const $ = window.$; + +let timeout; + +let currentValue; + +const Option = Select.Option; + +const RadioGroup = Radio.Group; + +function create_editorMD(id, width, high, placeholder, imageUrl, callback) { + var editorName = window.editormd(id, { + width: width, + height: high, + path: path, // "/editormd/lib/" + + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + toolbarIcons: function () { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] + }, + toolbarCustomIcons: { + testIcon: "
    ", + testIcon1: "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + placeholder: placeholder, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onload: function () { + // this.previewing(); + $("#" + id + " [type=\"latex\"]").bind("click", function () { + editorName.cm.replaceSelection("```latex"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("```"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + id + " [type=\"inline\"]").bind("click", function () { + editorName.cm.replaceSelection("$$$$"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs"); + + callback && callback() + } + }); + return editorName; +} + + +export default class TPMUpdatepropaede extends Component { + constructor(props) { + super(props) + this.state = { + shixunId:undefined + } + } + + updatepropaedeMD(initValue, id) { + + this.contentChanged = false; + const placeholder = ""; + // amp; + // 编辑时要传memoId + const imageUrl = `/api/attachments.json`; + // 创建editorMd + + const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { + setTimeout(() => { + Updatepropaede_editormd.resize() + Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh() + }, 500) + + if (initValue != undefined) { + Updatepropaede_editormd.setValue(initValue) + } + Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => { + console.log('....contentChanged') + this.contentChanged = true; + }) + }); + this.Updatepropaede_editormd = Updatepropaede_editormd; + window.Updatepropaede_editormd = Updatepropaede_editormd; + } + + componentDidMount() { + let id = this.props.match.params.shixunId; + let url="/shixuns/"+id+"/propaedeutics.json"; + axios.get(url).then((response) => { + console.log(response) + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + this.setState({ + shixunId:id + }) + + if(response.data.content[0]!=null){ + this.updatepropaedeMD(response.data.content, "UpdatepropaedeMD"); + }else{ + this.updatepropaedeMD("", "UpdatepropaedeMD"); + } + } + }).catch((error) => { + console.log(error) + }); + + } + + updatepropaedeuticsvalue=()=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/"+id+"/update_propaedeutics.json"; + const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue(); + axios.post(url,{ + content:update_propaedeuticsvalue + } + ).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + this.props.showSnackbar(response.data.message); + } + }).catch((error) => { + console.log(error) + }); + } + render() { + + let {shixunId} = this.state; + + + return ( + +
    + +
    +
    + 背景知识 + 返回 +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    + 保存 + 取消 +
    + +
    +
    + ) + } +} + + diff --git a/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js b/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js index c90f151c5..7582f52e4 100644 --- a/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js +++ b/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js @@ -36,9 +36,9 @@ class Propaedeutics extends Component { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }else{ - if(response.data.content[0]!=null){ + if(response.data.content!=null){ this.setState({ - PropaedeuticsListcontent:response.data.content[0] + PropaedeuticsListcontent:response.data.content }) }else{ this.setState({