diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 83b80bec4..bdcc3c96d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -482,7 +482,7 @@ class HomeworkCommonsController < ApplicationController publish_time = setting[:publish_time] == "" ? Time.now : setting[:publish_time] # 截止时间为空时取发布时间后一个月 - end_time = setting[:end_time] == "" ? Time.at(publish_time.to_time.to_i+30*24*3600) : setting[:end_time] + end_time = setting[:end_time] HomeworkGroupSetting.where(homework_common_id: @homework.id, course_group_id: setting[:group_id]). update_all(publish_time: publish_time, end_time: end_time) setting_group_ids << setting[:group_id] @@ -1170,7 +1170,7 @@ class HomeworkCommonsController < ApplicationController # 可立即截止的分班:统一设置则是用户管理的所有分班,否则是当前用户管理的分班中已发布且未截止的 charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班 group_ids = @homework.unified_setting ? charge_group_ids : - @homework.homework_group_settings.where(course_group_id: charge_group_ids).none_end.pluck(:course_group_id) + @homework.homework_group_settings.where(course_group_id: charge_group_ids).published_no_end.pluck(:course_group_id) @course_groups = @course.course_groups.where(id: group_ids) else tip_exception("没有可截止的分班") diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index fb7bd1a88..9afbdd3af 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -62,7 +62,7 @@ module CoursesHelper course_board = course.course_board "/courses/#{course.id}/boards/#{course_board.id}" when "course_group" - "/courses/#{course.id}/students" + "/courses/#{course.id}/course_groups" end end diff --git a/app/libs/wechat/app.rb b/app/libs/wechat/weapp.rb similarity index 100% rename from app/libs/wechat/app.rb rename to app/libs/wechat/weapp.rb diff --git a/app/models/homework_group_setting.rb b/app/models/homework_group_setting.rb index ae9491cb3..7a06d5a7a 100644 --- a/app/models/homework_group_setting.rb +++ b/app/models/homework_group_setting.rb @@ -6,6 +6,6 @@ class HomeworkGroupSetting < ApplicationRecord scope :none_published, -> {where("homework_group_settings.publish_time IS NULL OR homework_group_settings.publish_time > ?", Time.now)} scope :published_no_end, -> {where("homework_group_settings.publish_time IS NOT NULL AND homework_group_settings.publish_time < ? and homework_group_settings.end_time > ?", Time.now, Time.now)} - scope :none_end, -> {where("homework_group_settings.end_time IS NOT NULL AND homework_group_settings.end_time > ?", Time.now)} + scope :none_end, -> {where("homework_group_settings.end_time IS NULL or homework_group_settings.end_time > ?", Time.now)} end diff --git a/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder index 0765e303b..1fce12b77 100644 --- a/app/views/settings/show.json.jbuilder +++ b/app/views/settings/show.json.jbuilder @@ -2,9 +2,9 @@ json.setting do setting = @laboratory.laboratory_setting json.name setting.name || default_setting.name - json.nav_logo_url setting.nav_logo_url || default_setting.nav_logo_url - json.login_logo_url setting.login_logo_url || default_setting.login_logo_url - json.tab_logo_url setting.tab_logo_url || default_setting.tab_logo_url + json.nav_logo_url (setting.nav_logo_url || default_setting.nav_logo_url)&.[](1..-1) + json.login_logo_url (setting.login_logo_url || default_setting.login_logo_url)&.[](1..-1) + json.tab_logo_url (setting.tab_logo_url || default_setting.tab_logo_url)&.[](1..-1) json.navbar setting.navbar || default_setting.navbar diff --git a/public/react/src/common/course/WordsBtn.js b/public/react/src/common/course/WordsBtn.js index 85a85cfb6..68b278507 100644 --- a/public/react/src/common/course/WordsBtn.js +++ b/public/react/src/common/course/WordsBtn.js @@ -8,20 +8,20 @@ class WordsBtn extends Component { } render() { - let{to, href,targets, style2 }=this.props + let{to, href,targets, style2, style, className, ...others }=this.props return( { to==undefined&&targets==undefined ? {this.props.children}: targets!=undefined? {this.props.children} : {this.props.children} } diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js index 730a1bdce..8c5652838 100644 --- a/public/react/src/modules/courses/ListPageIndex.js +++ b/public/react/src/modules/courses/ListPageIndex.js @@ -33,6 +33,12 @@ const StudentsList= Loadable({ loader: () => import('./members/studentsList'), loading: Loading, }); +//分班列表 +const CourseGroupList= Loadable({ + loader: () => import('./members/CourseGroupList'), + loading: Loading, +}); + const Eduinforms= Loadable({ loader: () => import('./gradinforms/Eduinforms.js'), loading: Loading, @@ -234,7 +240,7 @@ class ListPageIndex extends Component{ > () + (props) => () } > diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 22a5fece1..9ae74699f 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -287,7 +287,8 @@ class BoardsNew extends Component{ const isAdmin = this.props.isAdmin() const courseId=this.props.match.params.coursesId; const boardId = this.props.match.params.boardId - const isCourseEnd = this.props.isCourseEnd() + const isCourseEnd = this.props.isCourseEnd(); + document.title=this.props.coursedata&&this.props.coursedata.name; return(
{/* fl with100 */} + { isAdmin && +
  • + 导出 + +
  • + } + + } + secondRowLeft={ + total_count ? : '' + } + onPressEnter={onPressEnter} + > + +
    + 未分班: + {none_group_member_count}个学生 + + {props.history.push(`/courses/${courseId}/course_groups/0`)}}>查看 +
    + + + {course_groups && !!course_groups.length ? +
    + + + +
    : + } +
    + + ) +} +export default CourseGroupList \ No newline at end of file diff --git a/public/react/src/modules/courses/members/CourseGroupListTable.js b/public/react/src/modules/courses/members/CourseGroupListTable.js new file mode 100644 index 000000000..84edb2fc5 --- /dev/null +++ b/public/react/src/modules/courses/members/CourseGroupListTable.js @@ -0,0 +1,219 @@ +import React, { useState, useEffect } from 'react' + +import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Badge, Popconfirm } from "antd"; +import axios from 'axios' + +import { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections } from 'educoder' +import ClipboardJS from 'clipboard' + +/** + 角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生 + course_members_count: 0 + id: 2441 + invite_code: "WUNX9K" + member_manager: "全部教师" + name: "e'e'e" +*/ + +const clipboardMap = {} +function CourseGroupListTable(props) { + const [serachValue, setSerachValue] = useState('') + + const courseId = props.match.params.coursesId + + useEffect(() => { + const course_groups = props.course_groups + if (!course_groups) { + return; + } + course_groups.forEach((record) => { + const id = record.id + debugger; + let _clipboard = new ClipboardJS(`.copyBtn_${id}`); + _clipboard.on('success', (e) => { + props.showNotification('复制成功') + }); + clipboardMap[id] = _clipboard + }) + return () => { + course_groups.forEach((record) => { + const id = record.id + + if (clipboardMap[id]) { + clipboardMap[id].destroy(); + clipboardMap[id] = null; + } + }) + } + }, [props.course_groups]) + function buildColumns() { + const columns=[{ + title: '序号', + dataIndex: 'id', + key: 'id', + align:'center', + width:"5%", + className:"color-grey-6", + render: (id, record, index) => { + return index + 1 + } + }, + { + title: '分班名称', + dataIndex: 'name', + key: 'name', + align:'center', + width:"25%", + className:"color-grey-6", + render: (name, record, index) => { + return 11 ? name : ''} onClick={() => onGoDetail(record)} style={''} + className="overflowHidden1" style2={{maxWidth: '180px', verticalAlign: 'bottom'}}> + {name} + } + }, + + { + title: '学生成员', + dataIndex: 'course_members_count', + key: 'course_members_count', + align:'center', + width:"8%", + className:"color-grey-6", + render: (course_members_count, record, index) => { + return course_members_count + } + } + ]; + if (!isNotMember) { + columns.push({ + title: '管理教师', + dataIndex: 'member_manager', + key: 'member_manager', + align:'center', + width:"27%", + className:"color-grey-6", + render: (member_manager, record, index) => { + return {record.subStringOfMember_manager || member_manager} + } + }) + const aCol = (isAdmin ? { + title: '邀请码', + dataIndex: 'invite_code', + key: 'invite_code', + align:'center', + width:"10%", + className:"color-grey-6", + render: (invite_code, record, index) => { + return invite_code + } + } : { + title: '你当前所在分班', + dataIndex: 'group', + key: 'group', + align:'center', + width:"20%", + className:"color-grey-6", + render: (invite_code, record, index) => { + return props.current_group_id == record.id && + } + }) + columns.push( aCol ); + } + + columns.push({ + title: '操作', + dataIndex: 'setting', + key: 'setting', + align:'center', + width:"25%", + className:"color-grey-6", + render: (none, record, index) => { + return + {!isCourseEnd && isAdmin && onDelete(record)} style={'grey'}>删除分班} + {isAdmin && 复制邀请码 } + {isStudent && addToDir(record)} style={''}>加入分班} + onGoDetail(record)} style={''}>查看 + + } + }) + + return columns + } + const addToDir = async (record) => { + const courseId = props.match.params.coursesId + const url = `/courses/${courseId}/join_course_group.json` + const course_group_id = record.id + + const response = await axios.post(url, { + course_group_id + }) + if (response && response.data.status == 0) { + props.showNotification('加入成功') + props.updataleftNavfun() + props.onOperationSuccess && props.onOperationSuccess() + } + } + + function onDelete(record) { + props.confirm({ + content:
    +
    该分班的学生将被移动到“未分班”
    +
    是否确认删除?
    +
    , + onOk: () => { + // const cid = this.props.match.params.coursesId + + const url = `/course_groups/${record.id}.json` + axios.delete(url) + .then((response) => { + if (response.data.status == 0) { + props.showNotification('删除成功') + props.onOperationSuccess && props.onOperationSuccess() + // props.history.push(response.data.right_url) + } + }) + .catch(function (error) { + console.log(error); + }); + } + }) + } + function onGoDetail(record) { + props.history.push(`/courses/${courseId}/course_groups/${record.id}`) + } + const isAdmin = props.isAdmin(); + const isSuperAdmin = props.isSuperAdmin(); + const isStudent = props.isStudent() + const isNotMember = props.isNotMember() + + + const isParent = true; + const isCourseEnd= props.isCourseEnd(); + + const course_groups = props.course_groups + const columns = buildColumns() + const dataSource = course_groups.map(item => { + return { + ...item, + subStringOfMember_manager : item.member_manager.length > 92 + ? item.member_manager.substring(0, 92) + '...' : null + } + }) + return ( + + + {/* onChange={onTableChange} */} +
    + +
    + ) +} +export default CourseGroupListTable \ No newline at end of file diff --git a/public/react/src/modules/courses/members/studentsList.css b/public/react/src/modules/courses/members/studentsList.css index ebab316a0..797305629 100644 --- a/public/react/src/modules/courses/members/studentsList.css +++ b/public/react/src/modules/courses/members/studentsList.css @@ -1,3 +1,4 @@ -.stu_table .ant-table-thead > tr > th, .stu_table .ant-table-tbody > tr > td { +.stu_table .ant-table-thead > tr > th, .stu_table .ant-table-tbody > tr > td, +.courseGroupList .ant-table-thead > tr > th, .courseGroupList .ant-table-tbody > tr > td { padding: 14px 6px; } \ No newline at end of file diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 3a5a55b71..9acc4c0bf 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -833,7 +833,7 @@ class studentsList extends Component{
    - {students && students.length && + {students && !!students.length &&
    }
    diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index e92a0e352..cd3d4448a 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -115,6 +115,7 @@ class PollDetailIndex extends Component{ const { current_user } = this.props; const isAdmin =this.props.isAdmin(); const isStudent = this.props.isStudent(); + document.title=this.props.coursedata&&this.props.coursedata.name; return(
    {/*

    */} diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 5aa7f8f72..10a9b00c7 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2765,6 +2765,7 @@ class PollNew extends Component { // console.log(this.state.projects===undefined?"":this.state.projects.poll_questions) var displaymysave = (mysave === true) ? "" : "display:none;"; + document.title=this.props.coursedata&&this.props.coursedata.name; return (
    {/*提示*/} diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js index 8254b148e..7cdab81a6 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js @@ -95,6 +95,7 @@ class ShixunWorkDetails extends Component { } render() { let{data}=this.state; + document.title=data&&data.course_name; return (
    diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 2667f1dd9..88682c5a6 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -310,7 +310,7 @@ class ShixunWorkReport extends Component { // let showAppraiseModals=this.props&&this.props.isAdminOrTeacher()===true?work_comment===null||work_comment===undefined?false:true:work_comment===null||work_comment===undefined?false:true; let showAppraiseModals=work_comment===null||work_comment===undefined?false:true; - + document.title=data&&data.course_name; return ( data===undefined?"":