diff --git a/app/controllers/ecs/course_managers_controller.rb b/app/controllers/ecs/course_managers_controller.rb index 714dac580..132a212d7 100644 --- a/app/controllers/ecs/course_managers_controller.rb +++ b/app/controllers/ecs/course_managers_controller.rb @@ -3,7 +3,8 @@ class Ecs::CourseManagersController < Ecs::CourseBaseController before_action :check_major_manager_permission!, only: [:create, :destroy] def create - @user = Ecs::CreateCourseManagerService.call(current_course, params[:user_id]) + Ecs::CreateCourseManagerService.call(current_course, params[:user_ids]) + render_ok rescue Ecs::CreateCourseManagerService::Error => ex render_error(ex.message) end diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 6be131d7a..dcbded6fe 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -692,7 +692,7 @@ class PollsController < ApplicationController else unified_setting = @poll.unified_setting end - show_result = params[:show_result].to_i + show_result = params[:show_result] un_anonymous = params[:un_anonymous] ? true : false # 统一设置或者分班为0,则更新问卷,并删除问卷分组 if unified_setting || (course_group_ids.size == 0) diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb new file mode 100644 index 000000000..efb114bdc --- /dev/null +++ b/app/controllers/templates_controller.rb @@ -0,0 +1,5 @@ +class TemplatesController < ApplicationController + def show + @template = EcTemplate.find_by_name!(params[:name]) + end +end \ No newline at end of file diff --git a/app/services/ecs/create_course_manager_service.rb b/app/services/ecs/create_course_manager_service.rb index 58e803bcf..4d3633bfd 100644 --- a/app/services/ecs/create_course_manager_service.rb +++ b/app/services/ecs/create_course_manager_service.rb @@ -3,27 +3,29 @@ class Ecs::CreateCourseManagerService < ApplicationService COURSE_MANAGER_COUNT_LIMIT = 2 # 课程管理员数量限制 - attr_reader :ec_course, :user_id + attr_reader :ec_course, :user_ids - def initialize(ec_course, user_id) + def initialize(ec_course, user_ids) @ec_course = ec_course - @user_id = user_id + @user_ids = user_ids end def call - user = User.find_by(id: params[:user_id]) - raise Error, '该用户不存在' if user.blank? + users_count = User.where(id: user_ids).count + raise Error, '用户不存在' if users_count != user_ids.size - if ec_course.ec_course_users.exists?(user_id: user.id) - raise Error, '该用户已经是该课程的管理员了' + if ec_course.ec_course_users.exists?(user_id: user_ids) + raise Error, '用户已经是该课程的管理员' end - if ec_course.ec_course_users.count >= COURSE_MANAGER_COUNT_LIMIT - raise Error, '该课程管理员数量已达上限' + if ec_course.ec_course_users.count + user_ids.size > COURSE_MANAGER_COUNT_LIMIT + raise Error, "课程管理员数量过多(最多#{COURSE_MANAGER_COUNT_LIMIT})" end - ec_course.ec_course_users.create!(user: user) - - user + ActiveRecord::Base.transaction do + user_ids.each do |user_id| + ec_course.ec_course_users.create!(user_id: user_id) + end + end end end \ No newline at end of file diff --git a/app/views/ecs/course_managers/create.json.jbuilder b/app/views/ecs/course_managers/create.json.jbuilder deleted file mode 100644 index ff7ff01e5..000000000 --- a/app/views/ecs/course_managers/create.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! 'ecs/shared/user', user: @user diff --git a/app/views/templates/show.json.jbuilder b/app/views/templates/show.json.jbuilder new file mode 100644 index 000000000..cff89037b --- /dev/null +++ b/app/views/templates/show.json.jbuilder @@ -0,0 +1,3 @@ +json.template do + json.partial! 'attachments/attachment_simple', attachment: @template.attachments.last +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2c02c6a79..847afaa83 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -818,6 +818,7 @@ Rails.application.routes.draw do post :feedback end end + resource :template, only: [:show] end namespace :admins do diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index c414df55a..70cc43f4c 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -661,6 +661,11 @@ class CoursesIndex extends Component{ (props) => () } > + () + } + > {/* 普通作业 */} () } > + () + } + > this.setState({moduleName: '参考答案'})} className={`${childModuleName == '参考答案' ? 'active' : '' } `} to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案} - - {this.props.isAdmin() ? this.setState({moduleName: '设置'})} className={`${childModuleName == '设置' ? 'active' : '' } `} style={{paddingLeft:'38px'}} - to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>设置: - "" - } + to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"} {/* { this.props.tabRightComponents } */} diff --git a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js index 68a16d89e..89c9df772 100644 --- a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js +++ b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js @@ -144,13 +144,11 @@ class WorkDetailPageHeader extends Component{ {view_answer == true && 参考答案} - {this.props.isAdmin()? + 设置: - "" - } + to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"} { this.props.tabRightComponents } diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index 2ed4bbaa8..35ef6fb84 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -371,7 +371,7 @@ class Elearning extends Component{
- 上次学至{last_shixun} + 上次学习内容{last_shixun}
diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index ca1e6eddf..7b3732c9f 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -104,6 +104,10 @@ class Exercisesetting extends Component{ if(this.props.Commonheadofthetestpaper!=undefined){ this.editSetting() } + + if(this.props.isAdmin() === false){ + this.cancelEdit() + } } componentDidUpdate = (prevProps) => { if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){ diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index 58d6e37e5..9dac05a36 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -720,7 +720,7 @@ class GraduationTasks extends Component{
  • { this.publish() }}>立即发布
  • { this.end() }}>立即截止
  • {course_public===true?
  • 设为公开
  • :""} -
  • this.ActionPoll()}>加入题库
  • + {/*
  • this.ActionPoll()}>加入题库
  • */} :""} diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index ef4257e2e..2f02113bc 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -447,7 +447,7 @@ onBoardsNew=()=>{ { course_public && course_public==1 ?
  • this.onDelete(2)}>设为公开
  • :"" } -
  • this.onDelete(3)}>加入题库
  • + {/*
  • this.onDelete(3)}>加入题库
  • */} {/*
  • 加入题库
  • */} diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index a30f63464..1b0b19d6f 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -16,7 +16,9 @@ import DownloadMessageysl from "../../modals/DownloadMessageysl"; import CreateGroupByImportModal from './modal/CreateGroupByImportModal' const Search =Input.Search; - +const TYPE_STUDENTS = 1 +const TYPE_COURSE_GOURP_PARENT = 2 +const TYPE_COURSE_GOURP_CHILD = 3 const buildColumns = (that,isParent) => { const { course_groups , sortedInfo } = that.state let showSorter = isParent==true @@ -581,6 +583,16 @@ class studentsList extends Component{ // console.log(paramsString); // console.log(checkBoxValues); // console.log(searchValue); + let pageType = TYPE_STUDENTS + if (this.props.match.path.endsWith('students')) { + + } else if (course_group_id) { + pageType = TYPE_COURSE_GOURP_PARENT + } else { + pageType = TYPE_COURSE_GOURP_CHILD + } + + return( {course_group_name || '未分班'} {isAdmin && invite_code && @@ -617,15 +629,21 @@ class studentsList extends Component{ searchPlaceholder={ '请输入姓名、学号进行搜索' } firstRowRight={ - { isSuperAdmin && + { + // pageType !== TYPE_STUDENTS && + isSuperAdmin && this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班 } - { !isCourseEnd && isAdmin && isParent && this.addDir()}>添加分班 } - { isAdmin && !isParent && course_group_id != 0 && this.deleteDir()}>删除分班 } - { isAdmin && !isParent && course_group_id != 0 && this.renameDir()}>分班重命名 } + { + // pageType !== TYPE_STUDENTS && + !isCourseEnd && isAdmin && isParent && this.addDir()}>添加分班 } + { + isAdmin && !isParent && course_group_id != 0 && this.deleteDir()}>删除分班 } + { + isAdmin && !isParent && course_group_id != 0 && this.renameDir()}>分班重命名 }
    - 计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')} + {/*计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}*/} {/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":*/} {/* {computeTimetype===true?*/} diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index f130ce0b8..3c4449b9f 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -250,10 +250,10 @@ class ShixunHomeworkPage extends Component { ` } :""} - {this.props.isAdmin() ? + this.ChangeTab(3)} - >设置:""} + >{this.props.isAdmin()?"设置":"得分规则"} {/*{this.props.isAdmin() ? {this.state.showmodel===true? {/*这里可以进行数据处理*/} -
    +
    { @@ -641,23 +641,24 @@ class MessagSub extends Component { })} - {/*页数*/} - {data === undefined ? "" - : - (count > 10 ? -
    -
    - -
    -
    : "" - ) - }
    + {/*页数*/} + {data === undefined ? "" + : + (count > 10 ? +
    +
    + +
    +
    : "" + ) + + }
    ) } diff --git a/public/react/src/modules/message/js/MessagePrivate.js b/public/react/src/modules/message/js/MessagePrivate.js index ec7c20121..dc8e32e67 100644 --- a/public/react/src/modules/message/js/MessagePrivate.js +++ b/public/react/src/modules/message/js/MessagePrivate.js @@ -8,6 +8,7 @@ import moment from 'moment'; import {getImageUrl,markdownToHTML} from 'educoder'; import "../css/messagemy.css" import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal'; +import NoneData from '../../../modules/courses/coursesPublic/NoneData' //私信页面 class MessagePrivate extends Component{ constructor(props) { @@ -160,11 +161,8 @@ class MessagePrivate extends Component{ { - data===undefined?"":data.length===0? -
    - -

    暂无数据哦~

    -
    + data===undefined? :data.length===0? + :data.map((item,key)=>{ return(
    this.smyJump(3,item.target.id)}> diff --git a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js index 279402e66..c30ec0386 100644 --- a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js +++ b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js @@ -21,8 +21,11 @@ function getNewTreeData(treeData, curKey, child, level) { data.forEach((item) => { // 这里不能用indexOf 同一级可能出现test目录和test.py文件 if (item.key == curKey) { - child = addPrePath(child, curKey); - item.children = child; + if (child && child.length) { // 可能没有子节点 + child = addPrePath(child, curKey); + item.children = child; + } + item.isLeaf = false; } else { if (item.children) { loop(item.children); @@ -153,6 +156,10 @@ class CodeRepositoryViewContainer extends Component { }); } map2OldData = (treeData) => { + if (!treeData || treeData.length == 0) { + return [] + } + if (!treeData || treeData.length === 0) return treeData; treeData = treeData.map(item => { return { diff --git a/public/react/src/modules/user/account/AccountSecure.js b/public/react/src/modules/user/account/AccountSecure.js index e5b03e36b..797b350d2 100644 --- a/public/react/src/modules/user/account/AccountSecure.js +++ b/public/react/src/modules/user/account/AccountSecure.js @@ -284,7 +284,7 @@ class AccountSecure extends Component {
    { basicInfo && basicInfo.phone ? - { regPhoneAndEmail(basicInfo.phone) } + { basicInfo.phone } : 未绑定 } @@ -348,7 +348,7 @@ class AccountSecure extends Component {
    { basicInfo && basicInfo.mail ? - { regPhoneAndEmail(basicInfo.mail) } + { basicInfo.mail } : 未绑定 } diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js index 76979c9f5..3b76bfa28 100644 --- a/public/react/src/modules/user/usersInfo/InfosTopics.js +++ b/public/react/src/modules/user/usersInfo/InfosTopics.js @@ -297,8 +297,8 @@ class InfosTopics extends Component{ let categorylist=[ {val:"普通作业",type:"normal"}, {val:"分组作业",type:"group"}, - {val:"毕设选题",type:"gtopic"}, - {val:"毕设任务",type:"gtask"}, + // {val:"毕设选题",type:"gtopic"}, + // {val:"毕设任务",type:"gtask"}, {val:"试卷",type:"exercise"}, {val:"问卷",type:"poll"}, ] diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index cb66434d0..dfda982f2 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -288,12 +288,22 @@ function InfoVideo (props) { 个视频 - {categoryObj.category == 'all' && } + {/*{categoryObj.category == 'all' && }*/} + + {categoryObj.category == 'all' &&
    +
  • + {sortKey=="published_at-desc"?"最新上传":"最早上传"} +
      +
    • onSortChange("published_at-desc",0)}>最新上传
    • +
    • onSortChange("published_at-asc",1)}>最早上传
    • +
    +
  • +
    }