diff --git a/app/controllers/concerns/git_common.rb b/app/controllers/concerns/git_common.rb index 93f5fecd7..b8b2ec10a 100644 --- a/app/controllers/concerns/git_common.rb +++ b/app/controllers/concerns/git_common.rb @@ -47,6 +47,7 @@ module GitCommon def add_file @path, message, content = params[:path].strip, params[:message], params[:content] author_name, author_email = current_user.real_name, current_user.git_mail + Rails.logger.info(" good repo_name is #{@repo_path}") @content = GitService.update_file(repo_path: @repo_path, file_path: @path, message: message, diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1632813ea..b99cac96a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1100,13 +1100,19 @@ class CoursesController < ApplicationController def export_member_act_score search = params[:search] ? "#{params[:search].strip}" : "" #用户名或学生学号id搜索 group_id = params[:group_id] #分班的班级id - @all_members = student_act_score group_id, search + @all_members = @course.students + @all_members = @all_members.where(course_group_id: group_id) unless group_id.blank? + unless search.blank? + @all_members = @all_members.joins(user: [:user_extension]).where('concat(users.lastname, users.firstname) like ? or user_extensions.student_id like ?',"%#{search}%","%#{search}%") + end + if @all_members.size == 0 normal_status(-1,"课堂暂时没有学生") elsif params[:export].present? && params[:export] normal_status(0,"正在下载中") else set_export_cookies + @all_members = student_act_score group_id, search act_score_to_xlsx(@all_members) filename_ = "#{current_user.real_name}_#{@course.name}_活跃度_#{Time.now.strftime('%Y%m%d_%H%M%S')}" render xlsx: "#{format_sheet_name filename_.strip}",template: "courses/export_member_act_score.xlsx.axlsx", diff --git a/app/controllers/homework_banks_controller.rb b/app/controllers/homework_banks_controller.rb index a812da751..7e10509ba 100644 --- a/app/controllers/homework_banks_controller.rb +++ b/app/controllers/homework_banks_controller.rb @@ -11,7 +11,12 @@ class HomeworkBanksController < ApplicationController def update ActiveRecord::Base.transaction do - @bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer]) + if @bank.homework_type == 1 + @bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer]) + elsif @bank.homework_type == 3 + @bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer], + base_on_project: params[:base_on_project], min_num: params[:min_num], max_num: params[:max_num]) + end # 作业描述的附件 Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids] diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index e86c135e1..3dc27edc6 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -13,7 +13,7 @@ class ShixunsController < ApplicationController before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :add_file, :propaedeutics, :departments, :apply_shixun_mirror, :get_mirror_script, :download_file] - before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy] + before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :shixun_members_added, :change_manager, :collaborators_delete, diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder index eb2309f9b..7fdc2cfc1 100644 --- a/app/views/games/picture_display.json.jbuilder +++ b/app/views/games/picture_display.json.jbuilder @@ -19,7 +19,7 @@ if @type == "image" end elsif @type == "html" - json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe + json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe if @user_picture[0].present? elsif @type == "txt" json.contents @contents.to_s elsif @type =="qrcode" diff --git a/db/migrate/20190830082934_add_tag_to_libraries.rb b/db/migrate/20190830082934_add_tag_to_libraries.rb new file mode 100644 index 000000000..ea40cda5d --- /dev/null +++ b/db/migrate/20190830082934_add_tag_to_libraries.rb @@ -0,0 +1,5 @@ +class AddTagToLibraries < ActiveRecord::Migration[5.2] + def change + execute "insert into library_tags(name) values('企业案例')" + end +end diff --git a/public/react/src/common/course/ActionBtn.js b/public/react/src/common/course/ActionBtn.js index f10a56910..484c85eb0 100644 --- a/public/react/src/common/course/ActionBtn.js +++ b/public/react/src/common/course/ActionBtn.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import {Link} from 'react-router-dom' -const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",'greyLine':"greyLine", +const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",'greyLine':"greyLine",'orangeLine':"orangeLine", 'colorBlue': 'colorBlue', // 蓝字白底 } class ActionBtn extends Component { diff --git a/public/react/src/context/EvaluateSuccessEffectDisplay.js b/public/react/src/context/EvaluateSuccessEffectDisplay.js index ec34db31f..98e61520b 100644 --- a/public/react/src/context/EvaluateSuccessEffectDisplay.js +++ b/public/react/src/context/EvaluateSuccessEffectDisplay.js @@ -21,7 +21,7 @@ class EvaluateSuccessEffectDisplay extends Component { componentDidMount() { if (this.props.type == 'html') { const iframe = document.getElementById('_displayIframe') - if (iframe && iframe.contentWindow) { + if (iframe && iframe.contentWindow && this.props.iframe_src) { iframe.contentWindow.open() iframe.contentWindow.document.write(this.props.iframe_src); iframe.contentWindow.document.close(); diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 166bc6f57..58cd0c02b 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -278,7 +278,7 @@ class BoardsNew 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/courses/busyWork/CommonWorkPost.js b/public/react/src/modules/courses/busyWork/CommonWorkPost.js index 796249bcd..5b43a8237 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkPost.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkPost.js @@ -597,7 +597,7 @@ render(){ 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/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 4af4532dd..fb2d18de0 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -3,11 +3,11 @@ import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Moda import axios from 'axios' import '../css/busyWork.css' import '../css/Courses.css' -import { WordsBtn, getUrl, ConditionToolTip } from 'educoder' - +import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder' +import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import CBreadcrumb from '../common/CBreadcrumb' -import NewWorkForm from './NewWorkForm' +const confirm = Modal.confirm; const $ = window.$ const MAX_TITLE_LENGTH = 60; class NewWork extends Component{ @@ -17,6 +17,15 @@ 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, } } componentDidMount () { @@ -41,6 +50,7 @@ class NewWork extends Component{ course_id: data.course_id, course_name: data.course_name, category: data.category, + }) } }) @@ -55,29 +65,129 @@ class NewWork extends Component{ .then((response) => { if (response.data.name) { const data = response.data; - data.isEdit = true; - this.setState({ - category: data.category, - course_id: data.course_id, - course_name: data.course_name, + + 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' + } + }) + + 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 || '', + }); + }) - this.newWorkFormRef.initValue(data); + } }) .catch(function (error) { console.log(error); }); } - onCancel = () => { - this.props.toListPage(this.props.match.params, category.category_id) + + // 输入title + changeTitle=(e)=>{ + console.log(e.target.value.length); + this.setState({ + title_num: parseInt(e.target.value.length) + }) + } + 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 = (params) => { + doEdit = (courseId, values) => { 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, params) + 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 + }) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -88,11 +198,30 @@ class NewWork extends Component{ console.log(error); }); } - doNew = (params) => { - const courseId = this.props.match.params.coursesId ; + doNew = (courseId, values) => { const newUrl = `/courses/${courseId}/homework_commons.json` - axios.post(newUrl, params) + 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, + + min_num, + max_num, + base_on_project + }) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -103,26 +232,147 @@ class NewWork extends Component{ console.log(error); }); } + + handleContentUploadChange = (info) => { + let contentFileList = info.fileList; + this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) }); + } + handleAnswerUploadChange = (info) => { + let answerFileList = info.fileList; + this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) }); + } + onAttachmentRemove = (file, stateName) => { + if(file.response!=undefined){ + this.props.confirm({ + content: '是否确认删除?', + + onOk: () => { + this.deleteAttachment(file, stateName) + }, + onCancel() { + console.log('Cancel'); + }, + }); + + + return false; + } + + } + 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{ - category + 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 }=this.state const { current_user } = this.props - const courseId = this.props.match.params.coursesId ; + const courseId = this.state.course_id || this.props.match.params.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: `${getUrl()}/api/attachments.json`, + 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; + }, + }; + return(
- + {/*

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

*/}

- {this.newWorkFormRef = ref}} - {...this.props} - onCancel={this.onCancel} - doNew={this.doNew} - doEdit={this.doEdit} - > + {/* 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以内) + + + + + +
) } } -export default NewWork; \ No newline at end of file +const WrappedBoardsNew = Form.create({ name: 'NewWork' })(NewWork); +export default WrappedBoardsNew; \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js index 82cf1cea9..3b25ceb6d 100644 --- a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js +++ b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js @@ -257,7 +257,7 @@ class AccessoryModal 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/courses/coursesPublic/AccessoryModal2.js b/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js index efec92e0a..a9a627387 100644 --- a/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js +++ b/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js @@ -180,7 +180,7 @@ class AccessoryModal2 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/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index 3183c859f..d52b328e2 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -396,7 +396,7 @@ class Selectsetting 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/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index 1a46d9cf9..56c85439c 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -344,7 +344,7 @@ class Sendresource 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/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index 4f37ac816..74637571f 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -708,7 +708,14 @@ a.white-btn.use_scope-btn:hover{ color: #999!important; padding:0px 10px; } - +.orangeLine{ + background: #fff; + border:1px solid #FE944B; + color: #FE944B!important; + padding:0px 10px; + line-height: 28px; + border-radius: 4px; +} .colorFF6800{ color:#FF6800; diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index b958faa5c..2c56b8b58 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -332,17 +332,17 @@ class Testpapersettinghomepage extends Component{
{this.props.isAdmin()===true? - 答题列表 - 统计结果 - 试卷预览 - 设置 + 答题列表 + 统计结果 + 试卷预览 + 设置 : - 答题列表 + 答题列表 {Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true? - 统计结果:""} - 设置 + 统计结果:""} + 设置 }
@@ -370,7 +370,7 @@ class Testpapersettinghomepage extends Component{ padding-top: 10px; padding-bottom: 8px; } - a:hover { + .exercisesafonts:hover { color:#1A0B00 !important; } `} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index 467fdce25..0d5a756de 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -523,7 +523,7 @@ class GraduationTasksSubmitedit 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/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index 3dc1d699f..9ebefcaef 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -540,7 +540,7 @@ render(){ 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/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js index c5ef52e76..e8b076685 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js @@ -172,7 +172,7 @@ class GraduationTasksappraiseMainEditor 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/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 6e801251d..5e3e64841 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -297,7 +297,7 @@ class GraduationTasksedit 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/courses/graduation/tasks/GraduationTasksnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js index 0a0953150..3b6b60ac8 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js @@ -49,56 +49,55 @@ class GraduationTasksnew extends Component { } Commoninterface =(fileList)=>{ + let listid = [] + for (var list of fileList) { listid.push(list.response.id) } // if (GraduationTasksnewtype === true) { - this.props.form.validateFields((err, values) => { - if (!err) { + this.props.form.validateFields((err, values) => { if (values.tasktype === undefined) { this.ifHasAnchorJustScorll("tasktypes"); - // this.scrollToAnchors("tasktypes"); return } - if (values.name === undefined) { - this.scrollToAnchors("nametypes"); + this.ifHasAnchorJustScorll("nametypes"); return } - if (values.description === undefined) { - this.scrollToAnchors("descriptiontypes"); + this.ifHasAnchorJustScorll("descriptiontypes"); return - } else if (values.description.length > 5000) { - this.scrollToAnchors("descriptiontypes"); + }else if (values.description.length > 5000) { + this.ifHasAnchorJustScorll("descriptiontypes"); return } - // console.log('Received values of form: ', values); - // console.log(fileList); - const course_id = this.props.match.params.coursesId; - - let url = "/courses/" + course_id + "/graduation_tasks.json" - axios.post(url, { - task_type: parseInt(values.tasktype), - name: values.name, - description: values.description, - attachment_ids: listid, - } - ).then((response) => { - // if (response.status === 200) { - // GraduationTasksnewtype = false; - // this.goback(); - if(response!==undefined){ - this.goback() - } - // } - }).catch((error) => { - console.log(error) - }) - } + if (!err) { + // console.log('Received values of form: ', values); + // console.log(fileList); + const course_id = this.props.match.params.coursesId; + + let url = "/courses/" + course_id + "/graduation_tasks.json" + axios.post(url, { + task_type: parseInt(values.tasktype), + name: values.name, + description: values.description, + attachment_ids: listid, + } + ).then((response) => { + // if (response.status === 200) { + // GraduationTasksnewtype = false; + // this.goback(); + if(response!==undefined){ + this.goback() + } + // } + }).catch((error) => { + console.log(error) + }) + } - }); + }); // } } @@ -128,14 +127,16 @@ class GraduationTasksnew extends Component { } // 附件相关 START handleChange = (info) => { - let fileList = info.fileList; - - // for(var list of fileList ){ - // console.log(list) - // } - this.setState({ - fileList: appendFileSizeToUploadFileAll(fileList), - }); + if(info.file.status == "done" || info.file.status == "uploading"){ + let fileList = info.fileList; + + // for(var list of fileList ){ + // console.log(list) + // } + this.setState({ + fileList: appendFileSizeToUploadFileAll(fileList), + }); + } } // onAttachmentRemove = (file) => { @@ -202,10 +203,10 @@ class GraduationTasksnew extends Component { } //滚动 - ifHasAnchorJustScorll(anchor) { + ifHasAnchorJustScorll() { // let anchor = this.getURLStuff("anchor"); - // let anchor = this.state.anchor; + let anchor = this.state.anchor; // console.log("anchor ", anchor); // 对应id的话, 滚动到相应位置 if (!!anchor) { @@ -273,7 +274,7 @@ class GraduationTasksnew 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; }, @@ -360,7 +361,7 @@ class GraduationTasksnew extends Component { ` } - + {getFieldDecorator('tasktype', { rules: [{required: true, message: "请选择任务类型"}], })( this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} + onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} > - + {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { return ( indext >= 1 ? : "" @@ -3139,7 +3140,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/} this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} + onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} > diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index dd5a93534..dd694828a 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1100,7 +1100,7 @@ class ShixunHomework extends Component{ {course_modules&&course_modules.main_category.map((item,key)=>{ return( - datas&&datas.category_id===null?"":
  • this.moveTos(item.main_category_id)} title={item.main_category_name}>{item.main_category_name}
  • + datas&&datas.category_id===null?"":
  • this.moveTos(item.main_category_id)} title={item.main_category_name.length>18?item.main_category_name:""}>{item.main_category_name}
  • ) })} @@ -1109,10 +1109,10 @@ class ShixunHomework extends Component{ return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1) }).map( (item,key) => { if(datas&&datas.category_id!=null&&datas&&datas.category_id===item.category_id===false){ - return
  • this.moveTos(item.category_id )} title={item.category_name}>{item.category_name}
  • + return
  • this.moveTos(item.category_id )} title={item.category_name.length>18?item.category_name:""}>{item.category_name}
  • } if(datas&&datas.category_id===null){ - return
  • this.moveTos(item.category_id )} title={item.category_name}>{item.category_name}
  • + return
  • this.moveTos(item.category_id )} title={item.category_name.length>18?item.category_name:""}>{item.category_name}
  • } })} diff --git a/public/react/src/modules/moop_cases/CaseDetail.js b/public/react/src/modules/moop_cases/CaseDetail.js index 6e278307e..e99f6bab0 100644 --- a/public/react/src/modules/moop_cases/CaseDetail.js +++ b/public/react/src/modules/moop_cases/CaseDetail.js @@ -82,10 +82,10 @@ class CaseDetail extends Component{
    教学案例 > { CaseDetail.title}

    - + { CaseDetail.title} - + { CaseDetail.status == "pending" && 草稿 diff --git a/public/react/src/modules/moop_cases/CaseNew.js b/public/react/src/modules/moop_cases/CaseNew.js index 674d9c6cf..6d9e5b251 100644 --- a/public/react/src/modules/moop_cases/CaseNew.js +++ b/public/react/src/modules/moop_cases/CaseNew.js @@ -47,19 +47,18 @@ class CaseNew extends Component{ // 上传附件-删除确认框 onAttachmentRemove = (file, stateName) => { - if(file.response!=undefined){ - this.props.confirm({ - content: '是否确认删除?', - onOk: () => { - this.deleteAttachment(file, stateName) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - } - + if(file.response!=undefined){ + this.props.confirm({ + content: '是否确认删除?', + onOk: () => { + this.deleteAttachment(file, stateName) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } } // 上传附件-确认删除 @@ -279,7 +278,7 @@ class CaseNew extends Component{ beforeUpload: (file) => { const isLt150M = file.size / 1024 / 1024 < 150; if (!isLt150M) { - //message.error('文件大小必须小于150MB!'); + //this.props.showNotification('文件大小必须小于150MB!'); this.props.define({ title:'提示', content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里,然后再txt文档里给出链接以及共享密码并上传" @@ -383,7 +382,7 @@ class CaseNew extends Component{

    { checkTag &&
    请选择标签
    diff --git a/public/react/src/modules/moop_cases/CaseTags.js b/public/react/src/modules/moop_cases/CaseTags.js index 4b4f0670c..3d0c93a20 100644 --- a/public/react/src/modules/moop_cases/CaseTags.js +++ b/public/react/src/modules/moop_cases/CaseTags.js @@ -14,7 +14,17 @@ class CaseTags extends Component{ { tags && tags.map((item,key)=>{ return( - {item.name} + + { + item.name == "获奖案例" ? + {item.name} + : + item.name == "入库案例" ? + {item.name} + : + {item.name} + } + ) }) } diff --git a/public/react/src/modules/moop_cases/css/moopCases.css b/public/react/src/modules/moop_cases/css/moopCases.css index 47c98a833..7a58cee61 100644 --- a/public/react/src/modules/moop_cases/css/moopCases.css +++ b/public/react/src/modules/moop_cases/css/moopCases.css @@ -62,6 +62,13 @@ border: 1px solid #4CACFF; line-height: 17px; } +.edu-activity-orange-sub { + background-color: #FF781B; + color: #fff!important; + cursor: pointer; + border: 1px solid #ff6800; + line-height: 17px; +} .pointsBtn { width: 70px; diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index a0178c895..1782cff56 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -481,12 +481,13 @@ export function TPMIndexHOC(WrappedComponent) { } ` } + + + - -
    this.initCommonState(user)} {...this.props} {...this.state} @@ -497,11 +498,12 @@ export function TPMIndexHOC(WrappedComponent) {
    +
    - + ); } diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 8d4191b44..9a22269f6 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -916,7 +916,7 @@ class Newshixuns extends Component { // // console.log('beforeUpload', file.name); // const isLt50M = file.size / 1024 / 1024 < 50; // if (!isLt50M) { - // message.error('文件大小必须小于150MB!'); + // this.props.showNotification('文件大小必须小于150MB!'); // } // return isLt50M; // }, diff --git a/public/react/src/modules/tpm/shixunchild/Repository/Repository.js b/public/react/src/modules/tpm/shixunchild/Repository/Repository.js index c888ba6d8..ea9e51694 100644 --- a/public/react/src/modules/tpm/shixunchild/Repository/Repository.js +++ b/public/react/src/modules/tpm/shixunchild/Repository/Repository.js @@ -13,6 +13,7 @@ import axios from 'axios'; import { trace, trace_collapse ,getImageUrl, toPath} from "educoder"; import RepositoryDirectories from './RepositoryDirectories' +import RepositoryAddFile from './RepositoryAddFile' const $ = window.$; // 点击按钮复制功能 @@ -82,10 +83,10 @@ class Repository extends Component { Git使用指南 - + {/* */}
    - - 网址克隆: + { jsCopy() diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js new file mode 100644 index 000000000..79133f34c --- /dev/null +++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js @@ -0,0 +1,52 @@ +import React, { Component } from 'react'; +import { ActionBtn } from 'educoder' + +import { Form , Modal } from 'antd' + +class RepositoryAddFile extends Component { + constructor(props) { + super(props); + this.state={ + visible:false + } + } + + addFile = () =>{ + this.setState({ + visible:true + }) + } + cancelAdd = () =>{ + this.setState({ + visible:false + }) + } + render(){ + let { visible } = this.state + return( + + +添加文件 + +
    + +
    +
    + 取消 + 提交 +
    + + + ) + } +} +const WrappedRepositoryAddFile = Form.create({name: 'taskRepositoryAddFile'})(RepositoryAddFile); +// RouteHOC() +export default (WrappedRepositoryAddFile); \ No newline at end of file