From 2cedb6da301cc8922c04b9d25a183ef96ee95898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 15 Oct 2019 14:31:42 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/index.js | 3 ++ .../courses/coursesPublic/SelectSetting.js | 45 +++++++++++++------ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 3423d87f0..d61dec15b 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -745,6 +745,7 @@ class Fileslists extends Component{ {/*选择资源*/} {shixunmodal&&shixunmodal===true?100){ @@ -241,10 +255,18 @@ class Selectsetting extends Component{ fileList:[] }) } - - } + onChangepublic=(e)=>{ + this.setState({ + is_public:e.target.checked + }) + } + RadioonChange=(e)=>{ + this.setState({ + Radiovalue: e.target.value, + }); + } render(){ let {datatime,description,datalist}=this.state; @@ -479,16 +501,6 @@ class Selectsetting extends Component{ margin-top:10px; } `} - - {this.props.course_is_public===true?
- 公开: - 选中,所有用户可见,否则课堂成员可见 - -
:""} - - - - - + {this.props.course_is_public===true?
+ 公开: + 选中,所有用户可见,否则课堂成员可见 + +
:""}

{this.props.course_is_public===true?
- 公开: + 公开:this.onChangepublic(e)}> 选中,所有用户可见,否则课堂成员可见
:""} @@ -530,13 +518,14 @@ class Selectsetting extends Component{
发布设置: - + this.RadioonChange(e)} value={this.state.Radiovalue} style={{'width': '460px'}}> 立即发布 延迟发布 { - this.setState({ - course_groups: response.data.course_groups, - course_groups_count:response.data.course_groups_count - }) - }) - .catch(function (error) { - console.log(error); - }); - } - } //勾选实训 @@ -245,6 +228,11 @@ class Sendresource extends Component{ } RadioonChange=(e)=>{ + if(e.target.value===0){ + this.setState({ + datatime:undefined + }) + } this.setState({ Radiovalue: e.target.value, }); @@ -411,6 +399,7 @@ class Sendresource extends Component{ 延迟发布 Date: Tue, 15 Oct 2019 15:07:06 +0800 Subject: [PATCH 07/10] ChangeRolePop --- public/react/src/modules/courses/members/ChangeRolePop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js index 13130394a..9883c488f 100644 --- a/public/react/src/modules/courses/members/ChangeRolePop.js +++ b/public/react/src/modules/courses/members/ChangeRolePop.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, memo } from 'react' import { trigger, WordsBtn } from 'educoder' import { Input, Checkbox, Popconfirm } from "antd"; import axios from 'axios' @@ -77,4 +77,4 @@ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSucces ) } -export default ChangeRolePop \ No newline at end of file +export default memo(ChangeRolePop) \ No newline at end of file From ffeb362b78e5bbd12d67da11579303f0313562bb Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 15 Oct 2019 15:23:43 +0800 Subject: [PATCH 08/10] init --- public/react/src/modules/courses/members/ChangeRolePop.js | 8 +++++--- public/react/src/modules/courses/members/studentsList.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js index 9883c488f..d81c6db46 100644 --- a/public/react/src/modules/courses/members/ChangeRolePop.js +++ b/public/react/src/modules/courses/members/ChangeRolePop.js @@ -8,9 +8,11 @@ import axios from 'axios' */ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) { const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles) - useEffect(() => { - setCheckBoxRoles(member_roles) - }, [member_roles]) + // useEffect(() => { + // if (checkBoxRoles.length != member_roles.length) { // 死循环 + // setCheckBoxRoles(member_roles) + // } + // }, [member_roles]) function onCheckBoxChange(val) { console.log(val) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index ab29dde45..33d434329 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -149,7 +149,7 @@ const buildColumns = (that,isParent) => { return ( that.onDelete(record)} style={'grey'}>删除学生 - { showNotification={that.props.showNotification} getUserId={that.props.isUserid} fetchUser={that.props.fetchUser} - > + >} ) }, From 45dbb1fe2f0e22a855b42fd0369d9ca62d0e80ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 15 Oct 2019 15:26:37 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/SelectResource.js | 112 ++++++++++++++---- .../courses/coursesPublic/SelectSetting.js | 4 +- 2 files changed, 92 insertions(+), 24 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index c323d1bae..0e76059c8 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -1,17 +1,34 @@ import React,{ Component } from "react"; -import { Modal,Checkbox,Select,Input,Spin,Icon} from "antd"; +import { Modal,Checkbox,Select,Input,Spin,Icon,Radio,DatePicker} from "antd"; +import locale from 'antd/lib/date-picker/locale/zh_CN'; import axios from'axios'; +import {handleDateString} from 'educoder'; import NoneData from "../coursesPublic/NoneData"; import Modals from '../../modals/Modals'; - +import moment from 'moment'; const Option = Select.Option; const Search = Input.Search; - +const dateFormat ="YYYY-MM-DD HH:mm" function formatDate(date) { var dateee = new Date(date).toJSON(); return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '') } - +function range(start, end) { + const result = []; + for (let i = start; i < end; i++) { + result.push(i); + } + return result; +} +function disabledDateTime() { + return { + disabledMinutes: () => range(1, 30).concat(range(31, 60)), + // disabledSeconds: () => range(1,60) + } +} +function disabledDate(current) { + return current && current < moment().endOf('day').subtract(1, 'days'); +} class Selectresource extends Component{ constructor(props){ super(props); @@ -23,7 +40,9 @@ class Selectresource extends Component{ Resourcelist:undefined, hometypepvisible:true, getallfiles:false, - searchtype:'getallfiles' + searchtype:'getallfiles', + Radiovalue:0, + datatime:undefined } } componentDidMount() { @@ -32,11 +51,7 @@ class Selectresource extends Component{ componentDidUpdate = (prevProps) => { - let {getallfiles}=this.state; - - if ( prevProps.visible != this.props.visible ) { - } } @@ -197,7 +212,7 @@ class Selectresource extends Component{ savecouseShixunModal=()=>{ - let {patheditarry}=this.state; + let {patheditarry,datatime,Radiovalue}=this.state; let {coursesId,attachmentId}=this.props; let url="/files/import.json"; @@ -212,19 +227,28 @@ class Selectresource extends Component{ }) } + if(this.state.Radiovalue===1){ + if(datatime===undefined||datatime===null||datatime=== ""){ + this.setState({ + Radiovaluetype:true + }) + return + }else{ + this.setState({ + Radiovaluetype:false + }) + } + } + axios.post(url, { course_id:coursesId, attachment_ids:patheditarry, course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, + delay_publish:Radiovalue, + publish_time:Radiovalue===1?datatime:undefined } ).then((response) => { if(response.data.status===0){ - // this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - // ModalSave:this.ModalCancelModalCancel, - // loadtype:true - // }) this.ModalCancelModalCancel(); this.props.updataleftNavfun(); this.props.showNotification("选用资源成功"); @@ -236,15 +260,33 @@ class Selectresource extends Component{ } - selectCloseList=(value)=>{ + RadioonChange=(e)=>{ + if(e.target.value===0){ + this.setState({ + datatime:undefined + }) + } this.setState({ - category_id:value + Radiovalue: e.target.value, + }); + } + + onChangeTimepublish= (date, dateString) => { + + this.setState({ + datatime:handleDateString(dateString), }) + } render(){ - let {Searchvalue,type,category_id,Resourcelist,hometypepvisible,patheditarry}=this.state; - let {visible,shixunmodallist}=this.props; + let {Searchvalue,type,Resourcelist,hometypepvisible,patheditarry,datatime}=this.state; + let {visible}=this.props; const antIcon = ; + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; return(
{/*提示*/} @@ -373,10 +415,36 @@ class Selectresource extends Component{ }
- +
+ 发布设置: + + + 立即发布 + + + 延迟发布 + this.onChangeTimepublish(e,index,undefined,1)} + disabledTime={disabledDateTime} + disabledDate={disabledDate} + disabled={this.state.Radiovalue===1?false:true} + /> + + (按照设置的时间定时发布) + +
{this.state.patheditarrytype===true?

请选择资源

:""} - + {this.state.Radiovaluetype===true?

发布时间不能为空

:""}
取消 确定 diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index eae1f4e3b..0b7aad29e 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -165,9 +165,9 @@ class Selectsetting extends Component{ axios.put(url,{ course_id:coursesId, new_attachment_id:newfileList.length===0?undefined:newfileList, - // course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, + course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, is_public:is_public, - publish_time:Radiovalue===0?undefined:datatime===undefined?moment(new Date()).format('YYYY-MM-DD HH'):datatime, + publish_time:Radiovalue===0?undefined:datatime===undefined?moment(new Date(),dateFormat):datatime, description:description, delay_publish:Radiovalue }).then((result)=>{ From 24777628cc8891d0c69aab4d8c398e4e7ee75e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 15 Oct 2019 16:00:40 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/SendToFilesModal.js | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/SendToFilesModal.js b/public/react/src/modules/courses/coursesPublic/SendToFilesModal.js index d14d5d267..319ab8304 100644 --- a/public/react/src/modules/courses/coursesPublic/SendToFilesModal.js +++ b/public/react/src/modules/courses/coursesPublic/SendToFilesModal.js @@ -1,9 +1,11 @@ import React, { Component } from "react"; import { Modal, Checkbox, Input, Spin} from "antd"; -import axios from 'axios' +import axios from 'axios'; +import moment from 'moment'; import ModalWrapper from "../common/ModalWrapper"; import InfiniteScroll from 'react-infinite-scroller'; +const dateFormat ="YYYY-MM-DD HH:mm" const Search = Input.Search const pageCount = 15; class Sendtofilesmodal extends Component{ @@ -170,7 +172,12 @@ class Sendtofilesmodal extends Component{ bottom: 93px; width: 82%; text-align: center; - }`} + } + .ModalWrappertitle{ + background: #D0E8FC; + padding: 10px; + } + `}

选择的{moduleName}发送到指定课堂

@@ -183,7 +190,12 @@ class Sendtofilesmodal extends Component{ >
- {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} + +

+

课堂名称
+
更新时间
+
结束时间
+

- +
{course.name}
+
{moment(course.updated_at).format('YYYY-MM-DD HH:mm')}
+
{course.end_date}

) }) } - {loading && hasMore && ( -
- -
- )} - {/* TODO */} - {/* { - !hasMore &&
没有更多了。。
- } */} +