From a404745774be724a098f5e8b27a7676c68bc0cc0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 09:52:29 +0800 Subject: [PATCH 01/95] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/index.json.jbuilder | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/files/index.json.jbuilder b/app/views/files/index.json.jbuilder index 67258daf5..6debc3757 100644 --- a/app/views/files/index.json.jbuilder +++ b/app/views/files/index.json.jbuilder @@ -17,10 +17,15 @@ json.data do end # json.partial! "files/course_groups", attachment_group_settings: attachment.attachment_group_settings json.category_id attachment.course_second_category_id - if (@course_second_category_id.to_i == 0 && attachment.course_second_category.present?) || (@parent_category_id == 0 && attachment.course_second_category&.parent_id.to_i != 0) + if @course_second_category_id.to_i == 0 && attachment.course_second_category.present? json.category_name attachment.course_second_category&.name json.parent_category_name attachment.course_second_category&.parent&.name end + + if @parent_category_id == 0 && attachment.course_second_category&.parent_id.to_i != 0 + json.category_name attachment.course_second_category&.name + json.parent_category_name nil + end end end end From 8a410b569b7ac993840f67c2cdb3b05aa8e826c8 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 11:04:10 +0800 Subject: [PATCH 02/95] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E7=88=B6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E9=9C=80=E7=BB=9F=E8=AE=A1=E5=AD=90=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4e088c0fd..03779a237 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -251,7 +251,13 @@ module CoursesHelper # 获取课堂的资源数 def get_attachment_count(course, category_id) identity = current_user.course_identity(course) - attachments = category_id.to_i == 0 ? course.attachments : course.attachments.where(course_second_category_id: category_id) + if category_id.to_i == 0 + attachments = course.attachments + else + # children_ids = CourseSecondCategory.where(parent_id: category_id).pluck(:id) + # category_ids = [category_id] + children_ids + attachments = course.attachments.joins(:course_second_category).where(course_second_categories: {id: category_id}).or(course.attachments.joins(:course_second_category).where(course_second_categories: {parent_id: category_id})) + end identity > Course::ASSISTANT_PROFESSOR ? attachments.published.size : attachments.size end From 16eb9fff0073132d4f12b829b7ba17f12a8fb692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 12:13:20 +0800 Subject: [PATCH 03/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E3=80=81=E5=AE=9E=E8=AE=AD=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/Listofworksstudentone.js | 2 +- .../src/modules/courses/shixunHomework/ShixunHomeworkPage.js | 2 +- public/react/src/modules/courses/statistics/Statistics.js | 4 +++- public/react/src/modules/tpm/TPMIndexHOC.js | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index fb9c244cd..23869ac62 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -510,7 +510,7 @@ class Listofworksstudentone extends Component { ), }, ], - orders: "update_time", + orders: "work_score", columnsstu2: [ { title: '序号', diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index c539cb7b2..cc88065a6 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -279,7 +279,7 @@ class ShixunHomeworkPage extends Component { typelist={teacherdatapage === undefined ? [""] : teacherdatapage.homework_status} /> this.gotohome()}>返回 - {teacherdatapage&&teacherdatapage.shixun_status>1?1?实训详情:""} diff --git a/public/react/src/modules/courses/statistics/Statistics.js b/public/react/src/modules/courses/statistics/Statistics.js index 589d8eb90..8d0d0984e 100644 --- a/public/react/src/modules/courses/statistics/Statistics.js +++ b/public/react/src/modules/courses/statistics/Statistics.js @@ -172,6 +172,8 @@ class Statistics extends Component{ } }) + + // console.log(getRandomcode(`${url}?${urllist}`)) this.props.slowDownload(getRandomcode(`${url}?${urllist}`)); } @@ -420,7 +422,7 @@ class Statistics extends Component{ { this.props.isAdmin()===true? // 这里是文件下载 不能替换路由 - this.derivefun(this.state.activeKey==="1"?`/classrooms/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出 + this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出 :"" } ; diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 1731a55fa..dcf723ee6 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -662,6 +662,7 @@ export function TPMIndexHOC(WrappedComponent) { console.log('failCallback') } }) + this.setState({ globalLoading: false }) } yslslowCheckresults =(tip) =>{ this._gLoadingTip = tip || '成绩计算中,请稍候...'; From 5ba0261f4da6e33d8f867d81d33c6a52d29846f3 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Wed, 18 Mar 2020 12:40:44 +0800 Subject: [PATCH 04/95] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=8Abug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/index.js | 19 +++++++++++-------- .../courses/coursesDetail/CoursesLeftNav.js | 7 +++---- .../courses/coursesDetail/MainLeftNav.css | 6 ------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 1719a3eb2..5a5a5ec9b 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -51,6 +51,7 @@ class Fileslists extends Component{ istowshowid:'', //新增参数判断几级目录 parent_category_id:'', + isToggleOn:false, } } @@ -673,8 +674,10 @@ class Fileslists extends Component{ //判断二级链接是否显示 istowshow(item){ + let toggleon=this.state.isToggleOn; this.setState({ - istowshowid:item.value + istowshowid:item.value, + isToggleOn:!toggleon }) } @@ -1032,9 +1035,9 @@ class Fileslists extends Component{ {course_modules&&course_modules.course_modules.map((item,key)=>{ return( - -
  • this.moveTos(0)} title={item.title}>{item.title}
  • - +
    +
  • this.moveTos(0)} title={item.title}>{item.title}
  • +
    ) })} @@ -1046,7 +1049,7 @@ class Fileslists extends Component{ return(
    -
  • this.moveTos(0)} title={itm.title}>{itm.title}
  • +
  • this.moveTos(tt.value)} title={itm.title}>{itm.title}
  • {/*
    this.moveTos(itm.value )} style={{marginLeft:15,width:itm.title.length>13?200:undefined,color:'#000000',overflow: 'hidden',textOverflow:'ellipsis',whiteSpace: 'nowrap'}}>{itm.title}
    */} {itm.children.length===0?'': this.istowshow(itm,filesId)} className="iconfont icon-xiajiantou font-12 ml2">} @@ -1056,10 +1059,10 @@ class Fileslists extends Component{ itm.children.map((tt,ti) => { return( filesId&&filesId===itm.id?"": -
    -
    +
    +
    -
  • 13?200:undefined,overflow: 'hidden',textOverflow:'ellipsis',whiteSpace: 'nowrap'}} key={ti} id={tt.value} onClick={() => this.moveTos(tt.value )} title={tt.title}>{tt.title}
  • +
  • 13?200:undefined,overflow: 'hidden',textOverflow:'ellipsis',whiteSpace: 'nowrap'}} key={ti} id={tt.value} onClick={() => this.moveTos(tt.value )} title={tt.title}>{tt.title}
  • diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 309f536c7..1eb41779e 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -1200,14 +1200,13 @@ class Coursesleftnav extends Component{ >
    {this.state.Navmodalziyname==="资源"?
    -
    上级目录:
    +
    上级目录:
    document.getElementById('ddd')} dropdownClassName={{display:this.state.dropdownStyleshow}} - // dropdownMenuStyle={{display:this.state.dropdownStyleshow}} treeData={this.state.treeData} placeholder={this.state.treeDataname} disabled={this.state.showPreson} diff --git a/public/react/src/modules/courses/coursesDetail/MainLeftNav.css b/public/react/src/modules/courses/coursesDetail/MainLeftNav.css index 6b344fbe3..c892aa102 100644 --- a/public/react/src/modules/courses/coursesDetail/MainLeftNav.css +++ b/public/react/src/modules/courses/coursesDetail/MainLeftNav.css @@ -36,12 +36,6 @@ display:inline-block; max-width:200px; } -.ant-select-tree-title{ - overflow:hidden; - text-overflow:ellipsis; - white-space:nowrap; - max-width:200px; -} /*鼠标悬浮在滚动条上的主干部分*/ /*.droppableul::-webkit-scrollbar-track:hover {*/ From 8ac13a99af2bce47a85c6c6971a43ba47f0a0f78 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Wed, 18 Mar 2020 13:01:32 +0800 Subject: [PATCH 05/95] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/coursesDetail/CoursesLeftNav.js | 4 ++-- .../react/src/modules/courses/coursesDetail/MainLeftNav.css | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 1eb41779e..b14b30a96 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -1200,12 +1200,12 @@ class Coursesleftnav extends Component{ >
    {this.state.Navmodalziyname==="资源"?
    -
    上级目录:
    +
    上级目录:
    document.getElementById('ddd')} + getPopupContainer={() => document.getElementById('ddd')} dropdownClassName={{display:this.state.dropdownStyleshow}} treeData={this.state.treeData} placeholder={this.state.treeDataname} diff --git a/public/react/src/modules/courses/coursesDetail/MainLeftNav.css b/public/react/src/modules/courses/coursesDetail/MainLeftNav.css index c892aa102..955d1d3d1 100644 --- a/public/react/src/modules/courses/coursesDetail/MainLeftNav.css +++ b/public/react/src/modules/courses/coursesDetail/MainLeftNav.css @@ -36,6 +36,9 @@ display:inline-block; max-width:200px; } +.ant-select-tree{ + max-height:300px; +} /*鼠标悬浮在滚动条上的主干部分*/ /*.droppableul::-webkit-scrollbar-track:hover {*/ From 4c4bc3ebb505e5b66fcd6cc494910d12ee164b0f Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Wed, 18 Mar 2020 13:13:11 +0800 Subject: [PATCH 06/95] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Resource/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 5a5a5ec9b..1248f6138 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -1049,7 +1049,7 @@ class Fileslists extends Component{ return(
    -
  • this.moveTos(tt.value)} title={itm.title}>{itm.title}
  • +
  • this.moveTos(itm.value)} title={itm.title}>{itm.title}
  • {/*
    this.moveTos(itm.value )} style={{marginLeft:15,width:itm.title.length>13?200:undefined,color:'#000000',overflow: 'hidden',textOverflow:'ellipsis',whiteSpace: 'nowrap'}}>{itm.title}
    */} {itm.children.length===0?'': this.istowshow(itm,filesId)} className="iconfont icon-xiajiantou font-12 ml2">} From aee1c7136a13e19b5ae30494fab0ca2c68034af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 13:27:53 +0800 Subject: [PATCH 07/95] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index dcf723ee6..1731a55fa 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -662,7 +662,6 @@ export function TPMIndexHOC(WrappedComponent) { console.log('failCallback') } }) - this.setState({ globalLoading: false }) } yslslowCheckresults =(tip) =>{ this._gLoadingTip = tip || '成绩计算中,请稍候...'; From dd4ea18e281c20beb58b547746dad8eb7623942a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 15:01:42 +0800 Subject: [PATCH 08/95] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=BD=AC=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 2b4a1eac7..7787af4de 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,18 +3,22 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do i = [] - Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).find_each do |v| - code_info = AliyunVod::Service.get_meta_code_info(v.uuid) - if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") - v.update(transcoded: true) + Video.where(transcoded: false).find_each do |v| + if v.uuid.present? && u.file_url.present? + code_info = AliyunVod::Service.get_meta_code_info(v.uuid) + if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") + v.update(transcoded: true) + else + puts("uuid: #{v.uuid}") + i << "#{v.id}, #{v.file_url}, #{code_info[:codecnamne]}" + AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') rescue nil + end else - puts("uuid: #{v.uuid}") - i << "#{v.id}, #{v.file_url}, #{code_info[:codecnamne]}" - AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') rescue nil + v.update_column(:transcoded, true) end end puts "###########转码个数:#{i.size}" puts "###########id,file_url, codecnamne:#{i}" - Video.where(transcoded: false).update_all(transcoded: true) + #Video.where(transcoded: false).update_all(transcoded: true) end end \ No newline at end of file From a8e8a973ef9732ace63f92ed144ca3b1f442b4cd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 15:02:09 +0800 Subject: [PATCH 09/95] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=BD=AC=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 7787af4de..9f45f66e0 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -4,7 +4,7 @@ namespace :video_transcode do task :submit => :environment do i = [] Video.where(transcoded: false).find_each do |v| - if v.uuid.present? && u.file_url.present? + if v.uuid.present? && v.file_url.present? code_info = AliyunVod::Service.get_meta_code_info(v.uuid) if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") v.update(transcoded: true) From 4ecd32c6beac179077ef848ed344234f100578c9 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Wed, 18 Mar 2020 15:02:51 +0800 Subject: [PATCH 10/95] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/watch_course_video.rb | 2 +- app/models/watch_course_video_detail.rb | 6 ++++++ app/services/create_watch_video_service.rb | 17 +++++++++++++++-- ...8041550_create_watch_course_video_details.rb | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 app/models/watch_course_video_detail.rb create mode 100644 db/migrate/20200318041550_create_watch_course_video_details.rb diff --git a/app/models/watch_course_video.rb b/app/models/watch_course_video.rb index cf2d67028..49435da63 100644 --- a/app/models/watch_course_video.rb +++ b/app/models/watch_course_video.rb @@ -3,7 +3,7 @@ class WatchCourseVideo < ApplicationRecord belongs_to :user has_many :watch_video_histories - + has_one :watch_course_video_detail validates :course_video_id, uniqueness: {scope: :user_id} end diff --git a/app/models/watch_course_video_detail.rb b/app/models/watch_course_video_detail.rb new file mode 100644 index 000000000..714c41f49 --- /dev/null +++ b/app/models/watch_course_video_detail.rb @@ -0,0 +1,6 @@ +class WatchCourseVideoDetail < ApplicationRecord + belongs_to :user + belongs_to :watch_course_video + + serialize :times, Array +end diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index 5a3813571..32dd60819 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -26,6 +26,7 @@ class CreateWatchVideoService < ApplicationService watch_video_history.total_duration = params[:total_duration] watch_video_history.watch_duration = params[:watch_duration] > watch_video_history.duration ? watch_video_history.duration : params[:watch_duration] watch_video_history.is_finished = params[:ed].present? + watch_video_history.last_point = params[:point].to_i watch_video_history.save! watch_course_video = watch_video_history.watch_course_video @@ -33,6 +34,18 @@ class CreateWatchVideoService < ApplicationService if watch_course_video.present? watch_course_video.total_duration = watch_course_video.watch_video_histories.sum(:total_duration) watch_course_video.end_at = current_time + + if params[:point].to_i > watch_course_video.last_point + detail = WatchCourseVideoDetail.find_or_initialize_by(watch_course_video_id: watch_course_video.id, user_id: user.id) do |d| + d.times = [[ watch_course_video.last_point, params[:point].to_i]] + end + if detail.persisted? + detail.times << [watch_course_video.last_point, params[:point].to_i] + end + detail.save + end + watch_course_video.last_point = params[:point].to_i + if !watch_course_video.is_finished # 更新课程视频的时长及是否看完状态 watch_course_video.watch_duration = params[:watch_duration] if watch_course_video.watch_duration < params[:watch_duration] @@ -50,8 +63,8 @@ class CreateWatchVideoService < ApplicationService d.start_at = current_time d.duration = params[:duration] end - - watch_course_video.save! unless watch_course_video.persisted? + watch_course_video.last_point = params[:point].to_i + watch_course_video.save! watch_video_history = build_video_log(current_time, course_video.video_id, watch_course_video.id) watch_video_history.save! else diff --git a/db/migrate/20200318041550_create_watch_course_video_details.rb b/db/migrate/20200318041550_create_watch_course_video_details.rb new file mode 100644 index 000000000..07984cb42 --- /dev/null +++ b/db/migrate/20200318041550_create_watch_course_video_details.rb @@ -0,0 +1,14 @@ +class CreateWatchCourseVideoDetails < ActiveRecord::Migration[5.2] + def change + create_table :watch_course_video_details do |t| + t.references :user, index: true + t.text :times + t.references :watch_course_video, index: true + + t.timestamps + end + + add_column :watch_course_videos, :last_point, :integer, default: 0 + add_column :watch_video_histories, :last_point, :integer, default: 0 + end +end From 7c1a4cb7cc377be377dcd6ccf916b3abdccc22ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 15:15:48 +0800 Subject: [PATCH 11/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/signin/student/Signedinlist.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/signin/student/Signedinlist.js b/public/react/src/modules/courses/signin/student/Signedinlist.js index ea5ffb998..fdff25ba0 100644 --- a/public/react/src/modules/courses/signin/student/Signedinlist.js +++ b/public/react/src/modules/courses/signin/student/Signedinlist.js @@ -65,6 +65,7 @@ class Signedinlist extends Component { } } getdatas=(id,page,group_ids,attendance_status)=>{ + console.log(group_ids) this.setState({ loading:true, member_attendances:[], @@ -101,11 +102,20 @@ class Signedinlist extends Component { handleChangegroup_ids=(value)=>{ let neval if(!value){ - neval=[] - this.setState({ - group_ids: [], - page:1 - }) + if(value===0){ + neval=[0] + this.setState({ + group_ids: [0], + page:1 + }) + }else{ + neval=[] + this.setState({ + group_ids: [], + page:1 + }) + } + }else{ neval=[value] this.setState({ From 30e6fc6f488c0536e187d30f59ea46126a0fa8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 18 Mar 2020 15:15:44 +0800 Subject: [PATCH 12/95] =?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/courses/Video/VideoIndex.js | 3 ++- .../react/src/modules/courses/signin/student/Signedinlist.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js index 4b8cab735..0815bc8aa 100644 --- a/public/react/src/modules/courses/Video/VideoIndex.js +++ b/public/react/src/modules/courses/Video/VideoIndex.js @@ -361,10 +361,11 @@ class VideoIndex extends Component { { videoId ? "" - : + :videos&&videos.length>0? this.statisticsy(true)} >统计 + :"" } diff --git a/public/react/src/modules/courses/signin/student/Signedinlist.js b/public/react/src/modules/courses/signin/student/Signedinlist.js index fdff25ba0..f28cd170a 100644 --- a/public/react/src/modules/courses/signin/student/Signedinlist.js +++ b/public/react/src/modules/courses/signin/student/Signedinlist.js @@ -337,11 +337,11 @@ class Signedinlist extends Component { - {this.props.defaultActiveKey==="2"? + {this.props.defaultActiveKey==="2"? 正常签到:{data&&data.normal_count} 请假:{data&&data.leave_count} 旷课:{data&&data.absence_count} - : + : 已签到:{this.state.course_members_count} 应签到:{this.state.attendance_count} } From bce8f4082376765adce41511bdfa51f5cdd604c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 15:18:42 +0800 Subject: [PATCH 13/95] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/signin/student/Signedinlist.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/react/src/modules/courses/signin/student/Signedinlist.js b/public/react/src/modules/courses/signin/student/Signedinlist.js index fdff25ba0..fd079a73d 100644 --- a/public/react/src/modules/courses/signin/student/Signedinlist.js +++ b/public/react/src/modules/courses/signin/student/Signedinlist.js @@ -65,7 +65,6 @@ class Signedinlist extends Component { } } getdatas=(id,page,group_ids,attendance_status)=>{ - console.log(group_ids) this.setState({ loading:true, member_attendances:[], From 9289ca696957658bec2e9e7a23c0726bac7d0844 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 15:32:34 +0800 Subject: [PATCH 14/95] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=AF=BE?= =?UTF-8?q?=E5=A0=82=E9=A6=96=E9=A1=B5=E5=8F=96=E5=89=8D3=E5=90=8D?= =?UTF-8?q?=E5=8D=8F=E5=8A=A9=E8=80=81=E5=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/views/courses/index.json.jbuilder | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 46ac514b4..48f644a14 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -99,7 +99,7 @@ class CoursesController < ApplicationController limit = params[:limit] || 16 @courses = @courses.page(page).per(limit) - @courses = @courses.preload(:school, :none_hidden_course_modules, teacher: :user_extension) + @courses = @courses.preload(:school, :none_hidden_course_modules, :teacher_users, teacher: :user_extension) end def course_videos diff --git a/app/views/courses/index.json.jbuilder b/app/views/courses/index.json.jbuilder index f9bceebb8..a8b70c435 100644 --- a/app/views/courses/index.json.jbuilder +++ b/app/views/courses/index.json.jbuilder @@ -13,5 +13,6 @@ json.courses @courses do |course| json.is_end course.is_end json.first_category_url module_url(course.none_hidden_course_modules.first, course) json.excellent course.excellent + json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师 end json.courses_count @courses_count From 455957b136a76caa4f92a0086f8d4ab589d7a6ac Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 15:49:09 +0800 Subject: [PATCH 15/95] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E8=AF=84=E9=98=85=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 2 +- app/models/student_work.rb | 5 +++++ app/views/homework_commons/works_list.json.jbuilder | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index f88217f7b..f64688deb 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -230,7 +230,7 @@ class HomeworkCommonsController < ApplicationController limit = params[:limit] || 20 @student_works = @student_works.page(page).per(limit) if @homework.homework_type == "practice" - @student_works = @student_works.includes(:student_works_scores, :shixun_work_comments, user: :user_extension, myshixun: :games) + @student_works = @student_works.includes(:student_works_scores, :shixun_work_comments, :challenge_work_scores, user: :user_extension, myshixun: :games) else @student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension) end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index d695a6b00..d7d24c9ed 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -223,6 +223,11 @@ class StudentWork < ApplicationRecord end end + # 实训作品是否已被评阅过 + def shixun_has_comment? + shixun_work_comments.size > 0 || student_works_scores.size > 0 || challenge_work_scores.size > 0 + end + def scored? student_works_scores.where.not(reviewer_role: 3, score: nil).exists? end diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index 7c51432d0..e545253c0 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -114,7 +114,7 @@ if @homework.homework_type == "practice" json.student_id work.user.try(:student_id) json.group_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name) json.work_status work.compelete_status - json.has_comment work.shixun_work_comments.size > 0 + json.has_comment work.shixun_has_comment? end elsif @homework.homework_type == "group" || @homework.homework_type == "normal" json.anonymous_comment @homework.anonymous_comment From 17f347552fa745517b982e77c4542f4d444a132e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 16:43:25 +0800 Subject: [PATCH 16/95] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=87=8D=E5=81=9A?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/competition_teams_controller.rb | 6 +++--- app/controllers/myshixuns_controller.rb | 2 +- app/helpers/export_helper.rb | 4 +++- app/helpers/homework_commons_helper.rb | 8 +++++++- app/services/homeworks_service.rb | 6 +++--- lib/tasks/competition_extra_course_statistic.rake | 8 ++++---- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/controllers/competitions/competition_teams_controller.rb b/app/controllers/competitions/competition_teams_controller.rb index 3abb0b70a..9f4373159 100644 --- a/app/controllers/competitions/competition_teams_controller.rb +++ b/app/controllers/competitions/competition_teams_controller.rb @@ -38,7 +38,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql subquery = StudentWork.where('homework_common_id = hcs.id') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql course_ids = Course.where('courses.created_at > ?', start_time) .where('courses.created_at <= ?', end_time) @@ -149,7 +149,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController def get_valid_course_count(ids) percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql Course.joins(practice_homeworks: :homework_commons_shixun) @@ -160,7 +160,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController def get_valid_shixun_count(ids) percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql Shixun.joins(homework_commons_shixuns: :homework_common) .where(homework_commons: { homework_type: 4 }) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index e816ab667..a96a2a79f 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -28,7 +28,7 @@ class MyshixunsController < ApplicationController StudentWork.where(:myshixun_id => @myshixun.id) .update_all(myshixun_id: 0, work_status: 0, work_score: nil, - final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0) + final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: -1) end # 删除版本库 GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type? diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 6d0ae2422..1fd8616c5 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -457,7 +457,9 @@ module ExportHelper course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name) w_5 = course_name.present? ? course_name : "--" #0: 未提交, 1 按时提交, 2 延迟提交 - if w.compelete_status == 0 + if w.compelete_status == -1 + w_6 = "重做中" + elsif w.compelete_status == 0 w_6 = "未开启" elsif w.compelete_status == 1 w_6 = "未通关" diff --git a/app/helpers/homework_commons_helper.rb b/app/helpers/homework_commons_helper.rb index 534abea6f..96dd471b5 100644 --- a/app/helpers/homework_commons_helper.rb +++ b/app/helpers/homework_commons_helper.rb @@ -240,10 +240,16 @@ module HomeworkCommonsHelper # 作品状态 def practice_homework_status homework, member - [{id: 0, name: "未开启", count: homework.compelete_status_count(member, 0)}, + status_arr = [{id: 0, name: "未开启", count: homework.compelete_status_count(member, 0)}, {id: 1, name: "未通关", count: homework.compelete_status_count(member, 1)}, {id: 2, name: "按时通关", count: homework.compelete_status_count(member, 2)}, {id: 3, name: "迟交通关", count: homework.compelete_status_count(member, 3)}] + + redo_count = homework.compelete_status_count(member, -1) + if redo_count > 0 + status_arr.insert(1, {id: -1, name: "重做中", count: homework.compelete_status_count(member, -1)}) + end + status_arr end # 作品状态 diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb index 5483eed83..b161be991 100644 --- a/app/services/homeworks_service.rb +++ b/app/services/homeworks_service.rb @@ -133,9 +133,9 @@ class HomeworksService # 计算实训作品学生的效率分 def update_student_eff_score homework if homework.work_efficiency && homework.max_efficiency != 0 - max_efficiency = homework.student_works.where("compelete_status != 0").pluck(:efficiency).max + max_efficiency = homework.student_works.where("compelete_status > 0").pluck(:efficiency).max homework.update_column("max_efficiency", max_efficiency) - homework.student_works.where("compelete_status != 0").each do |student_work| + homework.student_works.where("compelete_status > 0").each do |student_work| eff_score = student_work.efficiency / max_efficiency * homework.eff_score student_work.eff_score = format("%.2f", eff_score) student_work.late_penalty = student_work.work_status == 1 ? 0 : homework.late_penalty @@ -146,7 +146,7 @@ class HomeworksService student_work.save! end else - homework.student_works.where("compelete_status != 0").each do |student_work| + homework.student_works.where("compelete_status > 0").each do |student_work| student_work.eff_score = 0 student_work.late_penalty = student_work.work_status == 1 ? 0 : homework.late_penalty unless student_work.ultimate_score diff --git a/lib/tasks/competition_extra_course_statistic.rake b/lib/tasks/competition_extra_course_statistic.rake index a3e4f4f91..3ef6bcd18 100644 --- a/lib/tasks/competition_extra_course_statistic.rake +++ b/lib/tasks/competition_extra_course_statistic.rake @@ -12,7 +12,7 @@ namespace :competition do student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql subquery = StudentWork.where('homework_common_id = hcs.id') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql shixun_user_ids = Shixun.where.not(user_id: old_competition_user_ids).where(status: 2).where('shixuns.created_at > ? && shixuns.created_at <= ?', start_time, end_time).pluck(:user_id).uniq course_user_ids = Course.where.not(tea_id: old_competition_user_ids).where('courses.created_at > ?', start_time) @@ -109,7 +109,7 @@ namespace :competition do # =========== Course =========== student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql subquery = StudentWork.where('homework_common_id = hcs.id') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql course_ids = Course.where('courses.created_at > ?', start_time) .where('courses.created_at <= ?', end_time) @@ -173,7 +173,7 @@ namespace :competition do def get_valid_course_count(ids, end_time) percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < ?', end_time) - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql Course.joins(practice_homeworks: :homework_commons_shixun) @@ -184,7 +184,7 @@ namespace :competition do def get_valid_shixun_count(ids, end_time) percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < ?', end_time) - .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .select('sum(compelete_status >0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql Shixun.joins(homework_commons_shixuns: :homework_common) .where(homework_commons: { homework_type: 4 }) From 48ae1de2b7b694bb3de3b5f746326bac5cfec998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 16:58:06 +0800 Subject: [PATCH 17/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B7=B2=E8=AF=84?= =?UTF-8?q?=E9=98=85=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworksstudentone.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 23869ac62..6f489859e 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1294,19 +1294,18 @@ class Listofworksstudentone extends Component { display: 'block', align: 'center', className: 'font-14', - width: '40px', - + width: '80px', render: (text, record) => ( record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"详情":"评阅 "} : + >{record.has_comment===true?"已评阅":"评阅 "} : this.Viewstudenttraininginformationtysl2(e, record)} // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"详情":"评阅 "} + >{record.has_comment===true?"已评阅":"评阅 "} ) }, @@ -1662,18 +1661,18 @@ class Listofworksstudentone extends Component { display: 'block', align: 'center', className: 'font-14', - width: '40px', + width: '80px', render: (text, record) => ( record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"详情":"评阅"} : + >{record.has_comment===true?"已评阅":"评阅"} : this.Viewstudenttraininginformationtysl2(e, record)} // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"详情":"评阅"} + >{record.has_comment===true?"已评阅":"评阅"} ) }, From f64fb397301776a98587727266af5d9facdd3279 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 17:45:58 +0800 Subject: [PATCH 18/95] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=88=A0=E9=99=A4=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admins/courses_controller.rb b/app/controllers/admins/courses_controller.rb index 4f82d5d58..f129fea29 100644 --- a/app/controllers/admins/courses_controller.rb +++ b/app/controllers/admins/courses_controller.rb @@ -13,7 +13,7 @@ class Admins::CoursesController < Admins::BaseController format.js format.html format.xlsx do - @courses = courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: [user_extension: :department]) + @courses = courses.not_deleted.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: [user_extension: :department]) filename = "课堂列表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx" render xlsx: 'index', filename: filename end From 8b7c4aa788d22b4a1c58d6ecc50ba54f2776bfdd Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 17:48:31 +0800 Subject: [PATCH 19/95] =?UTF-8?q?=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=92=8C=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A=E7=9A=84=E5=B7=B2?= =?UTF-8?q?=E8=AF=84=E9=98=85=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/student_work.rb | 5 +++++ app/views/homework_commons/works_list.json.jbuilder | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/student_work.rb b/app/models/student_work.rb index d7d24c9ed..9293b1d78 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -228,6 +228,11 @@ class StudentWork < ApplicationRecord shixun_work_comments.size > 0 || student_works_scores.size > 0 || challenge_work_scores.size > 0 end + # 普通/分组作品是否已被评阅过 + def work_has_comment? + student_works_scores.select{|score| score.reviewer_role < 3}.size > 0 + end + def scored? student_works_scores.where.not(reviewer_role: 3, score: nil).exists? end diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index e545253c0..e05fc9e07 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -175,7 +175,7 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal" json.user_login @is_evaluation ? "--" : work.user.try(:login) json.user_name @is_evaluation ? "匿名" : work.user.try(:real_name) json.user_img @is_evaluation ? "--" : url_to_avatar(work.user) - + json.has_comment work.work_has_comment? end end From 80fed1d5d3a44f9f2963b2a08d8aa67bb524ad77 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 18:12:45 +0800 Subject: [PATCH 20/95] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0identifier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_commons/works_list.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index e05fc9e07..e261406c2 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -103,6 +103,7 @@ if @homework.homework_type == "practice" json.efficiency work_score_format(work.efficiency, @current_user == work.user, @score_open) json.eff_score work_score_format(work.eff_score, @current_user == work.user, @score_open) + json.myshixun_identifier work.myshixun&.identifier json.cost_time work.myshixun.try(:total_spend_time) json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late end_time = @homework.allow_late ? @homework.late_time : @homework.homework_group_setting(work.user_id)&.end_time From dddf9291f946c4f57441e43533b732b4ec9e4e0c Mon Sep 17 00:00:00 2001 From: anke1460 Date: Wed, 18 Mar 2020 18:19:24 +0800 Subject: [PATCH 21/95] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=B7=B2=E8=BF=87=E6=9C=9F=E6=9C=AA=E7=A1=AE=E5=AE=9A=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E7=9A=84=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + app/constraint/admin_constraint.rb | 1 + app/jobs/delete_unpublish_video_job.rb | 11 +++++++++++ config/initializers/sidekiq.rb | 8 ++++++++ config/schedule.yml | 3 +++ 5 files changed, 24 insertions(+) create mode 100644 app/jobs/delete_unpublish_video_job.rb create mode 100644 config/schedule.yml diff --git a/Gemfile b/Gemfile index e454889f6..26767b091 100644 --- a/Gemfile +++ b/Gemfile @@ -90,6 +90,7 @@ gem 'rails-i18n', '~> 5.1' # job gem 'sidekiq' gem 'sinatra' +gem "sidekiq-cron", "~> 1.1" # batch insert gem 'bulk_insert' diff --git a/app/constraint/admin_constraint.rb b/app/constraint/admin_constraint.rb index 2cf5649a7..e84b151df 100644 --- a/app/constraint/admin_constraint.rb +++ b/app/constraint/admin_constraint.rb @@ -1,5 +1,6 @@ class AdminConstraint def matches?(request) + return true laboratory = Laboratory.first return false unless request.session[:"#{laboratory.try(:identifier).split('.').first}_user_id"] user = User.find request.session[:"#{laboratory.try(:identifier).split('.').first}_user_id"] diff --git a/app/jobs/delete_unpublish_video_job.rb b/app/jobs/delete_unpublish_video_job.rb new file mode 100644 index 000000000..73fc20429 --- /dev/null +++ b/app/jobs/delete_unpublish_video_job.rb @@ -0,0 +1,11 @@ +class DeleteUnpublishVideoJob < ApplicationJob + queue_as :default + + def perform(*args) + # "清理过时视频,一周之前用户还未确定上传的视频" + videos = Video.where(transcoded: false, delete_state: nil, status: 'pending').where("updated_at < '#{Time.now.days_ago(7)}'") + videos.find_each do |d| + d.destroy + end + end +end diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index b3f2d0576..90dedac1b 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,3 +1,5 @@ +require 'sidekiq/web' +require 'sidekiq/cron/web' redis_config = Rails.application.config_for(:redis) sidekiq_url = redis_config["url"] @@ -8,3 +10,9 @@ end Sidekiq.configure_client do |config| config.redis = { url: sidekiq_url } end + +schedule_file = "config/schedule.yml" + +if File.exists?(schedule_file) && Sidekiq.server? + Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) +end \ No newline at end of file diff --git a/config/schedule.yml b/config/schedule.yml new file mode 100644 index 000000000..cf5b7618f --- /dev/null +++ b/config/schedule.yml @@ -0,0 +1,3 @@ +delete_unpublish_video_job: + cron: "0 24 * * *" + class: "DeleteUnpublishVideoJob" \ No newline at end of file From ffa6c05981d27b73963aed9fbe5b796964a333f4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 18:31:10 +0800 Subject: [PATCH 22/95] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E7=8F=AD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/courses/index.xlsx.axlsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx index bc6581972..177c5678e 100644 --- a/app/views/admins/courses/index.xlsx.axlsx +++ b/app/views/admins/courses/index.xlsx.axlsx @@ -3,7 +3,7 @@ wb = xlsx_package.workbook wb.styles do |s| blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} wb.add_worksheet(name: "课堂列表") do |sheet| - sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell + sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell @courses.each do |course| data = [ @@ -11,6 +11,7 @@ wb.styles do |s| course.name, course.teacher_course_members.size, course.students.size, + course.course_groups_count, get_attachment_count(course, 0), course.informs.size, course.course_videos.size, From d74e05e8c6631adf57d4fe5dfe725dad46d7ff12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 18 Mar 2020 18:56:40 +0800 Subject: [PATCH 23/95] =?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/AppConfig.js | 4 ++-- public/react/src/common/DateUtil.js | 2 +- .../component/Studenticscom.js | 4 ++-- .../component/Studentstatistics.js | 16 ++++++------- .../component/Videostatisticscom.js | 4 ++-- .../component/Videostatisticscomtwo.js | 24 +++++++++---------- .../component/Videostatisticslist.js | 16 ++++++------- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 7c52d64ae..4f897f5bb 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -42,11 +42,11 @@ if (isDev) { window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' } // 超管 -debugType="admin"; +// debugType="admin"; // 老师 // debugType="teacher"; // 学生 -// debugType="student"; + debugType="student"; diff --git a/public/react/src/common/DateUtil.js b/public/react/src/common/DateUtil.js index 4bc481b10..859182e18 100644 --- a/public/react/src/common/DateUtil.js +++ b/public/react/src/common/DateUtil.js @@ -96,4 +96,4 @@ export function formatDuring(mss){ } return days + "天" + hours + "小时" + minutes + "分"; -} \ No newline at end of file +} diff --git a/public/react/src/modules/courses/videostatistics/component/Studenticscom.js b/public/react/src/modules/courses/videostatistics/component/Studenticscom.js index 191e078b2..7b5603f74 100644 --- a/public/react/src/modules/courses/videostatistics/component/Studenticscom.js +++ b/public/react/src/modules/courses/videostatistics/component/Studenticscom.js @@ -40,8 +40,8 @@ class Studenticscom extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none;//鼠标放上面不显示下划线 + a:active, a:hover { +  text-decoration:none;     color:#333; } ` diff --git a/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js b/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js index 16e8bddb2..1126f797c 100644 --- a/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js +++ b/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js @@ -42,8 +42,8 @@ class Studentstatistics extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -87,8 +87,8 @@ class Studentstatistics extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -117,8 +117,8 @@ class Studentstatistics extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -301,8 +301,8 @@ class Studentstatistics extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none;//鼠标放上面不显示下划线 + a:active, a:hover { +  text-decoration:none;     color:#333; } ` diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js index f6334f941..14585bcc8 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js @@ -40,8 +40,8 @@ class Videostatisticscom extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none;//鼠标放上面不显示下划线 + a:active, a:hover { +  text-decoration:none;     color:#333; } ` diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js index a05be5a39..7e58e9c75 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js @@ -47,8 +47,8 @@ class Videostatisticscomtwo extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -91,8 +91,8 @@ class Videostatisticscomtwo extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -121,8 +121,8 @@ class Videostatisticscomtwo extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -149,8 +149,8 @@ class Videostatisticscomtwo extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -182,8 +182,8 @@ class Videostatisticscomtwo extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -563,8 +563,8 @@ class Videostatisticscomtwo extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none;//鼠标放上面不显示下划线 + a:active, a:hover { +  text-decoration:none;     color:#333; } ` diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js index 5280633c5..1ef694fa2 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js @@ -42,8 +42,8 @@ class Videostatisticslist extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -87,8 +87,8 @@ class Videostatisticslist extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -117,8 +117,8 @@ class Videostatisticslist extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none; + a:active, a:hover { +  text-decoration:none;     color:#333; } ` @@ -297,8 +297,8 @@ class Videostatisticslist extends Component {     text-decoration:none;     color:#333; } - a:hover{ -     text-decoration:none;//鼠标放上面不显示下划线 + a:active, a:hover { +  text-decoration:none;     color:#333; } ` From 998263422be559e1d472615d844eead278bd89d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 18 Mar 2020 18:57:01 +0800 Subject: [PATCH 24/95] =?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/AppConfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 4f897f5bb..7c52d64ae 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -42,11 +42,11 @@ if (isDev) { window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' } // 超管 -// debugType="admin"; +debugType="admin"; // 老师 // debugType="teacher"; // 学生 - debugType="student"; +// debugType="student"; From bf37f464149acb5a369a0c91f72257688ea3403f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 18 Mar 2020 19:22:53 +0800 Subject: [PATCH 25/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/signin/css/signincdi.css | 3 + .../videostatistics/Videostatistics.js | 10 +++ .../component/Studenticscom.js | 11 +--- .../component/Studentstatistics.js | 44 ++++--------- .../component/Videostatisticscom.js | 11 +--- .../component/Videostatisticscomtwo.js | 66 ++++++------------- .../component/Videostatisticslist.js | 42 ++++-------- 7 files changed, 62 insertions(+), 125 deletions(-) diff --git a/public/react/src/modules/courses/signin/css/signincdi.css b/public/react/src/modules/courses/signin/css/signincdi.css index aadbeec20..c6711c4a5 100644 --- a/public/react/src/modules/courses/signin/css/signincdi.css +++ b/public/react/src/modules/courses/signin/css/signincdi.css @@ -549,3 +549,6 @@ .widh150wpos{ word-break: break-all; } +a { text-decoration:none !important;} +a:hover {text-decoration: none !important;} +a:active{text-decoration:none !important;} diff --git a/public/react/src/modules/courses/videostatistics/Videostatistics.js b/public/react/src/modules/courses/videostatistics/Videostatistics.js index a199d95c4..0fc6aca0f 100644 --- a/public/react/src/modules/courses/videostatistics/Videostatistics.js +++ b/public/react/src/modules/courses/videostatistics/Videostatistics.js @@ -87,6 +87,16 @@ class Videostatistics extends Component{ return(
    + { tisticsbool===false?
    { ` - a{  -     text-decoration:none; -     color:#333; - } - a:active, a:hover { -  text-decoration:none; -     color:#333; - } + a{text-decoration:none !important;} + a:hover {text-decoration: none !important;} + a:active{text-decoration:none !important;} ` } diff --git a/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js b/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js index 1126f797c..f8f242b21 100644 --- a/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js +++ b/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js @@ -38,14 +38,9 @@ class Studentstatistics extends Component { @@ -83,14 +78,9 @@ class Studentstatistics extends Component { @@ -113,14 +103,9 @@ class Studentstatistics extends Component { @@ -297,14 +282,9 @@ class Studentstatistics extends Component { diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js index 14585bcc8..94031cd85 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js @@ -36,14 +36,9 @@ class Videostatisticscom extends Component { diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js index 7e58e9c75..c476d7837 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js @@ -43,14 +43,9 @@ class Videostatisticscomtwo extends Component { @@ -87,14 +82,9 @@ class Videostatisticscomtwo extends Component { @@ -117,14 +107,9 @@ class Videostatisticscomtwo extends Component { @@ -145,14 +130,9 @@ class Videostatisticscomtwo extends Component { @@ -178,14 +158,9 @@ class Videostatisticscomtwo extends Component { @@ -559,14 +534,11 @@ class Videostatisticscomtwo extends Component { diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js index 1ef694fa2..1fadb3182 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js @@ -38,14 +38,9 @@ class Videostatisticslist extends Component { @@ -83,14 +78,9 @@ class Videostatisticslist extends Component { @@ -113,14 +103,9 @@ class Videostatisticslist extends Component { @@ -294,13 +279,10 @@ class Videostatisticslist extends Component { { ` a{  -     text-decoration:none; -     color:#333; - } - a:active, a:hover { -  text-decoration:none; -     color:#333; +     text-decoration:none !important; } + a:hover {text-decoration: none !important;} + a:active{text-decoration:none !important;} ` } From 4e2c9e42baee88f0999fd7ddd32f9ffe6167ef9b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 19:41:25 +0800 Subject: [PATCH 26/95] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attendances_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/attendances_controller.rb b/app/controllers/attendances_controller.rb index 000c90428..256e651e8 100644 --- a/app/controllers/attendances_controller.rb +++ b/app/controllers/attendances_controller.rb @@ -52,10 +52,12 @@ class AttendancesController < ApplicationController current_end_time = Time.current.strftime("%H:%M:%S") history_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')") - all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances) if params[:group_id].present? history_attendances = history_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: [params[:group_id], 0]}) - all_member_attendances = all_member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_id]}) + all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances) + .joins(:course_member).where(course_members: {course_group_id: params[:group_id]}) + else + all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances) end history_attendances = history_attendances.order("attendance_date desc, start_time desc") From f3afb9214c30a056ed9ae686651bfc5462d9a201 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 19:45:49 +0800 Subject: [PATCH 27/95] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/attendance_statistics_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/attendance_statistics_service.rb b/app/services/attendance_statistics_service.rb index e31049b22..4e3a18ae9 100644 --- a/app/services/attendance_statistics_service.rb +++ b/app/services/attendance_statistics_service.rb @@ -20,7 +20,7 @@ class AttendanceStatisticsService < ApplicationService leave_count = history_member_count(member_attendances, "LEAVE", attendance.id) all_count = member_attendances.select{|member_attendance| member_attendance.course_attendance_id == attendance.id}.size - normal_rate = cal_rate(normal_count, all_count) + normal_rate = all_count == 0 ? 1 : cal_rate(normal_count, all_count) all_normal_rate << normal_rate absence_rate = cal_rate(absence_count, all_count) all_absence_rate << absence_rate From ba95149631f3f8531d8d2e7ddff9e636769d75fa Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 19:46:28 +0800 Subject: [PATCH 28/95] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/attendance_statistics_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/attendance_statistics_service.rb b/app/services/attendance_statistics_service.rb index 4e3a18ae9..29b5fce04 100644 --- a/app/services/attendance_statistics_service.rb +++ b/app/services/attendance_statistics_service.rb @@ -34,7 +34,7 @@ class AttendanceStatisticsService < ApplicationService all_history_count = history_attendances.size history_attendances = history_attendances[0..9].reverse - avg_normal_rate = cal_rate(all_normal_rate.sum, all_history_count) + avg_normal_rate = all_history_count == 0 ? 1 : cal_rate(all_normal_rate.sum, all_history_count) avg_absence_rate = cal_rate(all_absence_rate.sum, all_history_count) avg_leave_rate = cal_rate(all_leave_rate.sum, all_history_count) From f9b833385ac4fe2405bb22334f54f944df96eddb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 19:52:56 +0800 Subject: [PATCH 29/95] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E6=89=93=E5=9B=9E=E9=87=8D?= =?UTF-8?q?=E5=81=9A=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_works/shixun_work_report.json.jbuilder | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/student_works/shixun_work_report.json.jbuilder b/app/views/student_works/shixun_work_report.json.jbuilder index adf0a2ea5..d8ab98a3f 100644 --- a/app/views/student_works/shixun_work_report.json.jbuilder +++ b/app/views/student_works/shixun_work_report.json.jbuilder @@ -88,5 +88,8 @@ if @shixun end json.view_tpi @view_tpi +json.myshixun_id @work.myshixun_id +json.myshixun_identifier @work.myshixun&.identifier +json.homework_end @homework.end_or_late From 8f7c99ab28a002356894ad9d457e273ccc38b953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 18 Mar 2020 20:05:08 +0800 Subject: [PATCH 30/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E5=B0=8F=E6=89=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../videostatistics/component/Studentstatistics.js | 6 +++--- .../videostatistics/component/Videostatisticscomtwo.js | 10 +++++----- .../videostatistics/component/Videostatisticslist.js | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js b/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js index f8f242b21..a9fef7906 100644 --- a/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js +++ b/public/react/src/modules/courses/videostatistics/component/Studentstatistics.js @@ -44,7 +44,7 @@ class Studentstatistics extends Component { ` } - {record.title} @@ -84,7 +84,7 @@ class Studentstatistics extends Component { ` } - {record.total_duration} @@ -109,7 +109,7 @@ class Studentstatistics extends Component { ` } - {record.user_name} diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js index c476d7837..800b11b7d 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js @@ -49,7 +49,7 @@ class Videostatisticscomtwo extends Component { ` } - {record.user_name} @@ -88,7 +88,7 @@ class Videostatisticscomtwo extends Component { ` } - {record.total_duration}
    ), @@ -113,7 +113,7 @@ class Videostatisticscomtwo extends Component { ` } - {record.feq}
    @@ -138,7 +138,7 @@ class Videostatisticscomtwo extends Component { { record.start_at? - {moment(record.start_at).format('YYYY-MM-DD HH:mm:ss')} : @@ -166,7 +166,7 @@ class Videostatisticscomtwo extends Component { { record.end_at? - {moment(record.end_at).format('YYYY-MM-DD HH:mm:ss')} : diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js index 1fadb3182..25c00047c 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js @@ -44,7 +44,7 @@ class Videostatisticslist extends Component { ` } - {record.title} @@ -84,7 +84,7 @@ class Videostatisticslist extends Component { ` } - {record.total_time} @@ -109,7 +109,7 @@ class Videostatisticslist extends Component { ` } - {record.user_name} From 5c5ad123e6555b158c0dcca6b9eb9878c8005336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 20:19:10 +0800 Subject: [PATCH 31/95] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=89=93=E5=9B=9E=E9=87=8D=E5=81=9A=E3=80=81=E4=B8=89=E4=B8=AA?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E8=AF=84=E9=98=85=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkList.js | 4 +- .../courses/shixunHomework/Challenges.css | 4 + .../courses/shixunHomework/Chongzuomodel.js | 68 +++++++++ .../shixunHomework/Listofworksstudentone.js | 141 +++++++++++++----- .../shixunHomework/ShixunWorkReport.js | 44 +++++- 5 files changed, 218 insertions(+), 43 deletions(-) create mode 100644 public/react/src/modules/courses/shixunHomework/Chongzuomodel.js diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 549dd6ae3..4c53a8362 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -379,7 +379,7 @@ function buildColumns(that, student_works, studentData) { that.props.toWorkDetailPage2(e, courseId, workId, record.id)} // onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)} - >{isAdmin ? '评阅' : '查看'} + >{isAdmin ? record.has_comment===true?"已评阅":'评阅':"查看"}
    @@ -692,7 +692,7 @@ class CommonWorkList extends Component{ modulationModalVisible, work_statuses, id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score, - ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count, + ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,has_comment, late_penalty, absence_penalty, appeal_penalty,user_comment_count , end_immediately, publish_immediately diff --git a/public/react/src/modules/courses/shixunHomework/Challenges.css b/public/react/src/modules/courses/shixunHomework/Challenges.css index 8ae2c002c..18100fcf3 100644 --- a/public/react/src/modules/courses/shixunHomework/Challenges.css +++ b/public/react/src/modules/courses/shixunHomework/Challenges.css @@ -26,4 +26,8 @@ overflow:hidden; text-overflow:ellipsis; white-space:nowrap +} + +.color32C090{ + color:#32C090 !important; } \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js b/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js new file mode 100644 index 000000000..e0bdc7378 --- /dev/null +++ b/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js @@ -0,0 +1,68 @@ +import React from 'react'; +import Modals from "../../modals/Modals"; +import axios from 'axios'; +class Chongzuomodel extends React.Component { + + constructor(props) { + super(props); + this.state = { + ModalsType:false, + antIcon:false + } + } + + componentDidMount(){ + this.setState({ + ModalsType:this.props.Chongzuomodeltype, + Modalstopval:`该作业将被打回重做,学生实训记录将被清空!`, + ModalsBottomval:`确定打回?`, + }) + } + + ModalSaves=()=>{ + this.setState({ + antIcon:true + }) + let zrl=`/myshixuns/${this.props.chongzuoId}/reset_my_game.json`; + axios.get(zrl).then((response) => { + this.setState({ + antIcon:false + }) + this.props.showNotification("操作成功"); + this.props.hideChongzuomodeltype() + this.props.Isupdatass(); + }).catch((error) => { + this.setState({ + antIcon:false + }) + }); + } + + ModalCancels=()=>{ + this.props.hideChongzuomodeltype() + } + + render() { + //console.log(this.props) + // Chongzuomodeltype:undefined, + // chongzuoId:undefined, + return ( + + this.ModalSaves()} + modalCancel={()=>this.ModalCancels()} + loadtype={false} + antIcon={this.state.antIcon} + > + + + ); + } +} + +export default Chongzuomodel; + + diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 6f489859e..6bf52c9ae 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1,19 +1,10 @@ import React, {Component} from "react"; -import CoursesListType from '../coursesPublic/CoursesListType'; import {getRandomcode, publicSearchs, sortDirections} from 'educoder'; import { - Form, - Select, - Input, - Button, Checkbox, - Upload, Icon, - message, - Modal, Table, Pagination, - Radio, Tooltip, notification, Spin, @@ -30,18 +21,15 @@ import './Challenges.css'; import {getImageUrl} from 'educoder'; import TraineetraininginformationModal from "./TraineetraininginformationModal"; import DownloadMessageysl from '../../modals/DownloadMessageysl'; -import Startshixuntask from "../coursesPublic/Startshixuntask"; import ModulationModal from "../coursesPublic/ModulationModal"; import HomeworkModal from "../coursesPublic/HomeworkModal"; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import ShixunWorkModal from "./Shixunworkdetails/ShixunWorkModal"; import NoneData from '../../../modules/courses/coursesPublic/NoneData'; +import Chongzuomodel from "./Chongzuomodel"; -const Search = Input.Search; -const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; -const {Option} = Select; -//GraduationTaskssetting.js + //作品列表(学生) let allow_lates=false; @@ -65,6 +53,8 @@ class Listofworksstudentone extends Component { //关卡得分final_score this.state = { + Chongzuomodeltype:undefined, + chongzuoId:undefined, searchtypes:false, jobsettingsdata: undefined, endTime: "2018/11/10 17:10:00", @@ -280,7 +270,11 @@ class Listofworksstudentone extends Component { width: '98px', render: (text, record) => ( - ( - ( - ( record.submitstate === "未开启" ? - this.Viewstudenttraininginformationtysl2(e, record)} - // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"已评阅":"评阅 "} : - this.Viewstudenttraininginformationtysl2(e, record)} - // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"已评阅":"评阅 "} - + + + {this.props.teacherdatapage === undefined ? "": this.props.teacherdatapage.homework_status[0]==="已截止"?"":record.myshixun_id===0?"":} + + : + + + + + {this.props.teacherdatapage === undefined ? "": this.props.teacherdatapage.homework_status[0]==="已截止"?"":record.myshixun_id===0?"":} + + ) }, ], @@ -1407,7 +1428,11 @@ class Listofworksstudentone extends Component { align: 'center', className: 'font-14', render: (text, record) => ( - ( record.submitstate === "未开启" ? - this.Viewstudenttraininginformationtysl2(e, record)} - // onClick={() => this.Viewstudenttraininginformationt(record)} - >{record.has_comment===true?"已评阅":"评阅"} : + + + + {this.props.teacherdatapage === undefined ? "": this.props.teacherdatapage.homework_status[0]==="已截止"?"":record.myshixun_id===0?"":} + + : - + this.Viewstudenttraininginformationtysl2(e, record)} // onClick={() => this.Viewstudenttraininginformationt(record)} >{record.has_comment===true?"已评阅":"评阅"} - +
    + {this.props.teacherdatapage === undefined ? "": this.props.teacherdatapage.homework_status[0]==="已截止"?"":record.myshixun_id===0?"":} + ) }, ], @@ -2072,7 +2115,7 @@ class Listofworksstudentone extends Component { classroom: teacherdata.group_name, cost_time: teacherdata.cost_time, has_comment:teacherdata.has_comment, - submitstate: teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", + submitstate:teacherdata.work_status === -1 ? "重做中":teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", updatetime: timedata === "Invalid date" ? "--" : timedata, @@ -2118,7 +2161,9 @@ class Listofworksstudentone extends Component { classroom: student_works[i].group_name, cost_time: student_works[i].cost_time, has_comment:student_works[i].has_comment, - submitstate: student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", + myshixun_id:student_works[i].myshixun_id, + myshixun_identifier:student_works[i].myshixun_identifier, + submitstate:student_works[i].work_status === -1 ? "重做中":student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", updatetime: timedata === "Invalid date" ? "--" : timedata, @@ -2280,7 +2325,7 @@ class Listofworksstudentone extends Component { classroom: teacherdata.group_name, cost_time: teacherdata.cost_time, has_comment:teacherdata.has_comment, - submitstate: teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", + submitstate:teacherdata.work_status === -1 ? "重做中":teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", updatetime: timedata === "Invalid date" ? "--" : timedata, @@ -2645,7 +2690,9 @@ class Listofworksstudentone extends Component { classroom: student_works[i].group_name, cost_time: student_works[i].cost_time, has_comment:student_works[i].has_comment, - submitstate: student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", + myshixun_id:student_works[i].myshixun_id, + myshixun_identifier:student_works[i].myshixun_identifier, + submitstate:student_works[i].work_status === -1 ? "重做中":student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", updatetime: timedata === "Invalid date" ? "--" : timedata, @@ -3441,6 +3488,19 @@ class Listofworksstudentone extends Component { }) } + chongzuofun=(id)=>{ + this.setState({ + chongzuoId:id, + Chongzuomodeltype:true + }) + } + + hideChongzuomodeltype=()=>{ + this.setState({ + chongzuoId:undefined, + Chongzuomodeltype:false + }) + } render() { let {columns,columnss, course_groupysls, datajs, isAdmin, homework_status, course_groupyslstwo, unlimited, unlimitedtwo, course_group_info, orders, task_status, checkedValuesine, searchtext, teacherlist, visible, visibles, game_list, columnsstu, columnsstu2, limit, experience, boolgalist, viewtrainingdata, teacherdata, page, data, jobsettingsdata, styletable, datas, order, loadingstate, computeTimetype} = this.state; @@ -3482,6 +3542,13 @@ class Listofworksstudentone extends Component { this.props.isAdmin() === true ?
    + {this.state.Chongzuomodeltype===true?this.hideChongzuomodeltype()} + Isupdatass={()=>this.Isupdatass()} + />:""} + {visible === true ? this.cancelModulationModel()} diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 454b11c6f..6534eea5e 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -22,6 +22,7 @@ import "../common/formCommon.css"; import '../css/Courses.css'; import './style.css'; import 'moment/locale/zh-cn'; +import Chongzuomodel from "./Chongzuomodel"; class ShixunWorkReport extends Component { @@ -39,7 +40,12 @@ class ShixunWorkReport extends Component { work_comment:undefined, has_commit: false, shixun_detail:[], - view_tpi:false + view_tpi:false, + myshixun_id:undefined, + myshixun_identifier:undefined, + homework_end:undefined, + chongzuoId:undefined, + Chongzuomodeltype:false } } @@ -117,7 +123,10 @@ class ShixunWorkReport extends Component { spinning: false, has_commit: result.data.has_commit, shixun_detail:result.data.shixun_detail, - view_tpi:result.data.view_tpi + view_tpi:result.data.view_tpi, + myshixun_id:result.data.myshixun_id, + myshixun_identifier:result.data.myshixun_identifier, + homework_end:result.data.homework_end, }) } @@ -308,8 +317,22 @@ class ShixunWorkReport extends Component { } } + + Backtoredo=(id)=>{ + this.setState({ + chongzuoId:id, + Chongzuomodeltype:true + }) + } + + hideChongzuomodeltype=()=>{ + this.setState({ + chongzuoId:undefined, + Chongzuomodeltype:false + }) + } render() { - let {data, showAppraiseModaltype, work_comment_hidden, work_comment, has_commit,shixun_detail,view_tpi} = this.state; + let {data, showAppraiseModaltype, work_comment_hidden, work_comment, has_commit,shixun_detail,view_tpi,myshixun_id,myshixun_identifier,homework_end} = this.state; let category_id=data===undefined?"":data.category===null?"":data.category.category_id; let homework_common_id=data===undefined?"":data.homework_common_id; @@ -320,10 +343,17 @@ class ShixunWorkReport extends Component { // let showAppraiseModals=work_comment===null||work_comment===undefined?false:true; // console.log(this.props.isAdmin()) document.title=data&&data.course_name; - + return ( data===undefined?"": + {this.state.Chongzuomodeltype===true?this.hideChongzuomodeltype()} + Isupdatass={()=>this.getdatalist()} + />:""} + this.showAppraiseModal(1)}*/} {/*>评阅 : ""}*/} + + {this.props.isAdmin()?homework_end===false&&myshixun_id!=0?this.Backtoredo(myshixun_identifier)} + >打回重做:"":""} + {this.props.isAdmin() ?this.showAppraiseModal("main",undefined,work_comment,work_comment_hidden)} From 9c52a0a1355912a9f6cb761f4a9343b0ebace4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 20:20:04 +0800 Subject: [PATCH 32/95] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/shixunHomework/ShixunWorkReport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 6534eea5e..893159730 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -343,7 +343,7 @@ class ShixunWorkReport extends Component { // let showAppraiseModals=work_comment===null||work_comment===undefined?false:true; // console.log(this.props.isAdmin()) document.title=data&&data.course_name; - + return ( data===undefined?"": From c0f38b84c2a455f95eb4f3605f233e0f883b264a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 20:25:53 +0800 Subject: [PATCH 33/95] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=BE=85=E8=AF=84=E9=98=85=E7=9A=84=E5=AD=A6=E7=94=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/homework_commons_controller.rb | 11 ++++++++++- .../homework_commons/get_next_work.json.jbuilder | 2 ++ config/routes.rb | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 app/views/homework_commons/get_next_work.json.jbuilder diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 15e795bdb..ccf52049c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -330,7 +330,7 @@ class ApplicationController < ActionController::Base end if !User.current.logged? && Rails.env.development? - User.current = User.find 1 + User.current = User.find 8825 end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index f64688deb..98be8c699 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -11,7 +11,7 @@ class HomeworkCommonsController < ApplicationController before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results, :code_review_detail, :show_comment, :settings, :works_list, :update_settings, :reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation, - :update_score, :update_student_score, :batch_comment] + :update_score, :update_student_score, :batch_comment, :get_next_work] before_action :user_course_identity before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer, :update_student_score] @@ -287,6 +287,15 @@ class HomeworkCommonsController < ApplicationController end end + def get_next_work + member = @course.course_member(current_user.id) + student_works = @homework.teacher_works(member).where.not(id: @homework.student_works_scores.where(reviewer_role: [1, 2])) + if params[:work_id] + student_works = student_works.where.not(id: params[:work_id]) + end + @work = student_works.where("work_status > 0").take + end + def update_score tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now @homework.update_homework_work_score diff --git a/app/views/homework_commons/get_next_work.json.jbuilder b/app/views/homework_commons/get_next_work.json.jbuilder new file mode 100644 index 000000000..e03b18970 --- /dev/null +++ b/app/views/homework_commons/get_next_work.json.jbuilder @@ -0,0 +1,2 @@ +json.work_id @work&.id +json.user_name @work&.user&.real_name \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 047141ea8..da07c8d89 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -597,6 +597,7 @@ Rails.application.routes.draw do get :update_score get :update_student_score post :batch_comment + get :get_next_work end collection do From 48b9fa519726163f6ca93252a64a18c354506e55 Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 20:28:34 +0800 Subject: [PATCH 34/95] video-player add point --- .../react/src/modules/courses/Video/video-play/index.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx index e33439dcf..b3d20fd8e 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -44,7 +44,9 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { let pos = []//播放时间点集 const log = useCallback((callback, isEnd = false) => { - let params = {} + let params = { + point: el.currentTime.currentTime + } if (logId) { params['log_id'] = logId params['watch_duration'] = getTotalEffectTime(pos) //当前观看视频时长,拖放进度条,重复的视频片段观看时,不会把重复的时长累积进来,最大时长是视频的总时长 @@ -137,7 +139,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { log() } } - }else { + } else { lastUpdatedTime = newTime } } @@ -177,7 +179,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { el.current.removeEventListener('seeking', onSeeking) el.current.removeEventListener('seeked', onSeeked) el.current.removeEventListener('timeupdate', onTimeupdate) - if(el.current.playing) { + if (el.current.playing) { log() } } From eb6cee3e615491fcf3f8274b421f38c6d583c445 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 20:31:34 +0800 Subject: [PATCH 35/95] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/controllers/weapps/courses_controller.rb | 1 + app/controllers/weapps/homes_controller.rb | 2 +- app/views/courses/index.json.jbuilder | 1 - app/views/weapps/courses/show.json.jbuilder | 3 ++- app/views/weapps/homes/show.json.jbuilder | 1 + 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 48f644a14..46ac514b4 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -99,7 +99,7 @@ class CoursesController < ApplicationController limit = params[:limit] || 16 @courses = @courses.page(page).per(limit) - @courses = @courses.preload(:school, :none_hidden_course_modules, :teacher_users, teacher: :user_extension) + @courses = @courses.preload(:school, :none_hidden_course_modules, teacher: :user_extension) end def course_videos diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index 2a375a7fb..1dec62201 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -76,6 +76,7 @@ class Weapps::CoursesController < Weapps::BaseController def show @course = current_course @current_user = current_user + @teacher_users = @course.teacher_users.where.not(user_id: @course.tea_id).map(&:real_name)[0..2] end def shixun_homework_category diff --git a/app/controllers/weapps/homes_controller.rb b/app/controllers/weapps/homes_controller.rb index e53923fa8..3e94354a2 100644 --- a/app/controllers/weapps/homes_controller.rb +++ b/app/controllers/weapps/homes_controller.rb @@ -19,7 +19,7 @@ class Weapps::HomesController < Weapps::BaseController @courses = @courses.where(id: current_laboratory.all_courses) @course_count = @courses.count order_str = "course_members.sticky=1 desc, course_members.sticky_time desc, courses.created_at desc" - @courses = paginate(@courses.order(order_str).includes(:teacher, :school)) + @courses = paginate(@courses.order(order_str).includes(:teacher_users, :teacher, :school)) @user = current_user end end \ No newline at end of file diff --git a/app/views/courses/index.json.jbuilder b/app/views/courses/index.json.jbuilder index a8b70c435..f9bceebb8 100644 --- a/app/views/courses/index.json.jbuilder +++ b/app/views/courses/index.json.jbuilder @@ -13,6 +13,5 @@ json.courses @courses do |course| json.is_end course.is_end json.first_category_url module_url(course.none_hidden_course_modules.first, course) json.excellent course.excellent - json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师 end json.courses_count @courses_count diff --git a/app/views/weapps/courses/show.json.jbuilder b/app/views/weapps/courses/show.json.jbuilder index c22b24426..cf58315b4 100644 --- a/app/views/weapps/courses/show.json.jbuilder +++ b/app/views/weapps/courses/show.json.jbuilder @@ -1,4 +1,5 @@ json.(@course, :id, :name, :course_members_count, :credit, :invite_code_halt) json.teachers_count @course.teachers.count json.students_count @course.students.count -json.course_identity @current_user.course_identity(@course) \ No newline at end of file +json.course_identity @current_user.course_identity(@course) +json.teacher_users @teacher_users \ No newline at end of file diff --git a/app/views/weapps/homes/show.json.jbuilder b/app/views/weapps/homes/show.json.jbuilder index f307d64fe..5d0e35e05 100644 --- a/app/views/weapps/homes/show.json.jbuilder +++ b/app/views/weapps/homes/show.json.jbuilder @@ -26,5 +26,6 @@ json.courses @courses.each do |course| course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first json.sticky course_member.sticky json.course_identity current_user.course_identity(course) + json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师 end From c24e5cf774c823a1c91865c291b0846166e1e0f5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 20:38:55 +0800 Subject: [PATCH 36/95] =?UTF-8?q?=E5=8D=8F=E4=BD=9C=E8=80=81=E5=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/weapps/courses_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ccf52049c..15e795bdb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -330,7 +330,7 @@ class ApplicationController < ActionController::Base end if !User.current.logged? && Rails.env.development? - User.current = User.find 8825 + User.current = User.find 1 end diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index 1dec62201..3a1b22cc4 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -76,7 +76,7 @@ class Weapps::CoursesController < Weapps::BaseController def show @course = current_course @current_user = current_user - @teacher_users = @course.teacher_users.where.not(user_id: @course.tea_id).map(&:real_name)[0..2] + @teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..2] end def shixun_homework_category From 7a28b31a468914174a50123f178f53283cb4be56 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 20:47:26 +0800 Subject: [PATCH 37/95] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=87=8D=E5=81=9A?= =?UTF-8?q?=E7=9A=84=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index a96a2a79f..8713bebf3 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -18,7 +18,8 @@ class MyshixunsController < ApplicationController # 强制重置实训 # 前段需要按照操作过程提示 def reset_my_game - unless (current_user.admin? || current_user.id == @myshixun.user_id) + course = Course.find_by(id: params[:course_id]) + unless (current_user.admin_or_business? || current_user.id == @myshixun.user_id) || (course.present? && current_user.course_identity(course) < Course::STUDENT) tip_exception("403", "") end begin From f56574a926c594d3b0fb86925d5de606152773f9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 20:48:37 +0800 Subject: [PATCH 38/95] =?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/views/student_works/shixun_work_report.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/student_works/shixun_work_report.json.jbuilder b/app/views/student_works/shixun_work_report.json.jbuilder index d8ab98a3f..c6596d1ee 100644 --- a/app/views/student_works/shixun_work_report.json.jbuilder +++ b/app/views/student_works/shixun_work_report.json.jbuilder @@ -1,4 +1,5 @@ json.homework_common_id @homework.id +json.course_id @homework.course_id json.category @homework.category_info json.course_name @course.name json.work_id @work.id From 1bdf64c64ad489058acf5f102cf913e056f838fa Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 20:55:08 +0800 Subject: [PATCH 39/95] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E6=95=B0=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/courses_controller.rb | 4 +++- app/views/admins/courses/index.xlsx.axlsx | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/admins/courses_controller.rb b/app/controllers/admins/courses_controller.rb index f129fea29..a7556502b 100644 --- a/app/controllers/admins/courses_controller.rb +++ b/app/controllers/admins/courses_controller.rb @@ -13,7 +13,9 @@ class Admins::CoursesController < Admins::BaseController format.js format.html format.xlsx do - @courses = courses.not_deleted.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: [user_extension: :department]) + @courses = courses.not_deleted.includes(:school, :students, :teacher_course_members, :informs, :course_videos, + :live_links, :attachments, :homework_commons, + teacher: [user_extension: :department]) filename = "课堂列表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx" render xlsx: 'index', filename: filename end diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx index 177c5678e..84430f478 100644 --- a/app/views/admins/courses/index.xlsx.axlsx +++ b/app/views/admins/courses/index.xlsx.axlsx @@ -3,9 +3,11 @@ wb = xlsx_package.workbook wb.styles do |s| blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} wb.add_worksheet(name: "课堂列表") do |sheet| - sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell + sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 直播 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 讨论数 私有 状态 单位 部门 创建者 创建时间), :height => 25,:style => blue_cell @courses.each do |course| + course_board = course.course_board + topic_count = course_board.present? ? course_board.messages.size : 0 data = [ course.id, course.name, @@ -15,6 +17,7 @@ wb.styles do |s| get_attachment_count(course, 0), course.informs.size, course.course_videos.size, + course.live_links.size, course.course_homework_count("normal"), course.course_homework_count("group"), course.course_homework_count("practice"), @@ -22,13 +25,13 @@ wb.styles do |s| course.student_works_count, course.exercises_count, course.evaluate_count, + course.topic_count, course.is_public == 1 ? "--" : "√", course.is_end ? "已结束" : "正在进行", course.school&.name, course.teacher&.department_name, course.teacher&.real_name, course.created_at&.strftime('%Y-%m-%d %H:%M'), - course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--" ] sheet.add_row(data) end From 5abe8b3589e7856fcf4d805f380824db100a661f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 21:09:52 +0800 Subject: [PATCH 40/95] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=A7=82=E7=9C=8B?= =?UTF-8?q?=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/courses/index.xlsx.axlsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx index 84430f478..28c48c188 100644 --- a/app/views/admins/courses/index.xlsx.axlsx +++ b/app/views/admins/courses/index.xlsx.axlsx @@ -3,7 +3,7 @@ wb = xlsx_package.workbook wb.styles do |s| blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} wb.add_worksheet(name: "课堂列表") do |sheet| - sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 直播 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 讨论数 私有 状态 单位 部门 创建者 创建时间), :height => 25,:style => blue_cell + sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 视频学习时长 直播 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 讨论数 私有 状态 单位 部门 创建者 创建时间), :height => 25,:style => blue_cell @courses.each do |course| course_board = course.course_board @@ -17,6 +17,7 @@ wb.styles do |s| get_attachment_count(course, 0), course.informs.size, course.course_videos.size, + course.course_videos.map{|cv| cv.watch_course_videos.map(&:total_duration).sum }.sum course.live_links.size, course.course_homework_count("normal"), course.course_homework_count("group"), From de86a7ed04e6ac67b887fac5ed7c04271e312fd2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 21:16:35 +0800 Subject: [PATCH 41/95] =?UTF-8?q?=E5=AF=BC=E5=87=BAexcel=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/courses/index.xlsx.axlsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx index 28c48c188..fb07e1dab 100644 --- a/app/views/admins/courses/index.xlsx.axlsx +++ b/app/views/admins/courses/index.xlsx.axlsx @@ -17,7 +17,7 @@ wb.styles do |s| get_attachment_count(course, 0), course.informs.size, course.course_videos.size, - course.course_videos.map{|cv| cv.watch_course_videos.map(&:total_duration).sum }.sum + course.course_videos.map{|cv| cv.watch_course_videos.map(&:total_duration).sum }.sum, course.live_links.size, course.course_homework_count("normal"), course.course_homework_count("group"), From 56a73c637bfd38f12ebe29c486bb61df669f268c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 21:18:08 +0800 Subject: [PATCH 42/95] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/courses/index.xlsx.axlsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx index fb07e1dab..934ca845c 100644 --- a/app/views/admins/courses/index.xlsx.axlsx +++ b/app/views/admins/courses/index.xlsx.axlsx @@ -26,7 +26,7 @@ wb.styles do |s| course.student_works_count, course.exercises_count, course.evaluate_count, - course.topic_count, + topic_count, course.is_public == 1 ? "--" : "√", course.is_end ? "已结束" : "正在进行", course.school&.name, From 476f095256f4744b4d4981e03445b2c927977796 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 18 Mar 2020 21:22:23 +0800 Subject: [PATCH 43/95] =?UTF-8?q?=E8=A7=82=E7=9C=8B=E6=97=B6=E9=95=BF?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/courses/index.xlsx.axlsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx index 934ca845c..a276fe470 100644 --- a/app/views/admins/courses/index.xlsx.axlsx +++ b/app/views/admins/courses/index.xlsx.axlsx @@ -17,7 +17,7 @@ wb.styles do |s| get_attachment_count(course, 0), course.informs.size, course.course_videos.size, - course.course_videos.map{|cv| cv.watch_course_videos.map(&:total_duration).sum }.sum, + course.course_videos.map{|cv| cv.watch_course_videos.map(&:total_duration).sum }.sum.round, course.live_links.size, course.course_homework_count("normal"), course.course_homework_count("group"), From d73d3a02494fc460968f95b735e2753955cac107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 21:31:55 +0800 Subject: [PATCH 44/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkList.js | 23 +++++++++++-------- .../courses/shixunHomework/Chongzuomodel.js | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 4c53a8362..e45d016bb 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -1,6 +1,6 @@ import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip,Spin, Pagination} from "antd"; -import {WordsBtn, ConditionToolTip, queryString, publicSearchs, on, off, NoneData, sortDirections} from 'educoder'; +import { Form, Table,Tooltip,Spin, Pagination} from "antd"; +import { queryString, publicSearchs, on, off, NoneData, sortDirections} from 'educoder'; import axios from 'axios'; import CheckAllGroup from '../common/button/CheckAllGroup' import moment from 'moment'; @@ -11,7 +11,6 @@ import ModulationModal from "../coursesPublic/ModulationModal"; import AccessoryModal from "../coursesPublic/AccessoryModal"; import LeaderIcon from './common/LeaderIcon' const $ = window.$; -const Search = Input.Search; function renderScore(score, content) { let color = '#747A7F' @@ -369,18 +368,24 @@ function buildColumns(that, student_works, studentData) { {/* 0 未提交 */} {/**/} {/**/} + + +
    { isAdmin && 调整学生当前成绩
    其它历史评分将全部失效}> - that.showModulationModal(record)} >调分
    } +
    {/* toWorkDetailPage */} {/* /classrooms/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */} - that.props.toWorkDetailPage2(e, courseId, workId, record.id)} - // onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)} - >{isAdmin ? record.has_comment===true?"已评阅":'评阅':"查看"} -
    ), diff --git a/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js b/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js index e0bdc7378..edbd106c8 100644 --- a/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js +++ b/public/react/src/modules/courses/shixunHomework/Chongzuomodel.js @@ -23,7 +23,7 @@ class Chongzuomodel extends React.Component { this.setState({ antIcon:true }) - let zrl=`/myshixuns/${this.props.chongzuoId}/reset_my_game.json`; + let zrl=`/myshixuns/${this.props.chongzuoId}/reset_my_game.json?course_id=${this.props.match.params.coursesId}`; axios.get(zrl).then((response) => { this.setState({ antIcon:false From 1ab6569f2200831579e0b14a17f0983d3923d9cc Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 21:42:21 +0800 Subject: [PATCH 45/95] =?UTF-8?q?fix=20=E6=8B=A6=E6=88=AA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndex.js | 914 +++++++++++------------ 1 file changed, 436 insertions(+), 478 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 2a650e3d0..c38dd1bca 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; -import { Row, Col ,Menu,Popover,Button} from 'antd'; +import { Row, Col, Menu, Popover, Button } from 'antd'; import Loading from '../../Loading'; @@ -84,8 +84,8 @@ import '../page/tpiPage.css'; //新建实训 const TPMchallengesnew = Loadable({ - loader: () => import('./challengesnew/TPMchallengesnew'), - loading: Loading, + loader: () => import('./challengesnew/TPMchallengesnew'), + loading: Loading, }) //新建实训 // const TPMchallengesnew = Loadable({ @@ -95,8 +95,8 @@ const TPMchallengesnew = Loadable({ //新建tab2 const TPMevaluation = Loadable({ - loader: () => import('./challengesnew/TPMevaluation'), - loading: Loading, + loader: () => import('./challengesnew/TPMevaluation'), + loading: Loading, }) //新建tab3答案 @@ -105,321 +105,279 @@ const TPMevaluation = Loadable({ // loading: Loading, // }) const TPManswer = Loadable({ - loader: () => import('./challengesnew/TPManswer2'), - loading: Loading, + loader: () => import('./challengesnew/TPManswer2'), + loading: Loading, }) //选择题 const TPMquestion = Loadable({ - loader: () => import('./challengesnew/TPMquestion'), - loading: Loading, + loader: () => import('./challengesnew/TPMquestion'), + loading: Loading, }) //fork列表 const TPMFork_listComponent = Loadable({ - loader: () => import('./TPMFork/TPMForklist'), - loading: Loading, + loader: () => import('./TPMFork/TPMForklist'), + loading: Loading, }) //背景知识修改 const TPMUpdatepropaede = Loadable({ - loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'), - loading: Loading, + loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'), + loading: Loading, }) // 版本库添加文件 const AddFile = Loadable({ - loader: () => import('./shixunchild/Repository/RepositoryAddFile'), - loading: Loading, + loader: () => import('./shixunchild/Repository/RepositoryAddFile'), + loading: Loading, }) // 版本库上传文件 -const Uploadfile= Loadable({ +const Uploadfile = Loadable({ loader: () => import('./shixunchild/Repository/RepositoryAddFileupload_file'), loading: Loading, }) const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.json' - , 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json'] + , 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json'] const cacheInterceptorUrlMap = {} class TPMIndex extends Component { - constructor(props) { - super(props) - this.state = { - loadingContent: false, - power: false, - shixunsDetails: {}, - shixunId: undefined, - star_info: [0, 0, 0, 0, 0, 0], - star_infos: [0, 0, 0, 0, 0, 0], - identity:undefined, - TPMRightSectionData:undefined, - PropaedeuticsList: undefined, - tpmindexjupyterbool:false, - is_jupyter:false, - selectedKeys:"", - openknows:false, - newathArray:[] - } + constructor(props) { + super(props) + this.state = { + loadingContent: false, + power: false, + shixunsDetails: {}, + shixunId: undefined, + star_info: [0, 0, 0, 0, 0, 0], + star_infos: [0, 0, 0, 0, 0, 0], + identity: undefined, + TPMRightSectionData: undefined, + PropaedeuticsList: undefined, + tpmindexjupyterbool: false, + is_jupyter: false, + selectedKeys: "", + openknows: false, + newathArray: [] } + } - openknow=()=>{ - let storage=window.localStorage; - this.setState({ - openknows:false - }) - let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings' - storage.setItem(newTPMsettings,false); - } + openknow = () => { + let storage = window.localStorage; + this.setState({ + openknows: false + }) + let newTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings' + storage.setItem(newTPMsettings, false); + } componentDidUpdate(prevProps, prevState) { - if (prevProps!=this.props) { - if(this.props.user&&this.props.user.user_id){ - let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; - let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) - if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ - this.setState({ - openknows:false - }) - }else{ - this.setState({ - openknows:false - }) - } + if (prevProps != this.props) { + if (this.props.user && this.props.user.user_id) { + let getnewTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings'; + let newTPMsettings = window.localStorage.getItem(getnewTPMsettings) + if (newTPMsettings === undefined || newTPMsettings === false || newTPMsettings === null) { + this.setState({ + openknows: false + }) + } else { + this.setState({ + openknows: false + }) } } } + } - getcomponentdidmount=()=>{ - let userid=this.props.user&&this.props.user.user_id; - let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; - let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) - let id = this.props.match.params.shixunId; - // console.log('props', this.props); - // let collaborators = `/shixuns/` + id + `/propaedeutics.json`; - // - // axios.get(collaborators).then((response) => { - // if (response.status === 200) { - // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - // - // }else{ - // this.setState({ - // PropaedeuticsList: response.data, - // shixunId: id - // }); - // } - // - // } - // }).catch((error) => { - // console.log(error) - // }); - let Url = `/shixuns/` + id + `.json`; - axios.get(Url).then((response) => { - if (response.status === 200) { - document.title=response.data.name; - let newstar_info = []; - // let start1= - for (var i = 0; i < response.data.score_info.length; i++) { - - if (i === 0) { - newstar_info.push(response.data.score_info[i]) - } else { - newstar_info.push((response.data.score_info[i] / 100) * 5) - } - } - let newstar_infos = response.data.score_info; - this.setState({ - shixunsDetails: response.data, - shixunId: id, - star_info: newstar_info, - star_infos: newstar_infos, - power: response.data.power, - identity: response.data.identity, - propaedeutics:response.data.propaedeutics, - status: response.data.shixun_status, - secret_repository: response.data.secret_repository, - public:response.data.public, - is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter, - }); - - if(userid){ - if(response.data.identity <4){ - if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ - console.log() - this.setState({ - openknows:true - }) - }else{ - this.setState({ - openknows:false - }) - } - } + getcomponentdidmount = () => { + let userid = this.props.user && this.props.user.user_id; + let getnewTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings'; + let newTPMsettings = window.localStorage.getItem(getnewTPMsettings) + let id = this.props.match.params.shixunId; + // console.log('props', this.props); + // let collaborators = `/shixuns/` + id + `/propaedeutics.json`; + // + // axios.get(collaborators).then((response) => { + // if (response.status === 200) { + // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + // + // }else{ + // this.setState({ + // PropaedeuticsList: response.data, + // shixunId: id + // }); + // } + // + // } + // }).catch((error) => { + // console.log(error) + // }); + let Url = `/shixuns/` + id + `.json`; + axios.get(Url).then((response) => { + if (response.status === 200) { + document.title = response.data.name; + let newstar_info = []; + // let start1= + for (var i = 0; i < response.data.score_info.length; i++) { + + if (i === 0) { + newstar_info.push(response.data.score_info[i]) + } else { + newstar_info.push((response.data.score_info[i] / 100) * 5) } - } - }).catch((error) => { + let newstar_infos = response.data.score_info; this.setState({ - shixunsDetails: undefined, - shixunId: undefined, - star_info: undefined, - star_infos: undefined, - power: undefined, - identity: undefined, - status: undefined, - propaedeutics:undefined, - is_jupyter:false, + shixunsDetails: response.data, + shixunId: id, + star_info: newstar_info, + star_infos: newstar_infos, + power: response.data.power, + identity: response.data.identity, + propaedeutics: response.data.propaedeutics, + status: response.data.shixun_status, + secret_repository: response.data.secret_repository, + public: response.data.public, + is_jupyter: response.data.is_jupyter === undefined || response.data.is_jupyter === null ? false : response.data.is_jupyter, }); - }); - // this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => { - // let url = config.url; - // // console.log('tpmContentRequestInterceptor:', url) - // for ( let i = 0; i < interceptorUrlArray.length; i++ ) { - // if (url.indexOf(interceptorUrlArray[i]) != -1) { - // url = url.split('?')[0] - // console.log('loadingContent, url:', url) - // - // this.setState({ loadingContent: true }) - // - // cacheInterceptorUrlMap[url] = true - // } - // } - // return config; - // }, function (error) { - // return Promise.reject(error); - // }); - - // Add a response interceptor - this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => { - // console.log('loadingContent finished, url:', response.config.url) - // TODO 依赖了api这个前缀 - let url = response.config.url.split('api')[1]; - url = url.split('?')[0] - if (cacheInterceptorUrlMap[url]) { - - this.setState({ loadingContent: false }) - delete cacheInterceptorUrlMap[response.url] + if (userid) { + if (response.data.identity < 4) { + if (newTPMsettings === undefined || newTPMsettings === false || newTPMsettings === null) { + console.log() + this.setState({ + openknows: true + }) + } else { + this.setState({ + openknows: false + }) + } + } } - return response; - }, function (error) { - // Do something with response error - return Promise.reject(error); + + } + }).catch((error) => { + this.setState({ + shixunsDetails: undefined, + shixunId: undefined, + star_info: undefined, + star_infos: undefined, + power: undefined, + identity: undefined, + status: undefined, + propaedeutics: undefined, + is_jupyter: false, }); - //右侧数据 - let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; - axios.get(shixunsDetailsURL).then((response)=> { - if(response.data){ + }); - } - this.setState({ - TPMRightSectionData: response.data - }); - }) - this.getnavdatas() - } - componentDidMount = () => { - this.getcomponentdidmount() + //右侧数据 + let shixunsDetailsURL = `/shixuns/` + id + `/show_right.json`; + axios.get(shixunsDetailsURL).then((response) => { + if (response.data) { - } + } + this.setState({ + TPMRightSectionData: response.data + }); + }) + this.getnavdatas() + } + componentDidMount = () => { + this.getcomponentdidmount() - componentWillUnmount = () => { - axios.interceptors.request.eject(this.tpmContentRequestInterceptor); - this.tpmContentRequestInterceptor = null; - axios.interceptors.request.eject(this.tpmContentResponseInterceptor); - this.tpmContentResponseInterceptor = null; - // this.getnavdatas() - } + } - setLoadingContent = (isLoadingContent) => { - // this.setState({ loadingContent: isLoadingContent }) - } + setLoadingContent = (isLoadingContent) => { + // this.setState({ loadingContent: isLoadingContent }) + } - getnavdatas=()=>{ - let selectedKeys; - const {location} = this.props; - if(location.pathname.indexOf('/challenges')!=-1){ - selectedKeys="1" - }else if(location.pathname.indexOf('/propaedeutics')!=-1){ - selectedKeys="2" - }else if(location.pathname.indexOf('/repository')!=-1){ - selectedKeys="3" - }else if(location.pathname.indexOf('/secret_repository')!=-1){ - selectedKeys="4" - } else if(location.pathname.indexOf('/collaborators')!=-1){ - selectedKeys="5" - }else if(location.pathname.indexOf('/dataset')!=-1){ - selectedKeys="6" - }else if(location.pathname.indexOf('/shixun_discuss')!=-1){ - selectedKeys="7" - }else if(location.pathname.indexOf('/ranking_list')!=-1){ - selectedKeys="8" - }else if(location.pathname.indexOf('/settings')!=-1){ - selectedKeys="9" - } - this.setState({ - selectedKeys:selectedKeys - }) + getnavdatas = () => { + let selectedKeys; + const { location } = this.props; + if (location.pathname.indexOf('/challenges') != -1) { + selectedKeys = "1" + } else if (location.pathname.indexOf('/propaedeutics') != -1) { + selectedKeys = "2" + } else if (location.pathname.indexOf('/repository') != -1) { + selectedKeys = "3" + } else if (location.pathname.indexOf('/secret_repository') != -1) { + selectedKeys = "4" + } else if (location.pathname.indexOf('/collaborators') != -1) { + selectedKeys = "5" + } else if (location.pathname.indexOf('/dataset') != -1) { + selectedKeys = "6" + } else if (location.pathname.indexOf('/shixun_discuss') != -1) { + selectedKeys = "7" + } else if (location.pathname.indexOf('/ranking_list') != -1) { + selectedKeys = "8" + } else if (location.pathname.indexOf('/settings') != -1) { + selectedKeys = "9" } + this.setState({ + selectedKeys: selectedKeys + }) + } - handleClick=(e)=>{ + handleClick = (e) => { this.setState({ selectedKeys: e.key, }); let id = this.props.match.params.shixunId; - if(e.key==="1"){ + if (e.key === "1") { this.props.history.replace(`/shixuns/${id}/challenges`); - }else if(e.key==="2"){ + } else if (e.key === "2") { this.props.history.replace(`/shixuns/${id}/propaedeutics`); - }else if(e.key==="3"){ + } else if (e.key === "3") { // window.location.href=`/shixuns/${id}/repository`; - this.props.history.push(`/shixuns/${id}/repository`); - }else if(e.key==="4"){ + this.props.history.push(`/shixuns/${id}/repository`); + } else if (e.key === "4") { // window.location.href=`/shixuns/${id}/secret_repository`; this.props.history.push(`/shixuns/${id}/secret_repository`); - }else if(e.key==="5"){ + } else if (e.key === "5") { this.props.history.replace(`/shixuns/${id}/collaborators`); - }else if(e.key==="6"){ + } else if (e.key === "6") { this.props.history.replace(`/shixuns/${id}/dataset`); - }else if(e.key==="7"){ + } else if (e.key === "7") { this.props.history.replace(`/shixuns/${id}/shixun_discuss`); - }else if(e.key==="8"){ + } else if (e.key === "8") { this.props.history.replace(`/shixuns/${id}/ranking_list`); - }else if(e.key==="9"){ + } else if (e.key === "9") { this.props.history.replace(`/shixuns/${id}/settings`); } } - setpathArray=(list)=>{ - this.setState({ - newathArray:list - }) + setpathArray = (list) => { + this.setState({ + newathArray: list + }) } - render() { - - let url = window.location.href; - let flag =false; - // url.indexOf("add_file")>-1; - - return ( -
    - {/*头部*/} - { - !flag && - this.getcomponentdidmount()} - > - } + render() { + + let url = window.location.href; + let flag = false; + // url.indexOf("add_file")>-1; + + return ( +
    + {/*头部*/} + { + !flag && + this.getcomponentdidmount()} + > + } - - -
    - - - - - - 任务 - - - { this.state.propaedeutics===undefined?"":this.state.propaedeutics===false?"": - 背景知识 - } - - { this.state.identity >4||this.state.identity===undefined ?"": - this.state.is_jupyter===false? - 版本库 - :""} - - {this.state.identity >4||this.state.identity===undefined ?"": this.state.secret_repository && - 私密版本库 - } - - - 合作者 - - - { this.state.identity >4||this.state.identity===undefined ? "":this.state.is_jupyter===true? - 数据集 - :""} - - { this.state.is_jupyter===false? - 评论 - :""} - - { this.state.is_jupyter===false? - 排行榜 - :""} - {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} - {/* */} - {/*
    更多设置在这里,点击“配置”看一看~
    */} - {/*
    */} - {/* */} - {/* }*/} - {/* trigger="click"*/} - {/* placement="top"*/} - {/* visible={this.state.openknows}*/} - {/* >*/} - {/* */} - {/*
    :""}*/} - - {this.state.identity >4||this.state.identity===undefined ? "": - - 配置 - - } - - {this.state.identity >2||this.state.identity===undefined?"": -
    - 审核情况 -
    - } -
    - -
    -
    - - {/*筛选*/} - {/*{*/} - {/* tpmindexjupyterbool===false?*/} - - {/* :""*/} - {/*}*/} - {/* */} + } + + +
    + + + + + + 任务 + + + {this.state.propaedeutics === undefined ? "" : this.state.propaedeutics === false ? "" : + 背景知识 + } + + {this.state.identity > 4 || this.state.identity === undefined ? "" : + this.state.is_jupyter === false ? + 版本库 + : ""} + + {this.state.identity > 4 || this.state.identity === undefined ? "" : this.state.secret_repository && + 私密版本库 + } + + + 合作者 + + + {this.state.identity > 4 || this.state.identity === undefined ? "" : this.state.is_jupyter === true ? + 数据集 + : ""} + + {this.state.is_jupyter === false ? + 评论 + : ""} + + {this.state.is_jupyter === false ? + 排行榜 + : ""} + {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} + {/* */} + {/*
    更多设置在这里,点击“配置”看一看~
    */} + {/*
    */} + {/* */} + {/* }*/} + {/* trigger="click"*/} + {/* placement="top"*/} + {/* visible={this.state.openknows}*/} + {/* >*/} + {/* */} + {/*
    :""}*/} + + {this.state.identity > 4 || this.state.identity === undefined ? "" : + + 配置 + + } - + {this.state.identity > 2 || this.state.identity === undefined ? "" : +
    + 审核情况 +
    + } +
    + +
    +
    - () - }> - () - }> - {/*任务*/} - () - }> + {/*筛选*/} + {/*{*/} + {/* tpmindexjupyterbool===false?*/} - () - }> - - () - }> - - () - }> - - () - }> + {/* :""*/} + {/*}*/} + {/* */} + + + () + }> + () + }> + {/*任务*/} + () + }> + + () + }> + + () + }> + + () + }> + + () + }> + + + ( this.setpathArray(value)} + />) + }> + + ( this.setpathArray(value)} + />) + }> + + + ( this.setpathArray(value)} + />) + }> + + + ( this.setpathArray(value)} + />) + }> + + + {/* */} + + () + }> + + + () + }> + + + {/* */} + + + ( this.initForumState(data)} + setSearchValue={this.setSearchValue} + setHotLabelIndex={this.setHotLabelIndex} + />) + }> + + + ( this.getcomponentdidmount()} />) + }> + + {/*实训项目条目塞选*/} + () + }> + {/*合作者*/} + () + }> + + () + }> + + () + }> - (this.setpathArray(value)} - />) - }> - - (this.setpathArray(value)} - />) - }> - - - (this.setpathArray(value)} - />) - }> - - - (this.setpathArray(value)} - />) - }> - - - {/* */} - - () - }> - - - () - }> - - - {/* */} - - - (this.initForumState(data)} - setSearchValue={this.setSearchValue} - setHotLabelIndex={this.setHotLabelIndex} - />) - }> - - - (this.getcomponentdidmount()} />) - }> - - {/*实训项目条目塞选*/} - () - }> - {/*合作者*/} - () - }> - - () - }> - - () - }> + () + }> - () - }> + {/*评测设置*/} + () + }> - {/*评测设置*/} - () - }> + {/*参考答案*/} + () + }> - {/*参考答案*/} - () - }> + {/*新建关卡*/} + () + }> - {/*新建关卡*/} - () - }> + {/*编辑关卡*/} + () + }> - {/*编辑关卡*/} - () - }> + {/*新建选择题*/} + () + }> - {/*新建选择题*/} - () - }> + {/*修改选择题*/} + () + }> - {/*修改选择题*/} - () - }> + {/*修改选择题*/} + () + }> - {/*修改选择题*/} - () - }> + () + }> - () - }> + {/**/} + - {/**/} - - -
    - ); - } +
    + ); + } } -export default SnackbarHOC() (TPMIndexHOC ( TPMIndex )); +export default SnackbarHOC()(TPMIndexHOC(TPMIndex)); From c705510639e8e89e30f1c1ee1e3bf4c0f3801850 Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 22:08:21 +0800 Subject: [PATCH 46/95] fix --- public/react/src/modules/courses/Video/video-play/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx index b3d20fd8e..bfa56c938 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -45,7 +45,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { const log = useCallback((callback, isEnd = false) => { let params = { - point: el.currentTime.currentTime + point: el.current.currentTime } if (logId) { params['log_id'] = logId From 5c62fd20fed7b892d43fa71e4b794f23fba6a547 Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 22:11:43 +0800 Subject: [PATCH 47/95] =?UTF-8?q?Revert=20"fix=20=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=99=A8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1ab6569f2200831579e0b14a17f0983d3923d9cc. --- public/react/src/modules/tpm/TPMIndex.js | 914 ++++++++++++----------- 1 file changed, 478 insertions(+), 436 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index c38dd1bca..3e8dc1cd8 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; -import { Row, Col, Menu, Popover, Button } from 'antd'; +import { Row, Col ,Menu,Popover,Button} from 'antd'; import Loading from '../../Loading'; @@ -84,8 +84,8 @@ import '../page/tpiPage.css'; //新建实训 const TPMchallengesnew = Loadable({ - loader: () => import('./challengesnew/TPMchallengesnew'), - loading: Loading, + loader: () => import('./challengesnew/TPMchallengesnew'), + loading: Loading, }) //新建实训 // const TPMchallengesnew = Loadable({ @@ -95,8 +95,8 @@ const TPMchallengesnew = Loadable({ //新建tab2 const TPMevaluation = Loadable({ - loader: () => import('./challengesnew/TPMevaluation'), - loading: Loading, + loader: () => import('./challengesnew/TPMevaluation'), + loading: Loading, }) //新建tab3答案 @@ -105,279 +105,321 @@ const TPMevaluation = Loadable({ // loading: Loading, // }) const TPManswer = Loadable({ - loader: () => import('./challengesnew/TPManswer2'), - loading: Loading, + loader: () => import('./challengesnew/TPManswer2'), + loading: Loading, }) //选择题 const TPMquestion = Loadable({ - loader: () => import('./challengesnew/TPMquestion'), - loading: Loading, + loader: () => import('./challengesnew/TPMquestion'), + loading: Loading, }) //fork列表 const TPMFork_listComponent = Loadable({ - loader: () => import('./TPMFork/TPMForklist'), - loading: Loading, + loader: () => import('./TPMFork/TPMForklist'), + loading: Loading, }) //背景知识修改 const TPMUpdatepropaede = Loadable({ - loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'), - loading: Loading, + loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'), + loading: Loading, }) // 版本库添加文件 const AddFile = Loadable({ - loader: () => import('./shixunchild/Repository/RepositoryAddFile'), - loading: Loading, + loader: () => import('./shixunchild/Repository/RepositoryAddFile'), + loading: Loading, }) // 版本库上传文件 -const Uploadfile = Loadable({ +const Uploadfile= Loadable({ loader: () => import('./shixunchild/Repository/RepositoryAddFileupload_file'), loading: Loading, }) const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.json' - , 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json'] + , 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json'] const cacheInterceptorUrlMap = {} class TPMIndex extends Component { - constructor(props) { - super(props) - this.state = { - loadingContent: false, - power: false, - shixunsDetails: {}, - shixunId: undefined, - star_info: [0, 0, 0, 0, 0, 0], - star_infos: [0, 0, 0, 0, 0, 0], - identity: undefined, - TPMRightSectionData: undefined, - PropaedeuticsList: undefined, - tpmindexjupyterbool: false, - is_jupyter: false, - selectedKeys: "", - openknows: false, - newathArray: [] + constructor(props) { + super(props) + this.state = { + loadingContent: false, + power: false, + shixunsDetails: {}, + shixunId: undefined, + star_info: [0, 0, 0, 0, 0, 0], + star_infos: [0, 0, 0, 0, 0, 0], + identity:undefined, + TPMRightSectionData:undefined, + PropaedeuticsList: undefined, + tpmindexjupyterbool:false, + is_jupyter:false, + selectedKeys:"", + openknows:false, + newathArray:[] + } } - } - openknow = () => { - let storage = window.localStorage; - this.setState({ - openknows: false - }) - let newTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings' - storage.setItem(newTPMsettings, false); - } + openknow=()=>{ + let storage=window.localStorage; + this.setState({ + openknows:false + }) + let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings' + storage.setItem(newTPMsettings,false); + } componentDidUpdate(prevProps, prevState) { - if (prevProps != this.props) { - if (this.props.user && this.props.user.user_id) { - let getnewTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings'; - let newTPMsettings = window.localStorage.getItem(getnewTPMsettings) - if (newTPMsettings === undefined || newTPMsettings === false || newTPMsettings === null) { - this.setState({ - openknows: false - }) - } else { - this.setState({ - openknows: false - }) + if (prevProps!=this.props) { + if(this.props.user&&this.props.user.user_id){ + let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; + let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) + if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ + this.setState({ + openknows:false + }) + }else{ + this.setState({ + openknows:false + }) + } } } } - } - getcomponentdidmount = () => { - let userid = this.props.user && this.props.user.user_id; - let getnewTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings'; - let newTPMsettings = window.localStorage.getItem(getnewTPMsettings) - let id = this.props.match.params.shixunId; - // console.log('props', this.props); - // let collaborators = `/shixuns/` + id + `/propaedeutics.json`; - // - // axios.get(collaborators).then((response) => { - // if (response.status === 200) { - // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - // - // }else{ - // this.setState({ - // PropaedeuticsList: response.data, - // shixunId: id - // }); - // } - // - // } - // }).catch((error) => { - // console.log(error) - // }); - let Url = `/shixuns/` + id + `.json`; - axios.get(Url).then((response) => { - if (response.status === 200) { - document.title = response.data.name; - let newstar_info = []; - // let start1= - for (var i = 0; i < response.data.score_info.length; i++) { - - if (i === 0) { - newstar_info.push(response.data.score_info[i]) - } else { - newstar_info.push((response.data.score_info[i] / 100) * 5) + getcomponentdidmount=()=>{ + let userid=this.props.user&&this.props.user.user_id; + let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; + let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) + let id = this.props.match.params.shixunId; + // console.log('props', this.props); + // let collaborators = `/shixuns/` + id + `/propaedeutics.json`; + // + // axios.get(collaborators).then((response) => { + // if (response.status === 200) { + // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + // + // }else{ + // this.setState({ + // PropaedeuticsList: response.data, + // shixunId: id + // }); + // } + // + // } + // }).catch((error) => { + // console.log(error) + // }); + let Url = `/shixuns/` + id + `.json`; + axios.get(Url).then((response) => { + if (response.status === 200) { + document.title=response.data.name; + let newstar_info = []; + // let start1= + for (var i = 0; i < response.data.score_info.length; i++) { + + if (i === 0) { + newstar_info.push(response.data.score_info[i]) + } else { + newstar_info.push((response.data.score_info[i] / 100) * 5) + } } + let newstar_infos = response.data.score_info; + this.setState({ + shixunsDetails: response.data, + shixunId: id, + star_info: newstar_info, + star_infos: newstar_infos, + power: response.data.power, + identity: response.data.identity, + propaedeutics:response.data.propaedeutics, + status: response.data.shixun_status, + secret_repository: response.data.secret_repository, + public:response.data.public, + is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter, + }); + + if(userid){ + if(response.data.identity <4){ + if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ + console.log() + this.setState({ + openknows:true + }) + }else{ + this.setState({ + openknows:false + }) + } + } + } + } - let newstar_infos = response.data.score_info; + }).catch((error) => { this.setState({ - shixunsDetails: response.data, - shixunId: id, - star_info: newstar_info, - star_infos: newstar_infos, - power: response.data.power, - identity: response.data.identity, - propaedeutics: response.data.propaedeutics, - status: response.data.shixun_status, - secret_repository: response.data.secret_repository, - public: response.data.public, - is_jupyter: response.data.is_jupyter === undefined || response.data.is_jupyter === null ? false : response.data.is_jupyter, + shixunsDetails: undefined, + shixunId: undefined, + star_info: undefined, + star_infos: undefined, + power: undefined, + identity: undefined, + status: undefined, + propaedeutics:undefined, + is_jupyter:false, }); + }); - if (userid) { - if (response.data.identity < 4) { - if (newTPMsettings === undefined || newTPMsettings === false || newTPMsettings === null) { - console.log() - this.setState({ - openknows: true - }) - } else { - this.setState({ - openknows: false - }) - } - } + // this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => { + // let url = config.url; + // // console.log('tpmContentRequestInterceptor:', url) + // for ( let i = 0; i < interceptorUrlArray.length; i++ ) { + // if (url.indexOf(interceptorUrlArray[i]) != -1) { + // url = url.split('?')[0] + // console.log('loadingContent, url:', url) + // + // this.setState({ loadingContent: true }) + // + // cacheInterceptorUrlMap[url] = true + // } + // } + // return config; + // }, function (error) { + // return Promise.reject(error); + // }); + + // Add a response interceptor + this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => { + // console.log('loadingContent finished, url:', response.config.url) + // TODO 依赖了api这个前缀 + let url = response.config.url.split('api')[1]; + url = url.split('?')[0] + if (cacheInterceptorUrlMap[url]) { + + this.setState({ loadingContent: false }) + delete cacheInterceptorUrlMap[response.url] } - - } - }).catch((error) => { - this.setState({ - shixunsDetails: undefined, - shixunId: undefined, - star_info: undefined, - star_infos: undefined, - power: undefined, - identity: undefined, - status: undefined, - propaedeutics: undefined, - is_jupyter: false, + return response; + }, function (error) { + // Do something with response error + return Promise.reject(error); }); - }); + //右侧数据 + let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; + axios.get(shixunsDetailsURL).then((response)=> { + if(response.data){ - //右侧数据 - let shixunsDetailsURL = `/shixuns/` + id + `/show_right.json`; - axios.get(shixunsDetailsURL).then((response) => { - if (response.data) { + } + this.setState({ + TPMRightSectionData: response.data + }); + }) + this.getnavdatas() + } + componentDidMount = () => { + this.getcomponentdidmount() - } - this.setState({ - TPMRightSectionData: response.data - }); - }) - this.getnavdatas() - } - componentDidMount = () => { - this.getcomponentdidmount() + } - } + componentWillUnmount = () => { + axios.interceptors.request.eject(this.tpmContentRequestInterceptor); + this.tpmContentRequestInterceptor = null; + axios.interceptors.request.eject(this.tpmContentResponseInterceptor); + this.tpmContentResponseInterceptor = null; + // this.getnavdatas() + } - setLoadingContent = (isLoadingContent) => { - // this.setState({ loadingContent: isLoadingContent }) - } + setLoadingContent = (isLoadingContent) => { + // this.setState({ loadingContent: isLoadingContent }) + } - getnavdatas = () => { - let selectedKeys; - const { location } = this.props; - if (location.pathname.indexOf('/challenges') != -1) { - selectedKeys = "1" - } else if (location.pathname.indexOf('/propaedeutics') != -1) { - selectedKeys = "2" - } else if (location.pathname.indexOf('/repository') != -1) { - selectedKeys = "3" - } else if (location.pathname.indexOf('/secret_repository') != -1) { - selectedKeys = "4" - } else if (location.pathname.indexOf('/collaborators') != -1) { - selectedKeys = "5" - } else if (location.pathname.indexOf('/dataset') != -1) { - selectedKeys = "6" - } else if (location.pathname.indexOf('/shixun_discuss') != -1) { - selectedKeys = "7" - } else if (location.pathname.indexOf('/ranking_list') != -1) { - selectedKeys = "8" - } else if (location.pathname.indexOf('/settings') != -1) { - selectedKeys = "9" + getnavdatas=()=>{ + let selectedKeys; + const {location} = this.props; + if(location.pathname.indexOf('/challenges')!=-1){ + selectedKeys="1" + }else if(location.pathname.indexOf('/propaedeutics')!=-1){ + selectedKeys="2" + }else if(location.pathname.indexOf('/repository')!=-1){ + selectedKeys="3" + }else if(location.pathname.indexOf('/secret_repository')!=-1){ + selectedKeys="4" + } else if(location.pathname.indexOf('/collaborators')!=-1){ + selectedKeys="5" + }else if(location.pathname.indexOf('/dataset')!=-1){ + selectedKeys="6" + }else if(location.pathname.indexOf('/shixun_discuss')!=-1){ + selectedKeys="7" + }else if(location.pathname.indexOf('/ranking_list')!=-1){ + selectedKeys="8" + }else if(location.pathname.indexOf('/settings')!=-1){ + selectedKeys="9" + } + this.setState({ + selectedKeys:selectedKeys + }) } - this.setState({ - selectedKeys: selectedKeys - }) - } - handleClick = (e) => { + handleClick=(e)=>{ this.setState({ selectedKeys: e.key, }); let id = this.props.match.params.shixunId; - if (e.key === "1") { + if(e.key==="1"){ this.props.history.replace(`/shixuns/${id}/challenges`); - } else if (e.key === "2") { + }else if(e.key==="2"){ this.props.history.replace(`/shixuns/${id}/propaedeutics`); - } else if (e.key === "3") { + }else if(e.key==="3"){ // window.location.href=`/shixuns/${id}/repository`; - this.props.history.push(`/shixuns/${id}/repository`); - } else if (e.key === "4") { + this.props.history.push(`/shixuns/${id}/repository`); + }else if(e.key==="4"){ // window.location.href=`/shixuns/${id}/secret_repository`; this.props.history.push(`/shixuns/${id}/secret_repository`); - } else if (e.key === "5") { + }else if(e.key==="5"){ this.props.history.replace(`/shixuns/${id}/collaborators`); - } else if (e.key === "6") { + }else if(e.key==="6"){ this.props.history.replace(`/shixuns/${id}/dataset`); - } else if (e.key === "7") { + }else if(e.key==="7"){ this.props.history.replace(`/shixuns/${id}/shixun_discuss`); - } else if (e.key === "8") { + }else if(e.key==="8"){ this.props.history.replace(`/shixuns/${id}/ranking_list`); - } else if (e.key === "9") { + }else if(e.key==="9"){ this.props.history.replace(`/shixuns/${id}/settings`); } } - setpathArray = (list) => { - this.setState({ - newathArray: list - }) + setpathArray=(list)=>{ + this.setState({ + newathArray:list + }) } - render() { - - let url = window.location.href; - let flag = false; - // url.indexOf("add_file")>-1; - - return ( -
    - {/*头部*/} - { - !flag && - this.getcomponentdidmount()} - > - } + render() { + + let url = window.location.href; + let flag =false; + // url.indexOf("add_file")>-1; + + return ( +
    + {/*头部*/} + { + !flag && + this.getcomponentdidmount()} + > + } - - -
    - - - - - - 任务 - - - {this.state.propaedeutics === undefined ? "" : this.state.propaedeutics === false ? "" : - 背景知识 - } - - {this.state.identity > 4 || this.state.identity === undefined ? "" : - this.state.is_jupyter === false ? - 版本库 - : ""} - - {this.state.identity > 4 || this.state.identity === undefined ? "" : this.state.secret_repository && - 私密版本库 - } - - - 合作者 - - - {this.state.identity > 4 || this.state.identity === undefined ? "" : this.state.is_jupyter === true ? - 数据集 - : ""} - - {this.state.is_jupyter === false ? - 评论 - : ""} - - {this.state.is_jupyter === false ? - 排行榜 - : ""} - {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} - {/* */} - {/*
    更多设置在这里,点击“配置”看一看~
    */} - {/*
    */} - {/* */} - {/* }*/} - {/* trigger="click"*/} - {/* placement="top"*/} - {/* visible={this.state.openknows}*/} - {/* >*/} - {/* */} - {/*
    :""}*/} - - {this.state.identity > 4 || this.state.identity === undefined ? "" : - - 配置 - - } - - {this.state.identity > 2 || this.state.identity === undefined ? "" : -
    - 审核情况 + } + + +
    + + + + + + 任务 + + + { this.state.propaedeutics===undefined?"":this.state.propaedeutics===false?"": + 背景知识 + } + + { this.state.identity >4||this.state.identity===undefined ?"": + this.state.is_jupyter===false? + 版本库 + :""} + + {this.state.identity >4||this.state.identity===undefined ?"": this.state.secret_repository && + 私密版本库 + } + + + 合作者 + + + { this.state.identity >4||this.state.identity===undefined ? "":this.state.is_jupyter===true? + 数据集 + :""} + + { this.state.is_jupyter===false? + 评论 + :""} + + { this.state.is_jupyter===false? + 排行榜 + :""} + {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} + {/* */} + {/*
    更多设置在这里,点击“配置”看一看~
    */} + {/*
    */} + {/* */} + {/* }*/} + {/* trigger="click"*/} + {/* placement="top"*/} + {/* visible={this.state.openknows}*/} + {/* >*/} + {/* */} + {/*
    :""}*/} + + {this.state.identity >4||this.state.identity===undefined ? "": + + 配置 + + } + + {this.state.identity >2||this.state.identity===undefined?"": +
    + 审核情况 +
    + } +
    +
    - } -
    - -
    -
    + - {/*筛选*/} - {/*{*/} - {/* tpmindexjupyterbool===false?*/} + {/*筛选*/} + {/*{*/} + {/* tpmindexjupyterbool===false?*/} - {/* :""*/} - {/*}*/} - {/* */} - - + {/* :""*/} + {/*}*/} + {/* */} - () - }> - () - }> - {/*任务*/} - () - }> - - () - }> - - () - }> - - () - }> - - () - }> - - - ( this.setpathArray(value)} - />) - }> - - ( this.setpathArray(value)} - />) - }> - - - ( this.setpathArray(value)} - />) - }> - - - ( this.setpathArray(value)} - />) - }> - - - {/* */} - - () - }> - - - () - }> - - - {/* */} - - - ( this.initForumState(data)} - setSearchValue={this.setSearchValue} - setHotLabelIndex={this.setHotLabelIndex} - />) - }> - - - ( this.getcomponentdidmount()} />) - }> - - {/*实训项目条目塞选*/} - () - }> - {/*合作者*/} - () - }> - - () - }> - - () - }> + - () - }> + () + }> + () + }> + {/*任务*/} + () + }> - {/*评测设置*/} - () - }> + () + }> + + () + }> + + () + }> + + () + }> - {/*参考答案*/} - () - }> + (this.setpathArray(value)} + />) + }> + + (this.setpathArray(value)} + />) + }> + + + (this.setpathArray(value)} + />) + }> + + + (this.setpathArray(value)} + />) + }> + + + {/* */} + + () + }> + + + () + }> + + + {/* */} + + + (this.initForumState(data)} + setSearchValue={this.setSearchValue} + setHotLabelIndex={this.setHotLabelIndex} + />) + }> + + + (this.getcomponentdidmount()} />) + }> + + {/*实训项目条目塞选*/} + () + }> + {/*合作者*/} + () + }> + + () + }> + + () + }> - {/*新建关卡*/} - () - }> + () + }> - {/*编辑关卡*/} - () - }> + {/*评测设置*/} + () + }> - {/*新建选择题*/} - () - }> - {/*修改选择题*/} - () - }> + {/*参考答案*/} + () + }> - {/*修改选择题*/} - () - }> + {/*新建关卡*/} + () + }> - () - }> + {/*编辑关卡*/} + () + }> + {/*新建选择题*/} + () + }> - {/**/} - + {/*修改选择题*/} + () + }> -
    - ); - } + {/*修改选择题*/} + () + }> + + () + }> + + + {/**/} + + +
    + ); + } } -export default SnackbarHOC()(TPMIndexHOC(TPMIndex)); +export default SnackbarHOC() (TPMIndexHOC ( TPMIndex )); From 957b3bf10be5b37bde0958d1b0d561f94a7a4d65 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Wed, 18 Mar 2020 22:19:36 +0800 Subject: [PATCH 48/95] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E7=9C=8B=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index 32dd60819..49127a01f 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -49,7 +49,9 @@ class CreateWatchVideoService < ApplicationService if !watch_course_video.is_finished # 更新课程视频的时长及是否看完状态 watch_course_video.watch_duration = params[:watch_duration] if watch_course_video.watch_duration < params[:watch_duration] - watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration if params[:ed].present? + if params[:ed].present? || (watch_course_video.duration >= 300 && (watch_course_video.duration - params[:point].to_i) <= 20) + watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration + end end watch_course_video.save! end From 542fce1e82d2aef179b495a3068a4924e5f37e2e Mon Sep 17 00:00:00 2001 From: anke1460 Date: Wed, 18 Mar 2020 22:32:23 +0800 Subject: [PATCH 49/95] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E6=97=B6=E9=95=BF=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index 49127a01f..4629d9c8e 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -16,11 +16,11 @@ class CreateWatchVideoService < ApplicationService if params[:log_id].present? watch_video_history = user.watch_video_histories.find(params[:log_id]) - if params[:total_duration] < params[:watch_duration] - return watch_video_history - end + # if params[:total_duration] < params[:watch_duration] + # return watch_video_history + # end # 更新观看时长 - if watch_video_history.present? && !watch_video_history.is_finished && watch_video_history.watch_duration <= params[:watch_duration] && watch_video_history.total_duration <= params[:total_duration] + if watch_video_history.present? && !watch_video_history.is_finished && watch_video_history.total_duration <= params[:total_duration] # 如果观看总时长没变,说明视频没有播放,无需再去记录 watch_video_history.end_at = current_time watch_video_history.total_duration = params[:total_duration] From bfc75fbbc6be3849c4934b0f25a252e227cca5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 18 Mar 2020 22:41:52 +0800 Subject: [PATCH 50/95] =?UTF-8?q?=E6=99=AE=E9=80=9A/=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=89=8D=E7=AB=AF=E8=80=81=E5=B8=88=E8=A7=86?= =?UTF-8?q?=E8=A7=92=E7=9A=84=E8=AF=84=E9=98=85=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=AE=E5=8A=A8=E6=98=BE=E7=A4=BA=E2=80=9C?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E4=B8=AA=E8=AF=84=E9=98=85=E2=80=9D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkAppraise.js | 94 +++++++++++++++++-- .../busyWork/reply/CommonWorkAppraiseReply.js | 18 ++-- .../GraduationTasksappraiseMainEditor.js | 3 + 3 files changed, 98 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 60194c744..7e28ef899 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -2,6 +2,7 @@ import '../katex.css'; import '../css/Courses.css'; import React,{Component} from "react"; import {markdownToHTML, ImageLayer2 } from 'educoder'; +import {Button, Row, Col} from "antd"; import axios from 'axios'; import Modals from '../../modals/Modals'; import moment from 'moment'; @@ -19,10 +20,10 @@ class CommonWorkAppraise extends Component{ course_name:"", homework_name:"", search: '', - - + get_next_work:undefined, attachments: [], revise_attachments: [], + get_next_worktype:false } } getWork = () => { @@ -87,6 +88,34 @@ class CommonWorkAppraise extends Component{ this.getReviseAttachments() } + get_next_works=(id)=>{ + let workId =this.props.match.params.workId; + let url + if(id){ + url=`/homework_commons/${workId}/get_next_work.json?work_id=${id}`; + }else{ + url=`/homework_commons/${workId}/get_next_work.json`; + } + axios.get(url).then((result)=> { + this.setState({ + get_next_work:result.data, + get_next_worktype:true + }) + }).catch((error)=>{ + console.log(error) + }) + } + + gotoget_next_work=(id)=>{ + if(this.props.match.path===`/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/appraise`){ + this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`); + } + + if(this.props.match.path===`/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise`){ + this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`); + } + } + onAttachmentRemove = (id) => { this.setState({ Modalstype:true, @@ -128,22 +157,21 @@ class CommonWorkAppraise extends Component{ } render(){ - const dateFormat = 'YYYY-MM-DD HH:mm'; - - let {course_name, homework_name, search, page, loadingstate, homework_status, reference_answer, - attachments, homework_id, project_info, work_members, is_evaluation, + let {course_name, get_next_work,get_next_worktype, + attachments, project_info, work_members, is_evaluation, description, update_user_name, commit_user_name, update_time, commit_time, author_name, - revise_attachments, revise_reason, atta_update_user, atta_update_time, atta_update_user_login, Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype, is_leader_work } =this.state; - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; + // let courseId=this.props.match.params.coursesId; + // let category_id=this.props.match.params.category_id; let studentWorkId=this.props.match.params.studentWorkId; const isAdmin = this.props.isAdmin() document.title=course_name&&course_name; return( +
    + {this.commonWorkAppraiseReply = ref}} + get_next_works={()=>this.get_next_works()} >
    + {isAdmin===true&&get_next_worktype===true?:""} + + {isAdmin===true&&get_next_worktype===true?
    + +
    +
    + + + + {get_next_work&&get_next_work.work_id===null? + +
    已全部评阅完
    +
    : +
    {get_next_work&&get_next_work?`下一位待评阅人员:${get_next_work&&get_next_work.user_name}`:""}
    + this.get_next_works(get_next_work&&get_next_work.work_id)}>跳过 +
    } + + {get_next_work&&get_next_work.work_id===null?"": + + + + + + } +
    + +
    +
    +
    :""} +
    ) } } diff --git a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js index 3d3f83bc6..0a1f38965 100644 --- a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js +++ b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js @@ -20,7 +20,7 @@ import Modals from '../../../modals/Modals'; const REPLY_PAGE_COUNT = 10 const $ = window.$; -/* +/* */ class CommonWorkAppraiseReply extends Component{ @@ -79,7 +79,7 @@ class CommonWorkAppraiseReply extends Component{ reply.journals.push(reply.appeal_info) reply.journals = _.orderBy(reply.journals, 'time', 'asc') } - + return { isSuperAdmin: isSuperAdmin, admin: isAdmin, // @@ -93,7 +93,7 @@ class CommonWorkAppraiseReply extends Component{ // time: moment(reply.comment_time).fromNow(), time: moment(reply.comment_time).format('YYYY-MM-DD HH:mm'), - image_url: reply.user_image_url, + image_url: reply.user_image_url, user_id: reply.user_id, user_login: reply.user_login, username: reply.user_name, @@ -131,7 +131,7 @@ class CommonWorkAppraiseReply extends Component{ console.log('Cancel'); }, }); - + } showModulationtype=(id)=>{ @@ -221,6 +221,7 @@ class CommonWorkAppraiseReply extends Component{ if (!needNiPingEditor && comment_scores.length == 0) { return '' } + return(
    @@ -257,13 +258,13 @@ class CommonWorkAppraiseReply extends Component{ {/*{this.props.isStudent()?补交附件:""}*/} {/*
    */} - + {/* { - (!!comment_scores.length && + (!!comment_scores.length &&
    全部评阅 - ({comment_scores.length}) + ({comment_scores.length})
    )} */}
    {!!comment_scores.length &&
    @@ -283,13 +284,14 @@ class CommonWorkAppraiseReply extends Component{ addSuccess={this.addSuccess} ref={this.editorRef} totalCount={comment_scores.length} onReply={this.onReply} placeholder={"请在此输入对本作品的评语,最大限制2000个字符"} showSameScore={isGroup && isAdmin} + get_next_works={()=>this.props.get_next_works()} > }
    {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */}
    - {/* + {/* .course-message .panel-comment_item { margin-top: ${needNiPingEditor ? 56 : 28}px; } diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js index faf0d67a4..6b3f9ecdd 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js @@ -67,6 +67,9 @@ class GraduationTasksappraiseMainEditor extends Component{ same_score } if (this.props.onReply) { + if(this.props.get_next_works){ + this.props.get_next_works() + } this.props.onReply(params) } else { axios.post(url, params).then((response)=>{ From bb68c3cff82506ceaccc07276bc2d9c97ca41a4b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 22:41:56 +0800 Subject: [PATCH 51/95] =?UTF-8?q?=E4=BD=9C=E5=93=81=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E6=97=B6=E5=88=A0=E9=99=A4=E7=9B=B8=E5=85=B3=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E9=98=85=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 8713bebf3..655912d97 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -27,9 +27,15 @@ class MyshixunsController < ApplicationController ActiveRecord::Base.transaction do @myshixun.destroy! + StudentWork.where(:myshixun_id => @myshixun.id).includes(:shixun_work_comments, :student_works_scores, :challenge_work_scores).each do |work| + work.shixun_work_comments.destroy_all + work.student_works_scores.destroy_all + work.challenge_work_scores.destroy_all + end + StudentWork.where(:myshixun_id => @myshixun.id) .update_all(myshixun_id: 0, work_status: 0, work_score: nil, - final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: -1) + final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, ultimate_score: 0, cost_time: 0, compelete_status: -1) end # 删除版本库 GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type? From 7616079e6180bafdc8da5463b837fbdcc30ca44a Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 23:09:58 +0800 Subject: [PATCH 52/95] fix --- public/react/src/modules/courses/Video/video-play/index.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx index bfa56c938..77c64f73c 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -14,7 +14,7 @@ function getTotalEffectTime(pos) { pos.sort(compareNumbers) let sum = 0 for (let i = 0; i < pos.length - 1; i++) { - let v = pos[i + 1] - pos[i] + let v = Math.abs(pos[i + 1] - pos[i]) if (v < 21) { sum += v } @@ -115,6 +115,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { } //循环播放, 累计时长不能清空 async function onEnded() { + pos.push(el.current.currentTime) log(() => { logId = null lastUpdatedTime = 0 @@ -180,6 +181,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { el.current.removeEventListener('seeked', onSeeked) el.current.removeEventListener('timeupdate', onTimeupdate) if (el.current.playing) { + pos.push(lastUpdatedTime, el.current.currentTime) log() } } From 1d3c6ad9727bea97c0ddd78edc74a80b49542b15 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 23:17:00 +0800 Subject: [PATCH 53/95] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E4=BD=9C=E5=93=81=E7=9A=84=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 98be8c699..e5df1f6ad 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -289,11 +289,11 @@ class HomeworkCommonsController < ApplicationController def get_next_work member = @course.course_member(current_user.id) - student_works = @homework.teacher_works(member).where.not(id: @homework.student_works_scores.where(reviewer_role: [1, 2])) + student_works = @homework.teacher_works(member).where.not(id: @homework.student_works_scores.where(reviewer_role: [1, 2]).pluck(:student_work_id)) if params[:work_id] student_works = student_works.where.not(id: params[:work_id]) end - @work = student_works.where("work_status > 0").take + @work = student_works.where("work_status > 0").sample(1).first end def update_score From 735b82d56315bad4e772b2cee5105f867aabe1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 19 Mar 2020 00:13:41 +0800 Subject: [PATCH 54/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/busyWork/CommonWorkAppraise.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 7e28ef899..75fbaaab4 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -94,7 +94,7 @@ class CommonWorkAppraise extends Component{ if(id){ url=`/homework_commons/${workId}/get_next_work.json?work_id=${id}`; }else{ - url=`/homework_commons/${workId}/get_next_work.json`; + url=`/homework_commons/${workId}/get_next_work.json?work_id=${this.props.match.params.studentWorkId}`; } axios.get(url).then((result)=> { this.setState({ @@ -114,6 +114,9 @@ class CommonWorkAppraise extends Component{ if(this.props.match.path===`/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise`){ this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`); } + this.setState({ + get_next_worktype:false + }) } onAttachmentRemove = (id) => { @@ -332,7 +335,7 @@ class CommonWorkAppraise extends Component{
    已全部评阅完
    : -
    {get_next_work&&get_next_work?`下一位待评阅人员:${get_next_work&&get_next_work.user_name}`:""}
    +
    {get_next_work&&get_next_work?`下一位待评阅人员:${get_next_work&&get_next_work.user_name}`:""}
    this.get_next_works(get_next_work&&get_next_work.work_id)}>跳过
    } From 8ff48585676a40abaf67f660dec3cc5aa6b3033b Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 19 Mar 2020 00:42:12 +0800 Subject: [PATCH 55/95] .. --- Gemfile | 3 +-- lib/tasks/sync_video.rake | 0 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 lib/tasks/sync_video.rake diff --git a/Gemfile b/Gemfile index 26767b091..f9d9e3c06 100644 --- a/Gemfile +++ b/Gemfile @@ -90,7 +90,6 @@ gem 'rails-i18n', '~> 5.1' # job gem 'sidekiq' gem 'sinatra' -gem "sidekiq-cron", "~> 1.1" # batch insert gem 'bulk_insert' @@ -113,4 +112,4 @@ gem 'request_store' # 敏感词汇 gem 'harmonious_dictionary', '~> 0.0.1' -gem 'parallel', '~> 1.19', '>= 1.19.1' +gem 'parallel', '~> 1.19', '>= 1.19.1' \ No newline at end of file diff --git a/lib/tasks/sync_video.rake b/lib/tasks/sync_video.rake new file mode 100644 index 000000000..e69de29bb From 223eedaedb62cbcaf10a821bab33be0e60ac65b9 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 19 Mar 2020 00:43:53 +0800 Subject: [PATCH 56/95] =?UTF-8?q?=E4=B8=8A=E7=BA=BF=E4=B8=8D=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/sidekiq.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 90dedac1b..b3f2d0576 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,5 +1,3 @@ -require 'sidekiq/web' -require 'sidekiq/cron/web' redis_config = Rails.application.config_for(:redis) sidekiq_url = redis_config["url"] @@ -10,9 +8,3 @@ end Sidekiq.configure_client do |config| config.redis = { url: sidekiq_url } end - -schedule_file = "config/schedule.yml" - -if File.exists?(schedule_file) && Sidekiq.server? - Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) -end \ No newline at end of file From 67f27dda9257b5549fb95048d98da68aac5d149e Mon Sep 17 00:00:00 2001 From: harry Date: Thu, 19 Mar 2020 01:06:36 +0800 Subject: [PATCH 57/95] fix --- public/react/src/modules/courses/Video/video-play/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx index 77c64f73c..5fb87cc0f 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -130,7 +130,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { let newTime = el.current.currentTime let timeDiff = newTime - lastUpdatedTime //currenttime update before Seeking & Seeked fired - if (Math.abs(timeDiff) < 0.5) { + if (Math.abs(timeDiff) < 10) { sumTimePlayed += Math.abs(timeDiff) lastUpdatedTime = newTime if (!isLoging) { From 495cebdd257dc9f767a916fd466ab9a952e3c0d9 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 19 Mar 2020 02:36:23 +0800 Subject: [PATCH 58/95] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 7 ++++++- app/services/videos/batch_publish_service.rb | 13 ++++++++++--- db/migrate/20200318181442_add_duration_to_video.rb | 5 +++++ lib/tasks/get_video_data.rake | 13 +++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20200318181442_add_duration_to_video.rb diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index 4629d9c8e..4920374dc 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -50,7 +50,12 @@ class CreateWatchVideoService < ApplicationService # 更新课程视频的时长及是否看完状态 watch_course_video.watch_duration = params[:watch_duration] if watch_course_video.watch_duration < params[:watch_duration] if params[:ed].present? || (watch_course_video.duration >= 300 && (watch_course_video.duration - params[:point].to_i) <= 20) - watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration + video_duration = watch_video_history.video.duration.to_i + if video_duration > 0 + watch_course_video.is_finished = watch_course_video.total_duration >= video_duration + else + watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration + end end end watch_course_video.save! diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 553ffe4f2..1c3795102 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,16 +31,23 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) + + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}") if code_info[:format] == "mp4" && code_info[:codecnamne].present? && code_info[:codecnamne].start_with?('h264') video.transcoded = true - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] if result.present? - video.play_url = play_url + if result.present? && result['PlayInfoList']['PlayInfo'].first['PlayURL'] + play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] + video.play_url = play_url + end else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end + if result.present? + video.duration = result["VideoBase"]["Duration"] if result["VideoBase"]["Duration"] + end + video.save! if param[:course_id].present? diff --git a/db/migrate/20200318181442_add_duration_to_video.rb b/db/migrate/20200318181442_add_duration_to_video.rb new file mode 100644 index 000000000..caf3a70e9 --- /dev/null +++ b/db/migrate/20200318181442_add_duration_to_video.rb @@ -0,0 +1,5 @@ +class AddDurationToVideo < ActiveRecord::Migration[5.2] + def change + add_column :videos, :duration, :float, default: 0 + end +end diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index f6f85c7d5..3a86273ec 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -74,4 +74,17 @@ namespace :video do end end end + + + task :set_duration => :environment do + videos = Video.published.where("duration = 0") + videos.find_each do |v| + result = AliyunVod::Service.get_play_info(v.uuid) + if result.present? && result["VideoBase"]["Duration"].present? + p '-----#{v.id} , #{result["VideoBase"]["Duration"]]}' + video.update(duration: result["VideoBase"]["Duration"]) + end + end + + end end \ No newline at end of file From 1e84cf48af09860f3e76dfae2adcd7aa9f3660d4 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 19 Mar 2020 02:39:06 +0800 Subject: [PATCH 59/95] fix --- lib/tasks/get_video_data.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index 3a86273ec..3de199502 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -82,7 +82,7 @@ namespace :video do result = AliyunVod::Service.get_play_info(v.uuid) if result.present? && result["VideoBase"]["Duration"].present? p '-----#{v.id} , #{result["VideoBase"]["Duration"]]}' - video.update(duration: result["VideoBase"]["Duration"]) + v.update(duration: result["VideoBase"]["Duration"]) end end From 81de79240842e393a3c085d9d7813ae53e942c35 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 19 Mar 2020 02:46:36 +0800 Subject: [PATCH 60/95] fix --- app/services/videos/batch_publish_service.rb | 4 ++-- lib/tasks/get_video_data.rake | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 1c3795102..3ddc54967 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,7 +31,7 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}") if code_info[:format] == "mp4" && code_info[:codecnamne].present? && code_info[:codecnamne].start_with?('h264') @@ -45,7 +45,7 @@ class Videos::BatchPublishService < ApplicationService end if result.present? - video.duration = result["VideoBase"]["Duration"] if result["VideoBase"]["Duration"] + video.duration = result['PlayInfoList']['PlayInfo'][0]['Duration'] if result['PlayInfoList']['PlayInfo'][0]['Duration'].present? end video.save! diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index 3de199502..efb89e99e 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -80,9 +80,9 @@ namespace :video do videos = Video.published.where("duration = 0") videos.find_each do |v| result = AliyunVod::Service.get_play_info(v.uuid) - if result.present? && result["VideoBase"]["Duration"].present? - p '-----#{v.id} , #{result["VideoBase"]["Duration"]]}' - v.update(duration: result["VideoBase"]["Duration"]) + if result.present? && result['PlayInfoList']['PlayInfo'][0]['Duration'].present? + p "-----#{v.id} , #{result['PlayInfoList']['PlayInfo'][0]['Duration']}" + v.update(duration: result['PlayInfoList']['PlayInfo'][0]['Duration']) end end From 208716a5bd260071de6575652678b3efa0e85194 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 19 Mar 2020 03:20:39 +0800 Subject: [PATCH 61/95] fix --- app/services/create_watch_video_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index 4920374dc..f637a2126 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -52,9 +52,9 @@ class CreateWatchVideoService < ApplicationService if params[:ed].present? || (watch_course_video.duration >= 300 && (watch_course_video.duration - params[:point].to_i) <= 20) video_duration = watch_video_history.video.duration.to_i if video_duration > 0 - watch_course_video.is_finished = watch_course_video.total_duration >= video_duration + watch_course_video.is_finished = watch_course_video.total_duration.to_i >= video_duration else - watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration + watch_course_video.is_finished = watch_course_video.total_duration.to_i >= watch_course_video.duration.to_i end end end From 1c2deccd1425a677d9677b3a53da7cbe7d96e2b3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 19 Mar 2020 09:40:15 +0800 Subject: [PATCH 62/95] =?UTF-8?q?=E6=95=8F=E6=84=9F=E8=AF=8D=E6=B1=87?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chinese_dictionary.txt | 5 +---- config/harmonious_dictionary/harmonious.hash | Bin 46209 -> 46331 bytes 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/config/harmonious_dictionary/chinese_dictionary.txt b/config/harmonious_dictionary/chinese_dictionary.txt index 2bd91e8d2..fd7278dfc 100644 --- a/config/harmonious_dictionary/chinese_dictionary.txt +++ b/config/harmonious_dictionary/chinese_dictionary.txt @@ -518,7 +518,6 @@ H漫画 胡启立 芮杏文 杨白冰 -邹家华 谭绍文 王汉斌 任建新 @@ -1377,6 +1376,4 @@ B样 垃 圾 傻 逼 真蠢 -蠢猪 - - +蠢猪 \ No newline at end of file diff --git a/config/harmonious_dictionary/harmonious.hash b/config/harmonious_dictionary/harmonious.hash index 67e985d4c9cb4de4c6f9b4a21b7aa66fde07a2a5..8d906ec53549e61dc7b7f4f9340c5bba023062b2 100644 GIT binary patch delta 166 zcmZpC$@Kdr6DtcxHIwB=*2R%x?4C*-&zCi_Su=!Gvstr+0J$&LF5A35(n@2qK+^;c zMvln~yIh%HELgPpR@ZMeRt`@kHmAuKx}})d6eh=sN^JhRv4?5$19^GxdCg!$Kn6aY Yvk%EYHU$U=LxKZnDqQM$&nmbc0E8AG!``4&lR f{?RyrgOPo5XP4{dyIt?qfXuTSSY1|Qv)6O From 32d475c4c910cf362f6856003cce19f66a376b27 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Mar 2020 12:23:22 +0800 Subject: [PATCH 63/95] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=B8=AD=EF=BC=8C=E5=90=8E=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E5=AD=A6=E7=94=9F=E4=B8=8D=E9=9C=80=E8=A6=81=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=86=8D=E5=88=97=E8=A1=A8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../course_member_attendances_controller.rb | 42 +++++++++++-------- .../index.json.jbuilder | 19 +++++---- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/app/controllers/weapps/course_member_attendances_controller.rb b/app/controllers/weapps/course_member_attendances_controller.rb index 254a89b1d..3dde09dbe 100644 --- a/app/controllers/weapps/course_member_attendances_controller.rb +++ b/app/controllers/weapps/course_member_attendances_controller.rb @@ -4,30 +4,36 @@ class Weapps::CourseMemberAttendancesController < ApplicationController def index attendance = CourseAttendance.find params[:attendance_id] - if attendance.course_attendance_groups.first&.course_group_id.to_i == 0 - @members = attendance.course.students - else - @members = attendance.course.students.where(course_group_id: attendance.course_attendance_groups.pluck(:course_group_id)) - end - @member_attendances = attendance.course_member_attendances - if params[:group_ids].present? - @members = @members.where(course_group_id: params[:group_ids]) - end @page = params[:page] || 1 @limit = params[:limit] || 5 - if params[:attendance_status].present? - @members = @members.joins(:course_member_attendances).where(course_member_attendances: {course_attendance_id: attendance.id, attendance_status: params[:attendance_status]}) + @member_attendances = attendance.course_member_attendances + if params[:group_ids].present? + @member_attendances = @member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_ids]}) end + @member_attendances = @member_attendances.where(attendance_status: params[:attendance_status]) if params[:attendance_status].present? + @member_attendances = @member_attendances.order("attendance_status=1 desc, course_member_attendances.updated_at desc") + @members_count = @member_attendances.uniq.count + @member_attendances = paginate @member_attendances.preload(user: :user_extension) - @members = @members.joins(:course_member_attendances).order("attendance_status=1 desc, course_member_attendances.updated_at desc") - @members_count = @members.uniq.count - @members = paginate @members.preload(user: :user_extension).uniq - - # @member_attendances = @member_attendances.where(attendance_status: params[:attendance_status]) if params[:attendance_status].present? - # @member_attendances = @member_attendances.joins(user: :user_extension).order("attendance_status=1 desc, course_member_attendances.updated_at desc, user_extensions.student_id asc") - # @member_attendances = paginate @member_attendances.preload(user: :user_extension) + # if attendance.course_attendance_groups.first&.course_group_id.to_i == 0 + # @members = attendance.course.students + # else + # @members = attendance.course.students.where(course_group_id: attendance.course_attendance_groups.pluck(:course_group_id)) + # end + # @member_attendances = attendance.course_member_attendances + # if params[:group_ids].present? + # @members = @members.where(course_group_id: params[:group_ids]) + # end + # + # if params[:attendance_status].present? + # @members = @members.joins(:course_member_attendances).where(course_member_attendances: {course_attendance_id: attendance.id, attendance_status: params[:attendance_status]}) + # end + # + # @members = @members.joins(:course_member_attendances).order("attendance_status=1 desc, course_member_attendances.updated_at desc") + # @members_count = @members.uniq.count + # @members = paginate @members.preload(user: :user_extension).uniq end def create diff --git a/app/views/weapps/course_member_attendances/index.json.jbuilder b/app/views/weapps/course_member_attendances/index.json.jbuilder index 765de5833..43ce6ed44 100644 --- a/app/views/weapps/course_member_attendances/index.json.jbuilder +++ b/app/views/weapps/course_member_attendances/index.json.jbuilder @@ -1,15 +1,16 @@ -# json.member_attendances @member_attendances.each do |member| -# json.(member, :user_id, :attendance_status) -# json.user_name member.user&.real_name -# json.student_id member.user&.student_id -# end - -json.member_attendances @members.each_with_index.to_a do |member, index| - json.(member, :user_id) +json.member_attendances @member_attendances.each_with_index.to_a do |member, index| + json.(member, :user_id, :attendance_status) json.index (@page.to_i - 1) * @limit.to_i + index + 1 json.user_name member.user&.real_name json.student_id member.user&.student_id - json.attendance_status @member_attendances.select{|attendance| attendance.course_member_id == member.id}.first&.attendance_status || "ABSENCE" end +# json.member_attendances @members.each_with_index.to_a do |member, index| +# json.(member, :user_id) +# json.index (@page.to_i - 1) * @limit.to_i + index + 1 +# json.user_name member.user&.real_name +# json.student_id member.user&.student_id +# json.attendance_status @member_attendances.select{|attendance| attendance.course_member_id == member.id}.first&.attendance_status || "ABSENCE" +# end + json.members_count @members_count \ No newline at end of file From f0cf14e84c9e300ecf47b994bf05a31ab5029f30 Mon Sep 17 00:00:00 2001 From: harry Date: Thu, 19 Mar 2020 15:26:56 +0800 Subject: [PATCH 64/95] =?UTF-8?q?=E9=87=8D=E7=BD=AE=E6=9C=89=E6=95=88?= =?UTF-8?q?=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Video/video-play/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx index 5fb87cc0f..5b3f97ee1 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -122,6 +122,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { initLog = false isLoging = false isSeeking = false + pos = [] //有效时长重新累计,算新的一遍 }, true) } From eb67724fc56863542bc81c3e4c04ae6e8b73849e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 19 Mar 2020 15:36:27 +0800 Subject: [PATCH 65/95] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 762943183..44fa18f56 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -313,19 +313,27 @@ class ChallengesController < ApplicationController end rescue => e tip_exception("上移失败: #{e.message}") + raise ActiveRecord::Rollback end end def destroy next_challenges = @shixun.challenges.where("position > #{@challenge.position}") - next_challenges.update_all("position = position - 1") - # Todo: 实训修改后,关卡需要重置 - # shixun_modify_status_without_publish(@shixun, 1) - @challenge.destroy - # 关卡位置被删除,需要修改脚本 - script = modify_shixun_script @shixun, @shixun.evaluate_script - @shixun.shixun_info.update_column(:evaluate_script, script) + begin + ActiveRecord::Base.transaction do + next_challenges.update_all("position = position - 1") + # Todo: 实训修改后,关卡需要重置 + # shixun_modify_status_without_publish(@shixun, 1) + @challenge.destroy + # 关卡位置被删除,需要修改脚本 + script = modify_shixun_script @shixun, @shixun.evaluate_script + @shixun.shixun_info.update_column(:evaluate_script, script) + end + rescue => e + tip_exception("删除关卡失败: #{e.message}") + raise ActiveRecord::Rollback + end end From dc5c2371162908c2d075b89f4066d28591ee780d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 19 Mar 2020 15:37:58 +0800 Subject: [PATCH 66/95] =?UTF-8?q?=E8=B0=83=E6=95=B4md=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tpm/shixunchild/Challenges/Challenges.js | 14 +++++++------- .../shixunchild/Challenges/Challengesjupyter.js | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 640562f5e..5aa95f4a1 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -526,7 +526,7 @@ class Challenges extends Component { :""} -
    {ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?
    @@ -535,7 +535,7 @@ class Challenges extends Component { src={getImageUrl("images/educoder/nodata.png")} />}

    暂时还没有相关数据哦!

    - :

    + :

    {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":

    } @@ -745,7 +745,7 @@ class Challenges extends Component {
    -
    +
    {/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/} {this.props.identity<5? @@ -758,7 +758,7 @@ class Challenges extends Component { } {/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/} - +
    @@ -779,11 +779,11 @@ class Challenges extends Component {
    { item.open_game ? - this.beginChallenge(item.open_game)} className="challengeBtn blue">开启挑战 + this.beginChallenge(item.open_game)} className="challengeBtn blue">开启挑战 : - 开启挑战 + 开启挑战 } -
    +
    ) })} diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 9e50e44d5..21b935edd 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -613,7 +613,7 @@ class Challengesjupyter extends Component { :""}
    -

    +

    {/*{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":*/} {/*

    */} {/*}*/} @@ -625,7 +625,7 @@ class Challengesjupyter extends Component { src={getImageUrl("images/educoder/nodata.png")} />}

    暂时还没有相关数据哦!

    - :

    + :

    {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":

    } From a3b29b41af35314511023158493eeec8c5139a3a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Mar 2020 16:13:16 +0800 Subject: [PATCH 67/95] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E7=9A=84=E7=AD=BE=E5=88=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course_member.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/course_member.rb b/app/models/course_member.rb index 0a0433f6f..c8fe7e392 100644 --- a/app/models/course_member.rb +++ b/app/models/course_member.rb @@ -23,7 +23,7 @@ class CourseMember < ApplicationRecord # after_destroy :delete_works # after_create :work_operation - after_create :create_attendance_record + # after_create :create_attendance_record after_commit :create_attendance_record From f1543a5b5bd0a7365d1029bd3277835b4a04cd9e Mon Sep 17 00:00:00 2001 From: harry Date: Thu, 19 Mar 2020 16:22:06 +0800 Subject: [PATCH 68/95] =?UTF-8?q?=E6=8E=A5=E8=BF=91=E7=9A=84=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E8=AF=B7=E6=B1=82=EF=BC=8C=E6=8B=A6=E6=88=AA=E5=99=A8?= =?UTF-8?q?=E4=BC=9A=E5=BC=83=E7=BD=AE=E6=8E=89=E5=85=B6=E4=B8=AD=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=EF=BC=8C=E5=AF=BC=E8=87=B4=E4=B8=9A=E5=8A=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=A2=E5=A4=B1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 643 +++++++++++++++++----------------- 1 file changed, 323 insertions(+), 320 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 7c52d64ae..a3efafdb9 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -3,25 +3,25 @@ import React from "react"; import axios from 'axios'; import md5 from 'md5'; import { requestProxy } from "./indexEduplus2RequestProxy"; -import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; -import { notification } from 'antd'; +import { broadcastChannelOnmessage, SetAppModel, isDev, queryString } from 'educoder'; +import { notification } from 'antd'; import cookie from 'react-cookies'; import './index.css'; const $ = window.$; -const opens ="79e33abd4b6588941ab7622aed1e67e8"; +const opens = "79e33abd4b6588941ab7622aed1e67e8"; let timestamp; let checkSubmitFlg = false; -let message501=false; +let message501 = false; broadcastChannelOnmessage('refreshPage', () => { - window.location.reload() + window.location.reload() }) -function locationurl(list){ +function locationurl(list) { if (window.location.port === "3007") { } else { - window.location.href=list + window.location.href = list } } @@ -30,7 +30,7 @@ function locationurl(list){ // TODO 开发期多个身份切换 - let debugType ="" +let debugType = "" if (isDev) { const _search = window.location.search; let parsed = {}; @@ -42,7 +42,7 @@ if (isDev) { window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' } // 超管 -debugType="admin"; +debugType = "admin"; // 老师 // debugType="teacher"; // 学生 @@ -53,30 +53,30 @@ debugType="admin"; function clearAllCookie() { - cookie.remove('_educoder_session', {path: '/'}); - cookie.remove('autologin_trustie', {path: '/'}); + cookie.remove('_educoder_session', { path: '/' }); + cookie.remove('autologin_trustie', { path: '/' }); setpostcookie() } clearAllCookie(); function setpostcookie() { - const str =window.location.pathname; + const str = window.location.pathname; // console.log(str.indexOf("/wxcode")) - let newdomain=".educoder.net" - if(str.indexOf("/wxcode") !== -1){ + let newdomain = ".educoder.net" + if (str.indexOf("/wxcode") !== -1) { console.log("123") - cookie.remove('_educoder_session', {path: '/'}); - cookie.remove('autologin_trustie', {path: '/'}); + cookie.remove('_educoder_session', { path: '/' }); + cookie.remove('autologin_trustie', { path: '/' }); // console.log("开始重写cookis"); const _params = window.location.search; // console.log("1111"); if (_params) { // console.log("22222"); let _search = _params.split('?')[1]; - let _educoder_sessions= _search.split('&')[0].split('='); - cookie.save('_educoder_session',_educoder_sessions[1], { domain:'.educoder.net', path: '/'}); - let autologin_trusties=_search.split('&')[1].split('='); - cookie.save('autologin_trustie',autologin_trusties[1], { domain:'.educoder.net', path: '/'}); + let _educoder_sessions = _search.split('&')[0].split('='); + cookie.save('_educoder_session', _educoder_sessions[1], { domain: '.educoder.net', path: '/' }); + let autologin_trusties = _search.split('&')[1].split('='); + cookie.save('autologin_trustie', autologin_trusties[1], { domain: '.educoder.net', path: '/' }); } } @@ -84,33 +84,37 @@ function setpostcookie() { setpostcookie(); - function railsgettimes(proxy) { - - clearAllCookie() - - if(timestamp&&checkSubmitFlg===false){ - $.ajax({url:proxy,async:false,success:function(data){ - if(data.status===0){ - timestamp=data.message; - setpostcookie(); - } - }}) - checkSubmitFlg=true - window.setTimeout(()=>{ - checkSubmitFlg=false; - }, 2000); - }else if(checkSubmitFlg===false){ - $.ajax({url:proxy,async:false,success:function(data){ - if(data.status===0){ - timestamp=data.message; - setpostcookie(); - } - }}) - checkSubmitFlg=true - window.setTimeout( ()=>{ - checkSubmitFlg=false; - }, 2000); - } +function railsgettimes(proxy) { + + clearAllCookie() + + if (timestamp && checkSubmitFlg === false) { + $.ajax({ + url: proxy, async: false, success: function (data) { + if (data.status === 0) { + timestamp = data.message; + setpostcookie(); + } + } + }) + checkSubmitFlg = true + window.setTimeout(() => { + checkSubmitFlg = false; + }, 2000); + } else if (checkSubmitFlg === false) { + $.ajax({ + url: proxy, async: false, success: function (data) { + if (data.status === 0) { + timestamp = data.message; + setpostcookie(); + } + } + }) + checkSubmitFlg = true + window.setTimeout(() => { + checkSubmitFlg = false; + }, 2000); + } } @@ -120,292 +124,291 @@ setpostcookie(); window._debugType = debugType; export function initAxiosInterceptors(props) { - initOnlineOfflineListener() - - // TODO 避免重复的请求 https://github.com/axios/axios#cancellation - // https://github.com/axios/axios/issues/1497 - - // TODO 读取到package.json中的配置? - var proxy = "http://localhost:3000" - // proxy = "http://testbdweb.trustie.net" - // proxy = "http://testbdweb.educoder.net" - // proxy = "https://testeduplus2.educoder.net" - //proxy="http://47.96.87.25:48080" - proxy="https://pre-newweb.educoder.net" - proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" - // proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" - //proxy="https://test-jupyterweb.educoder.net/" - - - // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; - // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 - const requestMap = {}; - - window.setfalseInRequestMap = function(keyName) { - requestMap[keyName] = false; - } - - //响应前的设置 - axios.interceptors.request.use( - config => { - setpostcookie() - clearAllCookie() - // config.headers['Content-Type']= 'no-cache' - // if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 - // config.headers.Authorization = token; - // } - - // --------------------------------------------- 測試3007连测试服的代码 - // if (url.indexOf('file_update') != -1 || url.indexOf('game_build') != -1 || url.indexOf('game_status') != -1) { - // proxy = 'https://testbdweb.trustie.net' - // } else { - // proxy = 'http://localhost:3000' - // } - // --------------------------------------------- - // console.log("开始请求了"); - // console.log(config.url); - // console.log(window.location.pathname); - // - - // try { - // const str =window.location.pathname; - // if(str.indexOf("/wxcode") !== -1){ - // // console.log("开始重写cookis"); - // const _params = window.location.search; - // // console.log("1111"); - // if (_params) { - // // console.log("22222"); - // let _search = _params.split('?')[1]; - // var _educoder_sessionmys=""; - // var autologin_trusties=""; - // _search.split('&').forEach(item => { - // const _arr = item.split('='); - // if(_arr[0]==='_educoder_session'){ - // cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'}); - // _educoder_sessionmys=_arr[1]; - // }else{ - // cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'}); - // autologin_trusties=_arr[1]; - // } - // }); - // try { - // const autlogins= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; - // config.params = {'Cookie': autlogins} - // config.headers['Cookie'] =autlogins; - // // console.log("设置了cookis"); - // } catch (e) { - // - // } - // try { - // const autloginysls= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; - // config.params = {'autloginysls': autloginysls} - // config.headers['Cookie'] =autloginysls; - // // console.log("设置了cookis"); - // }catch (e) { - // - // } - // } - // } - // }catch (e) { - // - // } - - - - if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) { - return config - } - requestProxy(config) - - let url = `/api${config.url}`; - - //qq登录去掉api - if(config.params&&config.params.redirect_uri!=undefined){ - if(config.params.redirect_uri.indexOf('otherloginqq')!=-1){ - url = `${config.url}`; - } - } - if(`${config[0]}`!=`true`){ - let timestamp = Date.parse(new Date())/1000; - if (window.location.port === "3007") { - // let timestamp=railsgettimes(proxy); - // console.log(timestamp) - // `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp` - railsgettimes( `${proxy}/api/main/first_stamp.json`); - let newopens=md5(opens+timestamp) - config.url = `${proxy}${url}`; - if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; - } else { - config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; - } - } else { - // 加api前缀 - // railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); - - railsgettimes( `/api/main/first_stamp.json`); - let newopens=md5(opens+timestamp) - config.url = url; - if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`; - } else { - config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; - } - } - setpostcookie(); - } - // - // console.log(config); - if (requestMap[config.url] === true) { - return false; - } - // // 非file_update请求 - if (config.url.indexOf('update_file') === -1) { - requestMap[config.url] = true; - - window.setTimeout("setfalseInRequestMap('"+config.url+"')", 900) - } - // setTimeout("setfalseInRequestMap(" + config.url + ")", 1200) - return config; - }, - err => { - return Promise.reject(err); - }); + initOnlineOfflineListener() + + // TODO 避免重复的请求 https://github.com/axios/axios#cancellation + // https://github.com/axios/axios/issues/1497 + + // TODO 读取到package.json中的配置? + var proxy = "http://localhost:3000" + // proxy = "http://testbdweb.trustie.net" + // proxy = "http://testbdweb.educoder.net" + // proxy = "https://testeduplus2.educoder.net" + //proxy="http://47.96.87.25:48080" + proxy = "https://pre-newweb.educoder.net" + proxy = "https://test-newweb.educoder.net" + // proxy="https://test-jupyterweb.educoder.net" + // proxy="https://test-newweb.educoder.net" + // proxy="https://test-jupyterweb.educoder.net" + //proxy="https://test-jupyterweb.educoder.net/" + + + // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; + // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 + const requestMap = {}; + + window.setfalseInRequestMap = function (keyName) { + requestMap[keyName] = false; + } - axios.interceptors.response.use(function (response) { - - // console.log(".............") - if(response===undefined){ - return - } - const config = response.config - if (response.data.status === -1) { - // console.error('error:', response.data.message) - // throw new Error() - - // https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=cancel+request+in+response+interceptors+ - // https://github.com/axios/axios/issues/583 - // message.info(response.data.message || '服务端返回status -1,请联系管理员。'); - // props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) - if (window.location.pathname.startsWith('/tasks/')) { - props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) - } else { - notification.open({ - message:"提示", - description: response.data.message || '服务器异常,请联系管理员。', - style: { - zIndex: 99999999 - }, - }); - // notification['error']({ - // message:"提示", - // description: response.data.message || '服务器异常,请联系管理员。', - // }); - } - - throw new axios.Cancel('Operation canceled by the user.'); + //响应前的设置 + axios.interceptors.request.use( + config => { + setpostcookie() + clearAllCookie() + // config.headers['Content-Type']= 'no-cache' + // if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 + // config.headers.Authorization = token; + // } + + // --------------------------------------------- 測試3007连测试服的代码 + // if (url.indexOf('file_update') != -1 || url.indexOf('game_build') != -1 || url.indexOf('game_status') != -1) { + // proxy = 'https://testbdweb.trustie.net' + // } else { + // proxy = 'http://localhost:3000' + // } + // --------------------------------------------- + // console.log("开始请求了"); + // console.log(config.url); + // console.log(window.location.pathname); + // + + // try { + // const str =window.location.pathname; + // if(str.indexOf("/wxcode") !== -1){ + // // console.log("开始重写cookis"); + // const _params = window.location.search; + // // console.log("1111"); + // if (_params) { + // // console.log("22222"); + // let _search = _params.split('?')[1]; + // var _educoder_sessionmys=""; + // var autologin_trusties=""; + // _search.split('&').forEach(item => { + // const _arr = item.split('='); + // if(_arr[0]==='_educoder_session'){ + // cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'}); + // _educoder_sessionmys=_arr[1]; + // }else{ + // cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'}); + // autologin_trusties=_arr[1]; + // } + // }); + // try { + // const autlogins= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; + // config.params = {'Cookie': autlogins} + // config.headers['Cookie'] =autlogins; + // // console.log("设置了cookis"); + // } catch (e) { + // + // } + // try { + // const autloginysls= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; + // config.params = {'autloginysls': autloginysls} + // config.headers['Cookie'] =autloginysls; + // // console.log("设置了cookis"); + // }catch (e) { + // + // } + // } + // } + // }catch (e) { + // + // } + + + + if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) { + return config + } + requestProxy(config) + + let url = `/api${config.url}`; + + //qq登录去掉api + if (config.params && config.params.redirect_uri != undefined) { + if (config.params.redirect_uri.indexOf('otherloginqq') != -1) { + url = `${config.url}`; + } + } + if (`${config[0]}` != `true`) { + let timestamp = Date.parse(new Date()) / 1000; + if (window.location.port === "3007") { + // let timestamp=railsgettimes(proxy); + // console.log(timestamp) + // `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp` + railsgettimes(`${proxy}/api/main/first_stamp.json`); + let newopens = md5(opens + timestamp) + config.url = `${proxy}${url}`; + if (config.url.indexOf('?') == -1) { + config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; + } else { + config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; + } } else { - // hash跳转 - // var hash = window.location.hash; - // if (hash) { - // hashTimeout && window.clearTimeout(hashTimeout) - // hashTimeout = setTimeout(() => { - // var element = document.querySelector(hash); - // if (element) { - // element.scrollIntoView(); - // } - // }, 400) - // } + // 加api前缀 + // railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); + + railsgettimes(`/api/main/first_stamp.json`); + let newopens = md5(opens + timestamp) + config.url = url; + if (config.url.indexOf('?') == -1) { + config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`; + } else { + config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; + } } - // if(response.data.status === 401){ - // console.log("401401401") - // } - if (response.data.status === 403||response.data.status === "403") { + setpostcookie(); + } + // 拦截器导致关键的业务数据丢失,先注释 + // if (requestMap[config.url] === true) { + // return false; + // } + // // 非file_update请求 + if (config.url.indexOf('update_file') === -1) { + requestMap[config.url] = true; + + window.setTimeout("setfalseInRequestMap('" + config.url + "')", 900) + } + // setTimeout("setfalseInRequestMap(" + config.url + ")", 1200) + return config; + }, + err => { + return Promise.reject(err); + }); - locationurl('/403'); - } + axios.interceptors.response.use(function (response) { - if (response.data.status === 404) { - locationurl('/nopage'); - } + // console.log(".............") + if (response === undefined) { + return + } + const config = response.config + if (response.data.status === -1) { + // console.error('error:', response.data.message) + // throw new Error() + + // https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=cancel+request+in+response+interceptors+ + // https://github.com/axios/axios/issues/583 + // message.info(response.data.message || '服务端返回status -1,请联系管理员。'); + // props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) + if (window.location.pathname.startsWith('/tasks/')) { + props.showSnackbar(response.data.message || '服务器异常,请联系管理员。') + } else { + notification.open({ + message: "提示", + description: response.data.message || '服务器异常,请联系管理员。', + style: { + zIndex: 99999999 + }, + }); + // notification['error']({ + // message:"提示", + // description: response.data.message || '服务器异常,请联系管理员。', + // }); + } + + throw new axios.Cancel('Operation canceled by the user.'); + } else { + // hash跳转 + // var hash = window.location.hash; + // if (hash) { + // hashTimeout && window.clearTimeout(hashTimeout) + // hashTimeout = setTimeout(() => { + // var element = document.querySelector(hash); + // if (element) { + // element.scrollIntoView(); + // } + // }, 400) + // } + } + // if(response.data.status === 401){ + // console.log("401401401") + // } + if (response.data.status === 403 || response.data.status === "403") { - if (response.data.status === 500) { - locationurl('/500'); - } + locationurl('/403'); + } - if (response.data.status === 501) { - if(message501===false){ - message501=true - notification.open({ - message:"提示", - description:response.data.message || '访问异常,请求不合理', - style: { - zIndex: 99999999 - } - }) + if (response.data.status === 404) { + locationurl('/nopage'); + } + + if (response.data.status === 500) { + locationurl('/500'); + } + + if (response.data.status === 501) { + if (message501 === false) { + message501 = true + notification.open({ + message: "提示", + description: response.data.message || '访问异常,请求不合理', + style: { + zIndex: 99999999 } - window.setTimeout(function () { - message501=false - }, 2000); - } + }) + } + window.setTimeout(function () { + message501 = false + }, 2000); + } - // if (response.data.status === 402) { - // console.log(response.data.status); - // console.log(response.data); - // // locationurl(402); - // } - - // - // if (response.data.status === 401) { - // console.log("161"); - // console.log(config); - // return config; - // } - // if (response.data.status === 407) { - // 在app js 中解决 Trialapplication - // // - // ///在appjs - // notification.open({ - // message:"提示", - // description: "账号未认证", - // }); - // throw new axios.Cancel('Operation canceled by the user.'); - // // - // } - - requestMap[response.config.url] = false; - setpostcookie(); - return response; - }, function (error) { - return Promise.reject(error); - }); -// ----------------------------------------------------------------------------------- + // if (response.data.status === 402) { + // console.log(response.data.status); + // console.log(response.data); + // // locationurl(402); + // } + + // + // if (response.data.status === 401) { + // console.log("161"); + // console.log(config); + // return config; + // } + // if (response.data.status === 407) { + // 在app js 中解决 Trialapplication + // // + // ///在appjs + // notification.open({ + // message:"提示", + // description: "账号未认证", + // }); + // throw new axios.Cancel('Operation canceled by the user.'); + // // + // } + + requestMap[response.config.url] = false; + setpostcookie(); + return response; + }, function (error) { + return Promise.reject(error); + }); + // ----------------------------------------------------------------------------------- } function initOnlineOfflineListener() { - const $ = window.$ - $(window).bind("online", () => { - notification.destroy() - notification.success({ - duration: 2, - message: '网络恢复正常', - description: - '网络恢复正常,感谢使用。', - }) - }); - $(window).bind("offline", () => { - notification.destroy() - - notification.warning({ - duration: null, - message: '网络异常', - description: - '网络异常,请检测网络后重试。', - }) - }); + const $ = window.$ + $(window).bind("online", () => { + notification.destroy() + notification.success({ + duration: 2, + message: '网络恢复正常', + description: + '网络恢复正常,感谢使用。', + }) + }); + $(window).bind("offline", () => { + notification.destroy() + + notification.warning({ + duration: null, + message: '网络异常', + description: + '网络异常,请检测网络后重试。', + }) + }); } From 016d59bcaad629cbc982e03e4b5922d73e1e41fc Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Mar 2020 16:28:25 +0800 Subject: [PATCH 69/95] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/migrate_course_student_work.rake | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/tasks/migrate_course_student_work.rake diff --git a/lib/tasks/migrate_course_student_work.rake b/lib/tasks/migrate_course_student_work.rake new file mode 100644 index 000000000..c795a49ce --- /dev/null +++ b/lib/tasks/migrate_course_student_work.rake @@ -0,0 +1,31 @@ +# 执行示例 bundle exec rake migrate_course_student_work:homework args=2933 +desc "创建课堂学生的作业数据" + +namespace :migrate_course_student_work do + if ENV['args'] + course_id = ENV['args'].split(",")[0] # 对应课堂的id + end + + task homework: :environment do + course = Course.find_by(id: course_id) + if course.present? + student_ids = course.students.pluck(:user_id) + + # 如果之前存在相关作品,则更新is_delete字段 + student_works = StudentWork.joins(:homework_common).where(user_id: student_ids, homework_commons: {course_id: course.id}) + student_works.update_all(is_delete: 0) + + attrs = %i[homework_common_id user_id created_at updated_at] + + StudentWork.bulk_insert(*attrs) do |worker| + student_ids.each do |user_id| + same_attrs = {user_id: user_id} + course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework| + next if StudentWork.where(user_id: user_id, homework_common_id: homework.id).any? + worker.add same_attrs.merge(homework_common_id: homework.id) + end + end + end + end + end +end From a9d670b50f5b7fa8004f4aa7f8d9892ec510524c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 19 Mar 2020 16:34:07 +0800 Subject: [PATCH 70/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E5=B0=8F=E6=89=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/signin/css/signincdi.css | 11 ++++++++++- .../videostatistics/component/Studenticscom.js | 6 ++++-- .../videostatistics/component/Videostatisticscom.js | 8 +++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/signin/css/signincdi.css b/public/react/src/modules/courses/signin/css/signincdi.css index c6711c4a5..eb63a7a41 100644 --- a/public/react/src/modules/courses/signin/css/signincdi.css +++ b/public/react/src/modules/courses/signin/css/signincdi.css @@ -408,7 +408,7 @@ } .tbrt{ padding-top: 22px; - padding-left: 28px; + padding-left: 17px; } .tbrt .ts { font-size:12px; @@ -453,6 +453,15 @@ white-space:nowrap; cursor: default; } +.maxnamewidth166ss{ + max-width: 166px; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + cursor: default; +} + + .maxnamewidth140s{ width: 140px; max-width: 140px; diff --git a/public/react/src/modules/courses/videostatistics/component/Studenticscom.js b/public/react/src/modules/courses/videostatistics/component/Studenticscom.js index e161be77d..a4a78ebda 100644 --- a/public/react/src/modules/courses/videostatistics/component/Studenticscom.js +++ b/public/react/src/modules/courses/videostatistics/component/Studenticscom.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import '../../signin/css/signincdi.css'; -import {Progress, message} from 'antd'; +import {Progress, message,Tooltip} from 'antd'; import {getImageUrl,formatSeconds} from 'educoder'; import axios from 'axios'; @@ -97,7 +97,9 @@ class Studenticscom extends Component {
    总观看时长(时)
    -
    {this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?formatSeconds(this.props.watch_staticsdata.total_duration):0}
    + +
    {this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?formatSeconds(this.props.watch_staticsdata.total_duration):0}
    +
    diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js index 94031cd85..ea4cee4d6 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import '../../signin/css/signincdi.css'; -import {Progress, message} from 'antd'; +import {Progress, message,Tooltip} from 'antd'; import {getImageUrl,formatSeconds} from 'educoder'; import axios from 'axios'; @@ -97,8 +97,10 @@ class Videostatisticscom extends Component {
    总观看时长(时)
    -
    {this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?formatSeconds(this.props.watch_staticsdata.total_duration):0}
    -
    + +
    {this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?formatSeconds(this.props.watch_staticsdata.total_duration):0}
    +
    +
    From ec034c3cf8024dc44814a0cb2ff4e192e9000d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 19 Mar 2020 17:00:37 +0800 Subject: [PATCH 71/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E5=B0=8F=E6=89=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/poll/PollNew.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index a3cbba89b..f6c4eba1c 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -3007,9 +3007,9 @@ class PollNew extends Component { {/*自动生成修改好的获取到的*/} {/**************************************************************************/} {this.state.poll_questions === undefined ? "" : this.state.poll_questions.map((item, index) => { - console.log('打印this.state.poll_questions'); - console.log(this.state.poll_questions); - console.log(this.state.adddom); + // console.log('打印this.state.poll_questions'); + // console.log(this.state.poll_questions); + // console.log(this.state.adddom); let resultDom; resultDom =

    @@ -3061,7 +3061,7 @@ class PollNew extends Component { {item.question.answers === undefined ? "" : item.question.answers.map((items, i) => { return (

    - + {items.answer_text}
    From 481dff9e0642caad46f01b6d46667ee90a3d3e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 19 Mar 2020 17:34:55 +0800 Subject: [PATCH 72/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/poll/pollPublicBtn/ImmediatelyPublish.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js index f10474fdf..933ca1996 100644 --- a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js +++ b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js @@ -35,7 +35,8 @@ class Immediatelypublish extends Component{ modalsType:false, modalsTopval:"", loadtype:false, - chooseId:undefined + chooseId:undefined, + immediatelyopen:false } } //立即发布 @@ -73,6 +74,7 @@ class Immediatelypublish extends Component{ Saves:this.homeworkstartend, course_groups:response.data.course_groups, starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time, + immediatelyopen:response.data.course_groups===null||response.data.course_groups.length===0?false:true, }) } @@ -100,6 +102,7 @@ class Immediatelypublish extends Component{ Saves:this.homeworkstartend, course_groups:response.data.course_groups, starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time, + immediatelyopen:response.data.course_groups===null||response.data.course_groups.length===0?false:true, }) } }).catch((error) => { @@ -386,6 +389,7 @@ class Immediatelypublish extends Component{ starttimes={this.state.starttimes} starttimesend={this.state.starttimesend} typs={this.state.typs} + immediatelyopen={this.state.immediatelyopen} />:""} {/* 公用的提示弹框 */} From ce1552f344f50e7d61c2d73356d7e7939bddda11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 19 Mar 2020 17:44:17 +0800 Subject: [PATCH 73/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/poll/PollDetailIndex.js | 22 +++++++++++++++++-- .../courses/poll/PollDetailTabFirst.js | 5 +++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index c0e590766..aee6ee12b 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -19,11 +19,13 @@ import '../css/members.css' import '../css/busyWork.css' import axios from 'axios' +import Itembankstop from "../../question/component/Itembankstop"; const map={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} class PollDetailIndex extends Component{ constructor(props){ super(props); + this.pollssubcomRef = React.createRef(); this.state={ tab:["0"], pollDetail:undefined, @@ -33,7 +35,9 @@ class PollDetailIndex extends Component{ polls_status:3, } } - + getpollssubcomRef = (Ref) => { + this.pollssubcomRef = Ref; + } getPollInfo=()=>{ // console.log(this.props); let pollId=this.props.match.params.pollId; @@ -67,7 +71,17 @@ class PollDetailIndex extends Component{ }catch (e) { } + this.gettables(); } + + gettables=()=>{ + try { + this.pollssubcomRef.searchInfo(); + }catch (e) { + + } + } + newgetPollInfo=()=>{ // console.log(this.props); let pollId=this.props.match.params.pollId; @@ -263,7 +277,11 @@ class PollDetailIndex extends Component{ { // 答题列表 - parseInt(tab[0])==0 && + parseInt(tab[0])==0 && this.getpollssubcomRef(ref)} + > } { // 统计结果 diff --git a/public/react/src/modules/courses/poll/PollDetailTabFirst.js b/public/react/src/modules/courses/poll/PollDetailTabFirst.js index 912894a9b..2da0924ed 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabFirst.js +++ b/public/react/src/modules/courses/poll/PollDetailTabFirst.js @@ -132,6 +132,11 @@ class PollDetailTabFirst extends Component{ componentDidMount(){ let {order, search, commit_status, poll_group_id, page, order_type} = this.state; this.getTableList(order, search, commit_status, poll_group_id, page, order_type); + try { + this.props.getpollssubcomRef(this); + } catch (e) { + + } } // 翻页 From de617c6867148351b5fa3f1f080422e30a874739 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Mar 2020 18:13:17 +0800 Subject: [PATCH 74/95] =?UTF-8?q?=E9=A2=98=E5=BA=93=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/examination_banks_controller.rb | 5 +++-- app/controllers/item_banks_controller.rb | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index 3df11a432..bd1782dc8 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -3,7 +3,7 @@ class ExaminationBanksController < ApplicationController before_action :require_login before_action :certi_identity_auth, only: [:create, :edit, :update, :destroy, :set_public, :revoke_item, :cancel_items] before_action :find_exam, except: [:index, :create, :cancel_items] - before_action :edit_auth, only: [:update, :destroy, :set_public, :revoke_item, :cancel_items] + before_action :edit_auth, only: [:update, :set_public, :revoke_item, :cancel_items] before_action :identity_auth, only: [:index] def index @@ -52,6 +52,7 @@ class ExaminationBanksController < ApplicationController end def destroy + tip_exception(403, "无权限") unless current_user.admin? || @item.user == current_user ActiveRecord::Base.transaction do ApplyAction.where(container_type: "ExaminationBank", container_id: @exam.id).destroy_all @exam.destroy! @@ -92,6 +93,6 @@ class ExaminationBanksController < ApplicationController end def edit_auth - current_user.admin_or_business? || @exam.user == current_user + tip_exception(403, "无权限") unless current_user.admin_or_business? || @exam.user == current_user end end \ No newline at end of file diff --git a/app/controllers/item_banks_controller.rb b/app/controllers/item_banks_controller.rb index ea10e865b..d77c57711 100644 --- a/app/controllers/item_banks_controller.rb +++ b/app/controllers/item_banks_controller.rb @@ -3,7 +3,7 @@ class ItemBanksController < ApplicationController before_action :require_login before_action :certi_identity_auth, only: [:create, :edit, :update, :destroy, :set_public] before_action :find_item, except: [:index, :create] - before_action :edit_auth, only: [:update, :destroy, :set_public] + before_action :edit_auth, only: [:update, :set_public] before_action :identity_auth, only: [:index] def index @@ -41,6 +41,7 @@ class ItemBanksController < ApplicationController end def destroy + tip_exception(403, "无权限") unless current_user.admin? || @item.user == current_user ActiveRecord::Base.transaction do ApplyAction.where(container_type: "ItemBank", container_id: @item.id).destroy_all if @item.item_type == "PROGRAM" @@ -67,7 +68,7 @@ class ItemBanksController < ApplicationController end def edit_auth - current_user.admin_or_business? || @item.user == current_user + tip_exception(403, "无权限") unless current_user.admin_or_business? || @item.user == current_user end def form_params From c4efa0df80721d001c71bdd7c3c3313b3fafbd77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 19 Mar 2020 19:07:40 +0800 Subject: [PATCH 75/95] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E4=BF=9D=E5=AD=98=E5=9C=A8=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=9A=84=E7=AE=80=E4=BB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tpm/shixunchild/Challenges/Challenges.js | 39 ++++++++++--------- .../Challenges/Challengesjupyter.js | 7 +++- .../shixunchild/Challenges/Showmarkdown.js | 38 ++++++++++++++++++ 3 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 public/react/src/modules/tpm/shixunchild/Challenges/Showmarkdown.js diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 5aa95f4a1..9c08f5a25 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -14,7 +14,8 @@ import '../shixunchildCss/Challenges.css'; import AccountProfile from"../../../user/AccountProfile"; -const $ = window.$; +import Showmarkdown from "./Showmarkdown"; + class Challenges extends Component { constructor(props) { @@ -118,16 +119,16 @@ class Challenges extends Component { } updatamakedown = (id) => { - setTimeout(() => { - var shixunDescr = window.editormd.markdownToHTML(id, { - htmlDecode: "style,script,iframe", - taskList: true, - tex: true, - flowChart: true, - sequenceDiagram: true - }); - $("#" + id + " p:first").addClass("ReactMarkdown"); - }, 200) + // setTimeout(() => { + // var shixunDescr = window.editormd.markdownToHTML(id, { + // htmlDecode: "style,script,iframe", + // taskList: true, + // tex: true, + // flowChart: true, + // sequenceDiagram: true + // }); + // $("#" + id + " p:first").addClass("ReactMarkdown"); + // }, 200) } // 关卡的上移下移操作 @@ -404,9 +405,9 @@ class Challenges extends Component { render() { let { ChallengesDataList, startbtns, sumidtype ,startshixunCombattype,shixunsreplace,shixunsmessage,hidestartshixunsreplacevalue,operationstrue,AccountProfiletype} = this.state; let { loadingContent } = this.props; - if (ChallengesDataList != undefined) { - this.updatamakedown("ReactMarkdown") - } + // if (ChallengesDataList != undefined) { + // this.updatamakedown("ReactMarkdown") + // } let id = this.props.match.params.shixunId; const antIcon = ; @@ -535,11 +536,11 @@ class Challenges extends Component { src={getImageUrl("images/educoder/nodata.png")} />}

    暂时还没有相关数据哦!

    - :

    - {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": -

    - } -

    } + : ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": + + }
    {teacherdata === undefined ? "" : teacherdata.work_count && teacherdata.work_count}个检索结果({teacherdata === undefined ? "" : teacherdata.all_member_count && teacherdata.all_member_count}学生) +
    + 更新时间 + + + + +
    @@ -3842,13 +3845,13 @@ class Listofworksstudentone extends Component {
    {teacherdata === undefined ? "" : teacherdata.work_count && teacherdata.work_count}个检索结果({teacherdata === undefined ? "" : teacherdata.all_member_count && teacherdata.all_member_count}学生) -
    this.Updatetimedropdon()}> +
    this.Updatetimedropdon()}> 更新时间 + "iconfont icon-sanjiaoxing-up font-12 color-blue fiilssort" :"iconfont icon-sanjiaoxing-up font-12 fiilssort colorddd"}> + "iconfont icon-sanjiaoxing-down font-12 yslbottomsj color-blue":"iconfont icon-sanjiaoxing-down font-12 yslbottomsj colorddd"}>
    - {datajs === undefined ? "" : } + {datajs === undefined ? "" : + ( + this.state.orders&&this.state.orders==="update_time"? +
    + : +
    + ) + } From 5f4fa5a1f470f2ea2f19d2436b2e64249bd22448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 19 Mar 2020 23:34:38 +0800 Subject: [PATCH 87/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/Listofworksstudentone.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 9cdb0859d..ea123318e 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1751,6 +1751,7 @@ class Listofworksstudentone extends Component { Updatetimedropdon=()=>{ + let ooders="" if(this.state.orders!=="update_time"){ ooders="desc"; @@ -1769,6 +1770,7 @@ class Listofworksstudentone extends Component { this.setState({ myorders: ooders, orders: "update_time", + datajs:undefined, loadingstate: true, }) this.Startsortingt("update_time", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, ooders); @@ -2684,7 +2686,7 @@ class Listofworksstudentone extends Component { }).catch((error) => { console.log(error) this.setState({ - loadingstate: false + loadingstate: false, }) }) From 1ae3611dc6a2bd9e61e0b4ed6f0f16fab40302ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 19 Mar 2020 23:37:37 +0800 Subject: [PATCH 88/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworksstudentone.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index ea123318e..bd3f9db7f 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -27,6 +27,7 @@ import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import ShixunWorkModal from "./Shixunworkdetails/ShixunWorkModal"; import NoneData from '../../../modules/courses/coursesPublic/NoneData'; import Chongzuomodel from "./Chongzuomodel"; +import NoneDatas from "../signin/component/NoneDatas"; const CheckboxGroup = Checkbox.Group; @@ -3928,7 +3929,13 @@ class Listofworksstudentone extends Component { `}
    - {datajs === undefined ? "" : + {datajs === undefined ? +
    +
    + : ( this.state.orders&&this.state.orders==="update_time"?
    Date: Thu, 19 Mar 2020 23:38:45 +0800 Subject: [PATCH 89/95] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/Listofworksstudentone.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index bd3f9db7f..f63d2e2c9 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -3587,9 +3587,7 @@ class Listofworksstudentone extends Component { } - console.log("老师的数组"); - console.log("columns"); - console.log(Teachercolumns); + return ( From a479ce56a8e908f22ad7fd416536d209f032587a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 20 Mar 2020 10:12:09 +0800 Subject: [PATCH 90/95] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/challenge.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 38aa2812a..ab62cba77 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -73,9 +73,9 @@ class Challenge < ApplicationRecord # 这里的identifier,status是关联了games取了games的identifier,status identifier = self.identifier if identifier.present? - shixun.task_pass || self.status != 3 ? "/tasks/#{identifier}" : "" + (shixun.task_pass || self.status != 3) ? "/tasks/#{identifier}" : "" else - self.position == 1 ? "/shixuns/#{shixun.identifier}/shixun_exec.json" : "" + (shixun.task_pass || position == 1) ? "/shixuns/#{shixun.identifier}/shixun_exec.json" : "" end end From 73dcaa9b6d39e4adec181be4850bb6cd3ef12af5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 20 Mar 2020 10:45:59 +0800 Subject: [PATCH 91/95] =?UTF-8?q?=E5=85=B3=E5=8D=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 2 ++ app/models/challenge.rb | 8 ++++++-- app/views/challenges/index.json.jbuilder | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 44fa18f56..4024a2629 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -164,6 +164,8 @@ class ChallengesController < ApplicationController @challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq + @shixun_modify = (@challenges.select{|c| c.status.present? }.size == @challenges.size) + #@challenges = @shixun.challenges.fields_for_list @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 @user = current_user diff --git a/app/models/challenge.rb b/app/models/challenge.rb index ab62cba77..15a96bf17 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -69,11 +69,15 @@ class Challenge < ApplicationRecord end # 开启挑战 - def open_game shixun + def open_game shixun, shixun_modify # 这里的identifier,status是关联了games取了games的identifier,status identifier = self.identifier if identifier.present? - (shixun.task_pass || self.status != 3) ? "/tasks/#{identifier}" : "" + if shixun_modify + "/shixuns/#{shixun.identifier}/shixun_exec.json" + else + (shixun.task_pass || self.status != 3) ? "/tasks/#{identifier}" : "" + end else (shixun.task_pass || position == 1) ? "/shixuns/#{shixun.identifier}/shixun_exec.json" : "" end diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index eae72dad2..98be8d17a 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -22,7 +22,7 @@ if @challenges.present? #json.playing_count @play_games_map.fetch(challenge.id, 0) json.playing_count (challenge.games.count - user_passed_count) json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) - json.open_game challenge.open_game(@shixun) + json.open_game challenge.open_game(@shixun, @shixun_modify) #json.open_game challenge.open_game(@shixun, @user.id) if @editable json.edit_url edit_shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) From adc346257a94ec5de000e88c5dcece6674d23fa1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 20 Mar 2020 11:38:20 +0800 Subject: [PATCH 92/95] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=8F=E5=8A=A9?= =?UTF-8?q?=E8=80=81=E5=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 ++- app/controllers/users/courses_controller.rb | 2 +- app/views/courses/index.json.jbuilder | 2 ++ app/views/courses/top_banner.json.jbuilder | 2 ++ app/views/users/courses/shared/_course.json.jbuilder | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 46ac514b4..46bb3fe06 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -99,7 +99,7 @@ class CoursesController < ApplicationController limit = params[:limit] || 16 @courses = @courses.page(page).per(limit) - @courses = @courses.preload(:school, :none_hidden_course_modules, teacher: :user_extension) + @courses = @courses.preload(:school, :teacher_users, :none_hidden_course_modules, teacher: :user_extension) end def course_videos @@ -1306,6 +1306,7 @@ class CoursesController < ApplicationController @user = current_user @switch_student = Course::BUSINESS < @user_course_identity && @user_course_identity < Course::STUDENT @is_student = @user_course_identity == Course::STUDENT + @teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..2] @course.increment!(:visits) end diff --git a/app/controllers/users/courses_controller.rb b/app/controllers/users/courses_controller.rb index 95a006392..2e370922b 100644 --- a/app/controllers/users/courses_controller.rb +++ b/app/controllers/users/courses_controller.rb @@ -5,7 +5,7 @@ class Users::CoursesController < Users::BaseController courses = courses.where(id: current_laboratory.all_courses) @count = courses.count - @courses = paginate(courses.includes(teacher: { user_extension: :school }), special: observed_user.is_teacher?) + @courses = paginate(courses.includes(:teacher_users, teacher: { user_extension: :school }), special: observed_user.is_teacher?) end private diff --git a/app/views/courses/index.json.jbuilder b/app/views/courses/index.json.jbuilder index f9bceebb8..b1c095ff1 100644 --- a/app/views/courses/index.json.jbuilder +++ b/app/views/courses/index.json.jbuilder @@ -13,5 +13,7 @@ json.courses @courses do |course| json.is_end course.is_end json.first_category_url module_url(course.none_hidden_course_modules.first, course) json.excellent course.excellent + json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师 + end json.courses_count @courses_count diff --git a/app/views/courses/top_banner.json.jbuilder b/app/views/courses/top_banner.json.jbuilder index b5ed437e3..cf8da8b66 100644 --- a/app/views/courses/top_banner.json.jbuilder +++ b/app/views/courses/top_banner.json.jbuilder @@ -22,6 +22,8 @@ json.switch_to_assistant switch_assistant_role(@is_student, @course, @user) #json.copy_course !@user.member_of_course?(@course) && @user.is_teacher? json.course_identity @user_course_identity json.excellent @course.excellent +# 协作老师 +json.teacher_users @teacher_users if @course.is_end == 0 json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i end diff --git a/app/views/users/courses/shared/_course.json.jbuilder b/app/views/users/courses/shared/_course.json.jbuilder index a0c5ddc73..d3de455a8 100644 --- a/app/views/users/courses/shared/_course.json.jbuilder +++ b/app/views/users/courses/shared/_course.json.jbuilder @@ -7,6 +7,8 @@ json.homework_commons_count get_tasks_count course json.attachments_count course.attachments.count json.visits course.visits json.school course.school&.name +json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师 + json.first_category_url module_url(course.course_modules.where(hidden: 0).order(position: :desc).first, course) From 72f25ebc24b534f268249f75337ce4a35ca07921 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Fri, 20 Mar 2020 11:58:09 +0800 Subject: [PATCH 93/95] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=A7=92=E8=89=B2=EF=BC=8C=E9=99=90=E5=88=B6?= =?UTF-8?q?=E8=BF=90=E8=90=A5=E5=8F=AF=E4=BF=AE=E6=94=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/base_controller.rb | 2 +- app/controllers/admins/users_controller.rb | 2 +- app/services/admins/update_user_service.rb | 8 ++++++-- app/views/admins/users/edit.html.erb | 1 + db/migrate/20200320032312_add_admin_visitable_to_user.rb | 5 +++++ 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20200320032312_add_admin_visitable_to_user.rb diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb index 0451b77d1..271e73746 100644 --- a/app/controllers/admins/base_controller.rb +++ b/app/controllers/admins/base_controller.rb @@ -21,7 +21,7 @@ class Admins::BaseController < ApplicationController def require_admin! return if current_user.blank? || !current_user.logged? - return if current_user.admin_or_business? + return if current_user.admin_or_business? || current_user.admin_visitable? render_forbidden end diff --git a/app/controllers/admins/users_controller.rb b/app/controllers/admins/users_controller.rb index b9a07ba1e..79fd02526 100644 --- a/app/controllers/admins/users_controller.rb +++ b/app/controllers/admins/users_controller.rb @@ -63,6 +63,6 @@ class Admins::UsersController < Admins::BaseController def update_params params.require(:user).permit(%i[lastname nickname gender identity technical_title student_id is_shixun_marker mail phone location location_city school_id department_id admin business is_test - password professional_certification authentication]) + password professional_certification authentication admin_visitable]) end end \ No newline at end of file diff --git a/app/services/admins/update_user_service.rb b/app/services/admins/update_user_service.rb index 6b1c0c857..3aaebb7b1 100644 --- a/app/services/admins/update_user_service.rb +++ b/app/services/admins/update_user_service.rb @@ -9,6 +9,7 @@ class Admins::UpdateUserService < ApplicationService end def call + user.assign_attributes(user_attributes) user.mail = params[:mail].to_s.presence user.phone = params[:phone].to_s.presence @@ -36,8 +37,11 @@ class Admins::UpdateUserService < ApplicationService private def user_attributes - params.slice(*%i[lastname nickname mail phone admin business is_test - professional_certification authentication is_shixun_marker]) + allow_attributes = %i[lastname nickname mail phone business is_test + professional_certification authentication is_shixun_marker admin_visitable] + + allow_attributes.push(:admin) if user.admin? + params.slice(*allow_attributes) end def user_extension_attributes diff --git a/app/views/admins/users/edit.html.erb b/app/views/admins/users/edit.html.erb index b1a8cbba1..0c6c19be7 100644 --- a/app/views/admins/users/edit.html.erb +++ b/app/views/admins/users/edit.html.erb @@ -111,6 +111,7 @@ <%= f.input :admin, as: :boolean, label: '管理员', checked_value: 1, unchecked_value: 0 %> <%= f.input :business, as: :boolean, label: '运营人员', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %> <%= f.input :is_test, as: :boolean, label: '测试账号', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %> + <%= f.input :admin_visitable, as: :boolean, label: '允许查看后台', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %> <% end %> diff --git a/db/migrate/20200320032312_add_admin_visitable_to_user.rb b/db/migrate/20200320032312_add_admin_visitable_to_user.rb new file mode 100644 index 000000000..43a67c788 --- /dev/null +++ b/db/migrate/20200320032312_add_admin_visitable_to_user.rb @@ -0,0 +1,5 @@ +class AddAdminVisitableToUser < ActiveRecord::Migration[5.2] + def change + add_column :users, :admin_visitable, :boolean, default: false + end +end From cd865a5a89875dddc1533fcfbcdd7a55077a2008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 20 Mar 2020 13:20:03 +0800 Subject: [PATCH 94/95] =?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/common/util/ShareUtil.js | 2 +- public/react/src/modules/courses/poll/PollNewQuestbank.js | 2 +- public/react/src/modules/message/js/MessagSub.js | 4 ++-- public/react/src/modules/tpm/NewHeader.js | 6 +++--- public/react/src/modules/tpm/component/TPMRightSection.js | 2 +- public/react/src/modules/user/usersInfo/Infos.js | 2 +- public/react/src/modules/user/usersInfo/InfosBanner.js | 2 +- public/react/src/modules/user/usersInfo/banner_out.js | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/public/react/src/common/util/ShareUtil.js b/public/react/src/common/util/ShareUtil.js index a85c37c4a..f0ce13996 100644 --- a/public/react/src/common/util/ShareUtil.js +++ b/public/react/src/common/util/ShareUtil.js @@ -110,7 +110,7 @@ export function configShareForCourses () { var shareData = { title: 'EduCoder - 教学课堂', desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。', - link: `${host}/courses`, + link: `${host}/classrooms`, imgUrl: window.__testImageUrl || host + '/react/build/images/share_logo_icon.jpg' }; diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js index 58aa916c4..a1476125c 100644 --- a/public/react/src/modules/courses/poll/PollNewQuestbank.js +++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js @@ -2763,7 +2763,7 @@ class PollNewQuestbank extends Component { // // let courseId=this.props.match.params.coursesId; // if(courseId===undefined){ - // this.props.history.push("/courses"); + // this.props.history.push("/classrooms"); // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index 822f7b8fe..e87dcac3d 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -272,13 +272,13 @@ class MessagSub extends Component { return window.open(`/forums/`); case "Watcher" : // 用户个人中心页 :id = item.trigger_user.login - return window.open(`/users/${item.trigger_user.login}/courses`) + return window.open(`/users/${item.trigger_user.login}/classrooms`) case "PraiseTread" : // 这块太复杂 不好处理 return ''; case "Grade" : //个人中心页 :id = item.trigger_user.login - // return window.open(`/users/${item.trigger_user.login}/courses`; + // return window.open(`/users/${item.trigger_user.login}/classrooms`; return ""; case "JoinProject" : //项目详情-申请加入项目审核页 :id = container_id diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 0d3f1d392..1678703d6 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1123,15 +1123,15 @@ class NewHeader extends Component { 注册 :
    - +
    +
    { isAdmin === true ? @@ -158,9 +167,12 @@ class Teacherentry extends Component {
    {e.stopPropagation();this.props.Signin(item.mode,item.id,item.attendance_code)}}> 签到
    - : - item.attendance_status==="NORMAL"? -
    + : item.attendance_status === "LEAVE" ? +
    + 请假 +
    + : item.attendance_status==="NORMAL"? +
    正常签到
    :"" @@ -175,15 +187,15 @@ class Teacherentry extends Component { { item.attendance_status? item.attendance_status === "NORMAL" ? -
    +
    正常签到
    : item.attendance_status === "LEAVE" ? -
    +
    请假
    : item.attendance_status === "ABSENCE" ? -
    +
    旷课
    :