From 7a30ddfbf47ecaf01678f2a2b63686d6623eb1a9 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, 3 Sep 2019 14:45:23 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/usersInfo/InfosTopics.js | 12 ++++++++---- .../react/src/modules/user/usersInfo/usersInfo.css | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js index 6d9c1838f..c25f4e823 100644 --- a/public/react/src/modules/user/usersInfo/InfosTopics.js +++ b/public/react/src/modules/user/usersInfo/InfosTopics.js @@ -64,7 +64,13 @@ class InfosTopics extends Component{ this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,page) } searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{ - let user_id=this.props.current_user&&this.props.current_user.user_id; + + // if(this.props.current_user.login!=this.props.match.params.username){ + // return + // }else{ + // + // } + let user_id=this.props.match.params&&this.props.match.params.username; if(user_id!=undefined){ let {per_page}=this.state; let url=`/users/${user_id}/question_banks.json`; @@ -86,7 +92,6 @@ class InfosTopics extends Component{ }); } - } searchCategory=(type)=>{ @@ -351,7 +356,6 @@ class InfosTopics extends Component{ padding: 0px 15px; float: left; border-radius: 4px; - color: #4C4C4C; cursor: pointer; margin-right: 20px; display: block; @@ -454,7 +458,7 @@ class InfosTopics extends Component{ - {user_type!="学生"?this.sendTopics()}>发送:""} + {user_id===targetuserid&&user_type!="学生"?this.sendTopics()}>发送:""} {types==="personal"?user_id===targetuserid&&user_type!="学生"?this.deletecheckBoxValues()}>删除:"":""}

:""} diff --git a/public/react/src/modules/user/usersInfo/usersInfo.css b/public/react/src/modules/user/usersInfo/usersInfo.css index 927b0c70c..259981f2f 100644 --- a/public/react/src/modules/user/usersInfo/usersInfo.css +++ b/public/react/src/modules/user/usersInfo/usersInfo.css @@ -277,7 +277,7 @@ font-size:16px; font-family:PingFangSC; font-weight:400; - color:rgba(51,51,51,1); + color: #666 !important; cursor: pointer; } @@ -366,7 +366,7 @@ .topscisright{ right: 0px; - top: 64px; + top: 45px; display: block; position: absolute; } From 44f3888d04b3019d70fb460c5dee1628d0593260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 3 Sep 2019 14:49:00 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/util/redis.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/libs/util/redis.rb diff --git a/app/libs/util/redis.rb b/app/libs/util/redis.rb new file mode 100644 index 000000000..f240406f5 --- /dev/null +++ b/app/libs/util/redis.rb @@ -0,0 +1,9 @@ +module Util::Redis + class << self + def online_user_count + if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore) + Rails.cache.data.scan(0, match: 'cache:_session_id:*', count: 100000).last.uniq.size + end + end + end +end \ No newline at end of file From 408b363817abf28ef937c40ceffa631cf2d17e8f 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, 3 Sep 2019 15:02:17 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/util/redis.rb | 9 +++++ public/react/src/modules/courses/Index.js | 1 - .../Completetaskdetails.js | 2 +- .../completetaskdetails/Completetaskpage.js | 2 +- .../completetaskdetails.css | 2 +- .../courses/groupjobbank/GroupPackage.js | 2 +- .../courses/groupjobbank/GroupPackage2.js | 34 +++++++++---------- .../groupjobbank/Groupjobbandetails.js | 2 +- .../courses/groupjobbank/GroupjobbankPage.js | 2 +- .../groupjobbank/Groupjobquesanswer.js | 1 + .../questionbank/Generaljobbankdetails.js | 2 +- .../courses/questionbank/Generaljobdetails.js | 1 + 12 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 app/libs/util/redis.rb diff --git a/app/libs/util/redis.rb b/app/libs/util/redis.rb new file mode 100644 index 000000000..f240406f5 --- /dev/null +++ b/app/libs/util/redis.rb @@ -0,0 +1,9 @@ +module Util::Redis + class << self + def online_user_count + if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore) + Rails.cache.data.scan(0, match: 'cache:_session_id:*', count: 100000).last.uniq.size + end + end + end +end \ No newline at end of file diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index 457723376..f21dc01ab 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -270,7 +270,6 @@ const Ordering=Loadable({ loader: () => import('../../modules/courses/ordering/Ordering'), loading: Loading, }); - class CoursesIndex extends Component{ constructor(props) { super(props) diff --git a/public/react/src/modules/courses/completetaskdetails/Completetaskdetails.js b/public/react/src/modules/courses/completetaskdetails/Completetaskdetails.js index 833c60e1f..0da4e4369 100644 --- a/public/react/src/modules/courses/completetaskdetails/Completetaskdetails.js +++ b/public/react/src/modules/courses/completetaskdetails/Completetaskdetails.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder'; import { @@ -78,7 +79,6 @@ class Groupjobbandetails extends Component { ) } {/*
*/} - {/*{datas.attachments === undefined ? "" : datas.attachments.map((item, key) => {*/} {/* return (*/} {/* */} diff --git a/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js b/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js index b74ad13e2..039dbda89 100644 --- a/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js +++ b/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn,MarkdownToHtml} from 'educoder'; @@ -228,4 +229,3 @@ class Completetaskpage extends Component { } export default Completetaskpage; - diff --git a/public/react/src/modules/courses/completetaskdetails/completetaskdetails.css b/public/react/src/modules/courses/completetaskdetails/completetaskdetails.css index 0f3b143d6..809736d69 100644 --- a/public/react/src/modules/courses/completetaskdetails/completetaskdetails.css +++ b/public/react/src/modules/courses/completetaskdetails/completetaskdetails.css @@ -1,3 +1,4 @@ + .yslquestionbank1{ padding-top: 30px !important; padding-right: 30px !important; @@ -11,7 +12,6 @@ .yslquesmarkdowntext{ font-size: 16px; color: #707070; - } .yslquesmat26{ margin-top: 26px; diff --git a/public/react/src/modules/courses/groupjobbank/GroupPackage.js b/public/react/src/modules/courses/groupjobbank/GroupPackage.js index 73132b3fa..e0b220202 100644 --- a/public/react/src/modules/courses/groupjobbank/GroupPackage.js +++ b/public/react/src/modules/courses/groupjobbank/GroupPackage.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { @@ -36,7 +37,6 @@ class GroupPackage extends Component { - } // 获取数据地方 getTrainingjobsetting = () => { diff --git a/public/react/src/modules/courses/groupjobbank/GroupPackage2.js b/public/react/src/modules/courses/groupjobbank/GroupPackage2.js index 349c2b97e..888e6c012 100644 --- a/public/react/src/modules/courses/groupjobbank/GroupPackage2.js +++ b/public/react/src/modules/courses/groupjobbank/GroupPackage2.js @@ -59,28 +59,28 @@ class GroupPackage extends Component { return ( bool===true? -
- { - datas===undefined?"":datas.min_num===undefined||datas.max_num===undefined?"":datas.min_num===null||datas.max_num===null?"": -

- 分组要求: - {datas&&datas.min_num}~ {datas&&datas.max_num}(学生提交作品时需要关联同组成员,组内成员作品共享) -

- } -

- 基于项目实施 - (学生必须在本平台创建项目,项目管理员可以提交作品) -

-
- :
+
{ - datas===undefined?"":datas.group_info===undefined?"":datas.group_info.min_number===undefined||datas.group_info.max_number===undefined?"": - datas.group_info.min_number===null||datas.group_info.max_number===null?"": + datas===undefined?"":datas.min_num===undefined||datas.max_num===undefined?"":datas.min_num===null||datas.max_num===null?"":

分组要求: - {datas&&datas.group_info&&datas.group_info.min_number}~ {datas&&datas.group_info&&datas.group_info.max_number}(学生提交作品时需要关联同组成员,组内成员作品共享) + {datas&&datas.min_num}~ {datas&&datas.max_num}(学生提交作品时需要关联同组成员,组内成员作品共享)

} +

+ 基于项目实施 + (学生必须在本平台创建项目,项目管理员可以提交作品) +

+
+ :
+ { + datas===undefined?"":datas.group_info===undefined?"":datas.group_info.min_number===undefined||datas.group_info.max_number===undefined?"": + datas.group_info.min_number===null||datas.group_info.max_number===null?"": +

+ 分组要求: + {datas&&datas.group_info&&datas.group_info.min_number}~ {datas&&datas.group_info&&datas.group_info.max_number}(学生提交作品时需要关联同组成员,组内成员作品共享) +

+ } { datas&&datas.group_info&&datas.group_info.base_on_project?

diff --git a/public/react/src/modules/courses/groupjobbank/Groupjobbandetails.js b/public/react/src/modules/courses/groupjobbank/Groupjobbandetails.js index a0ba84549..fa3503b69 100644 --- a/public/react/src/modules/courses/groupjobbank/Groupjobbandetails.js +++ b/public/react/src/modules/courses/groupjobbank/Groupjobbandetails.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder'; import { @@ -79,7 +80,6 @@ class Groupjobbandetails extends Component { ) } {/*

*/} - {/*{datas.attachments === undefined ? "" : datas.attachments.map((item, key) => {*/} {/* return (*/} {/* */} diff --git a/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js b/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js index 25089079d..237aac3a3 100644 --- a/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js +++ b/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn} from 'educoder'; @@ -264,4 +265,3 @@ class GroupjobbankPage extends Component { } export default GroupjobbankPage; - diff --git a/public/react/src/modules/courses/groupjobbank/Groupjobquesanswer.js b/public/react/src/modules/courses/groupjobbank/Groupjobquesanswer.js index b927f3177..8bc9c970d 100644 --- a/public/react/src/modules/courses/groupjobbank/Groupjobquesanswer.js +++ b/public/react/src/modules/courses/groupjobbank/Groupjobquesanswer.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder'; import { diff --git a/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js b/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js index c24c0569c..881f0f70d 100644 --- a/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js +++ b/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn,getImageUrl} from 'educoder'; @@ -259,4 +260,3 @@ class Generaljobbankdetails extends Component { } export default Generaljobbankdetails; - diff --git a/public/react/src/modules/courses/questionbank/Generaljobdetails.js b/public/react/src/modules/courses/questionbank/Generaljobdetails.js index b52c9f027..65d597428 100644 --- a/public/react/src/modules/courses/questionbank/Generaljobdetails.js +++ b/public/react/src/modules/courses/questionbank/Generaljobdetails.js @@ -1,3 +1,4 @@ + import React, {Component} from "react"; import { WordsBtn,on, off, trigger,markdownToHTML, MarkdownToHtml ,getImageUrl} from 'educoder'; import { From 92bee12186d80019f5d0b6ca2678204518efe3dc 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, 3 Sep 2019 15:17:16 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/usersInfo/InfosBanner.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index c28bff9db..c2f2c7ff4 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -119,11 +119,12 @@ class InfosBanner extends Component{ } {/*自己的主页且不是学生显示题库按钮*/} - { user_id===targetuserid&&user_type!="学生"?
  • + {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) + &&
  • this.setState({moduleName: 'topics'})} to={`/users/${username}/topics/personal`}>题库 -
  • :""} + }
    From df76d7afea9c9ce7e1227a61b1be014486a9bf5a Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 3 Sep 2019 15:37:33 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/busyWork/NewWork.js | 415 ++---------------- .../modules/courses/busyWork/NewWorkForm.js | 18 +- .../user/usersInfo/banks/HomeworkBanksEdit.js | 1 - 3 files changed, 44 insertions(+), 390 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 8000de59f..a17dc8ed2 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -7,6 +7,7 @@ import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendF , getUploadActionUrl } from 'educoder' import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import CBreadcrumb from '../common/CBreadcrumb' +import NewWorkForm from './NewWorkForm' const confirm = Modal.confirm; const $ = window.$ @@ -18,15 +19,8 @@ class NewWork extends Component{ this.answerMdRef = React.createRef(); this.state={ - title_value:"", - title_num: 0, - contentFileList: [], - answerFileList: [], - workLoaded: false, - base_on_project: true, category: {}, - min_num: 2, - max_num: 10, + course_name: '' } } componentDidMount () { @@ -66,56 +60,13 @@ class NewWork extends Component{ .then((response) => { if (response.data.name) { const data = response.data; - - const contentFileList = data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - const answerFileList = data.ref_attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - + data.isEdit = this.isEdit this.setState({ - ...data, - // course_id: data.course_id, - // course_name: data.course_name, - // category: data.category, - title_num: parseInt(data.name.length), - workLoaded: true, - init_min_num: data.min_num, - init_max_num: data.max_num, - // description: data.description, - reference_answer: data.reference_answer, - contentFileList, - answerFileList, - }, () => { - setTimeout(() => { - this.contentMdRef.current.setValue(data.description || '') - this.answerMdRef.current.setValue(data.reference_answer || '') - - }, 2000) - - this.props.form.setFieldsValue({ - title: data.name, - description: data.description || '', - reference_answer: data.reference_answer || '', - }); - + course_id: data.course_id, + course_name: data.course_name, + category: data.category, }) - + this.newWorkFormRef.initValue(response.data) } }) .catch(function (error) { @@ -123,72 +74,15 @@ class NewWork extends Component{ }); } - // 输入title - changeTitle=(e)=>{ - console.log(e.target.value.length); - this.setState({ - title_num: parseInt(e.target.value.length) - }) + onCancel = () => { + this.props.toListPage(this.props.match.params, this.state.category.category_id) } - handleSubmit = () => { - const courseId = this.state.course_id || this.props.match.params.coursesId ; - - this.props.form.validateFieldsAndScroll((err, values) => { - console.log(values) - const mdContnet = this.contentMdRef.current.getValue().trim(); - console.log(mdContnet) - values.description = mdContnet; - // return; - - {/* max={has_commit ? init_min_num : null } */} - {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} - // 已有提交作品,人数范围只能扩大 - const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; - if (has_commit) { - if (max_num < init_max_num || min_num > init_min_num) { - this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) - return; - } - } - // const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet - if (!err) { - if (this.isEdit) { - this.doEdit(courseId, values) - } else { - this.doNew(courseId, values) - } - - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) - } - }) - } - doEdit = (courseId, values) => { + doEdit = (params) => { const workId = this.props.match.params.workId const newUrl = `/homework_commons/${workId}.json` - let attachment_ids = this.state.contentFileList.map(item => { - return item.response ? item.response.id : item.id - }) - let reference_attachment_ids = this.state.answerFileList.map(item => { - return item.response ? item.response.id : item.id - }) - - const { min_num, max_num, base_on_project, category } = this.state - const isGroup = this.props.isGroup() - axios.put(newUrl, { - type: isGroup ? 3 : 1, - name: values.title, - description: values.description, - reference_answer: values.reference_answer, - attachment_ids, - reference_attachment_ids, - - min_num, - max_num, - base_on_project - }) + axios.put(newUrl, params) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -199,30 +93,11 @@ class NewWork extends Component{ console.log(error); }); } - doNew = (courseId, values) => { - const newUrl = `/courses/${courseId}/homework_commons.json` - - let attachment_ids = this.state.contentFileList.map(item => { - return item.response ? item.response.id : item.id - }) - let reference_attachment_ids = this.state.answerFileList.map(item => { - return item.response ? item.response.id : item.id - }) - const isGroup = this.props.isGroup() - const { min_num, max_num, base_on_project, category } = this.state - - axios.post(newUrl, { - type: isGroup ? 3 : 1, - name: values.title, - description: values.description, - reference_answer: values.reference_answer, - attachment_ids, - reference_attachment_ids, + doNew = (params) => { + const coursesId = this.props.match.params.coursesId + const newUrl = `/courses/${coursesId}/homework_commons.json` - min_num, - max_num, - base_on_project - }) + axios.post(newUrl, params) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -265,119 +140,31 @@ class NewWork extends Component{ } } - deleteAttachment = (file, stateName) => { - // 初次上传不能直接取uid - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state[stateName].indexOf(file); - const newFileList = state[stateName].slice(); - newFileList.splice(index, 1); - return { - [stateName]: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - max_num_change = (val) => { - if (val < 2) { - this.setState({ - max_num: 2, - }) - return; - } - const { min_num } = this.state; - this.setState({ - max_num: val, - min_num: val <= min_num ? val - 1 : min_num - }) - } - min_num_change = (val) => { - this.setState({ min_num: val }) - } - base_on_project_change = () => { - this.setState({ base_on_project: !this.state.base_on_project }) - } render(){ let {typeId,coursesId,pageType}=this.props.match.params; - const { getFieldDecorator } = this.props.form; + const isGroup = this.props.isGroup() const moduleName = !isGroup? "普通作业":"分组作业"; const moduleEngName = this.props.getModuleName() let{ - title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, - init_max_num, init_min_num, - title_num, course_name, category, has_commit, has_project + course_name, category }=this.state const { current_user } = this.props - const courseId = this.state.course_id || this.props.match.params.coursesId ; + const courseId = this.state.course_id || coursesId ; const isEdit = this.isEdit; - if ((isEdit == undefined || isEdit) && !this.state.workLoaded) { - return '' - } - const uploadProps = { - width: 600, - fileList: contentFileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleContentUploadChange, - onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - const answerUploadProps = { - width: 600, - fileList: answerFileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, - onChange: this.handleAnswerUploadChange, - onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'), - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; + + const common = { + onCancel:this.onCancel, + isGroup: this.props.isGroup, + doNew: this.doNew, + doEdit: this.doEdit, + } return(
    - {/*

    - {course_name} - > - {typeId==1 ?"普通作业":"分组作业"} - > - {pageType==="new"?"新建":"编辑"} -

    */} {this.isEdit ?"编辑":"新建"}{ moduleName } - {/* history.goBack() - this.props.toListPage(this.props.match.params, category.category_id)} - */} this.props.history.goBack()}> 返回

    - {/* onSubmit={this.handleSubmit} */} -
    - - {getFieldDecorator('title', { - rules: [{ - required: true, message: '请输入标题' - }], - })( - - )} - - - - - { - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入作业内容和要求' - }], - })( - - )} - } - - - (单个文件150M以内) - - - - { isGroup && - - {getFieldDecorator('personNum', { - rules: [{ - required: false - // required: true, message: '请输入最小人数和最大人数' - }], - })( -
    -

    - - {/* max={has_commit ? init_min_num : null } */} - - - - ~ - {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} - - - - -

    -

    - - 基于项目实施 - - - -

    -
    - )} -
    - } - - {getFieldDecorator('reference_answer', { - rules: [{ - required: false - }], - })( - - )} - - - (单个文件150M以内) - - - - - - + {this.newWorkFormRef = ref}} + >
    ) } } -const WrappedBoardsNew = Form.create({ name: 'NewWork' })(NewWork); -export default WrappedBoardsNew; \ No newline at end of file + +export default NewWork; \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 179e3df52..eaae55a42 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -182,16 +182,20 @@ class NewWorkForm extends Component{ } handleContentUploadChange = (info) => { - let contentFileList = info.fileList; - this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) }); + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { + let contentFileList = info.fileList; + this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) }); + } } handleAnswerUploadChange = (info) => { - let answerFileList = info.fileList; - this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) }); + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { + let answerFileList = info.fileList; + this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) }); + } } onAttachmentRemove = (file, stateName) => { - if(file.response!=undefined){ + if(!file.percent || file.percent == 100){ this.props.confirm({ content: '是否确认删除?', @@ -283,7 +287,7 @@ class NewWorkForm extends Component{ console.log('beforeUpload', file.name); const isLt150M = file.size / 1024 / 1024 < 150; if (!isLt150M) { - message.error('文件大小必须小于150MB!'); + this.props.showNotification('文件大小必须小于150MB!'); } return isLt150M; }, @@ -302,7 +306,7 @@ class NewWorkForm extends Component{ console.log('beforeUpload', file.name); const isLt150M = file.size / 1024 / 1024 < 150; if (!isLt150M) { - message.error('文件大小必须小于150MB!'); + this.props.showNotification('文件大小必须小于150MB!'); } return isLt150M; }, diff --git a/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js b/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js index 05d05ec9b..b672239b5 100644 --- a/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js +++ b/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js @@ -95,7 +95,6 @@ class HomeworkBanksEdit extends Component { {...this.state} {...common} wrappedComponentRef={(ref) => this.newWorkFormRef = ref} - topicId={bankId} >
    ) From 7c04cc4ae2fa2894d268381e3eb49b00a284e3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 3 Sep 2019 15:46:51 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/login/Trialapplication.js | 2 +- public/react/src/modules/login/Trialapplicationysl.js | 2 +- public/react/src/modules/user/FindPasswordComponent.js | 6 +++--- public/react/src/modules/user/LoginRegisterComponent.js | 9 ++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index b64bb24b7..d7782e4cc 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -305,7 +305,7 @@ class Trialapplication extends Component { return; } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; diff --git a/public/react/src/modules/login/Trialapplicationysl.js b/public/react/src/modules/login/Trialapplicationysl.js index ee4d6a9f9..97064cbd4 100644 --- a/public/react/src/modules/login/Trialapplicationysl.js +++ b/public/react/src/modules/login/Trialapplicationysl.js @@ -323,7 +323,7 @@ class Trialapplicationysl extends Component { return; } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index b2e89da52..b6e9dda22 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -375,7 +375,7 @@ class LoginRegisterComponent extends Component { return; } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; @@ -438,7 +438,7 @@ class LoginRegisterComponent extends Component { // return; // } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; @@ -500,7 +500,7 @@ class LoginRegisterComponent extends Component { return } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 5a569192c..a9e8de797 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -233,7 +233,7 @@ class LoginRegisterComponent extends Component { return; } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; @@ -700,7 +700,7 @@ class LoginRegisterComponent extends Component { return; } // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; @@ -1103,16 +1103,15 @@ class LoginRegisterComponent extends Component { right: 12px; height: 20px; } - .ant-input{ + .mymimasysl { border-right: none !important; - height: 40px !important; } ` } Date: Tue, 3 Sep 2019 15:55:23 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/new/CoursesNew.js | 2 +- public/react/src/modules/courses/new/Goldsubject.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 9e0a9645e..ec73cc17d 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -574,7 +574,7 @@ class CoursesNew extends Component { {this.props.match.params.coursesId === undefined ?"翻转课堂":dataname} > - {this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"} + {this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}

    diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index 531947e0f..7e4d42418 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -696,7 +696,7 @@ class Goldsubject extends Component { {Whethertocreateanewclassroom===true?"翻转课堂":name} > - {Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"} + {Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}