From 3af57e97ce8335d66eae53fed8806d88f66ccae2 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 17 Aug 2019 16:19:36 +0800 Subject: [PATCH 01/15] video feature: modify --- app/libs/aliyun_vod/service/base.rb | 10 +++++++++- app/libs/aliyun_vod/service/video_upload.rb | 9 --------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index 85f74fc6f..e100eadcc 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -10,7 +10,15 @@ module AliyunVod::Service::Base Rails.logger.info("[AliyunVod] response => status: #{response.status}, result: #{result}") - raise AliyunVod::Error, result['Code'] if response.status != 200 + if response.status != 200 + message = + case result['Code'] + when 'InvalidFileName.Extension' then '不支持的文件格式' + when 'IllegalCharacters' then '文件名称包含非法字符' + else raise AliyunVod::Error, result['Message'] + end + raise AliyunVod::Error, message if message.present? + end result rescue => ex diff --git a/app/libs/aliyun_vod/service/video_upload.rb b/app/libs/aliyun_vod/service/video_upload.rb index a5ade72f9..97ecd970b 100644 --- a/app/libs/aliyun_vod/service/video_upload.rb +++ b/app/libs/aliyun_vod/service/video_upload.rb @@ -16,15 +16,6 @@ module AliyunVod::Service::VideoUpload result = request(:post, params) - if result['Code'].present? - message = - case result['Code'] - when 'InvalidFileName.Extension' then '不支持的文件格式' - when 'IllegalCharacters' then '文件名称包含非法字符' - end - raise AliyunVod::Error, message if message.present? - end - raise AliyunVod::Error, '获取上传凭证失败' if result['UploadAddress'].blank? result From 64a51a1759fcf94292c486be5e5198c31debac50 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 19 Aug 2019 10:30:56 +0800 Subject: [PATCH 02/15] =?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/controllers/attachments_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d3317e99e..3d6e20ee9 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -172,7 +172,10 @@ class AttachmentsController < ApplicationController # 课堂资源、作业、毕设相关资源的权限判断 if @file.container.is_a?(Course) course = @file.container + Rails.logger.info("@@@@@@@@@@@@######################## course_id#{course.id}") candown = current_user.member_of_course?(course) || @file.is_public == 1 + Rails.logger.info("@@@@@@@@@@@@######################## public #{@file.is_public}") + Rails.logger.info("@@@@@@@@@@@@#########################{candown}") elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic) course = @file.container&.course candown = current_user.member_of_course?(course) From e9b682383b9b44805301edd4ea3ec417f8ba8455 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 19 Aug 2019 10:47:31 +0800 Subject: [PATCH 03/15] =?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/controllers/attachments_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 3d6e20ee9..df74cf737 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -172,10 +172,7 @@ class AttachmentsController < ApplicationController # 课堂资源、作业、毕设相关资源的权限判断 if @file.container.is_a?(Course) course = @file.container - Rails.logger.info("@@@@@@@@@@@@######################## course_id#{course.id}") - candown = current_user.member_of_course?(course) || @file.is_public == 1 - Rails.logger.info("@@@@@@@@@@@@######################## public #{@file.is_public}") - Rails.logger.info("@@@@@@@@@@@@#########################{candown}") + candown = current_user.member_of_course?(course) || (course.is_public? && @file.publiced?) elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic) course = @file.container&.course candown = current_user.member_of_course?(course) From 2f187e1a84884a57edec55d56a698125d06e43e2 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Mon, 19 Aug 2019 11:28:02 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=95=8A=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_questions_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index 3718e18d5..52915a8ba 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -339,10 +339,11 @@ class ExerciseQuestionsController < ApplicationController @exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index| challenge.question_score = params[:question_scores][index].to_f.round(1) challenge.save - question_score += challenge.question_score + question_score += params[:question_scores][index].to_f.round(1) end @exercise_question.question_score = question_score @exercise_question.shixun_name = shixun_name + @exercise_question.save end #当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数. From 9110cc6a9ac3e0a71ae2514d9c2bb5a206f95b6d Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 19 Aug 2019 11:33:47 +0800 Subject: [PATCH 05/15] list --- public/react/src/common/components/attachment/AttachmentList.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/react/src/common/components/attachment/AttachmentList.js diff --git a/public/react/src/common/components/attachment/AttachmentList.js b/public/react/src/common/components/attachment/AttachmentList.js new file mode 100644 index 000000000..e69de29bb From 25c553d3c53e3abefed178fe9af556e9f5877656 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 19 Aug 2019 13:45:31 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/moop_cases/CaseDetail.js | 203 +++++++++--------- 1 file changed, 104 insertions(+), 99 deletions(-) diff --git a/public/react/src/modules/moop_cases/CaseDetail.js b/public/react/src/modules/moop_cases/CaseDetail.js index f3ade34d9..4fc7ef84c 100644 --- a/public/react/src/modules/moop_cases/CaseDetail.js +++ b/public/react/src/modules/moop_cases/CaseDetail.js @@ -65,110 +65,115 @@ class CaseDetail extends Component{ } = this.state; return(
- - -

- 教学案例 > { CaseDetail && CaseDetail.title} -

-

- - { CaseDetail && CaseDetail.title} - - - - { - CaseDetail && CaseDetail.status == "pending" && 草稿 - } - { - CaseDetail && CaseDetail.status == "processing" && 审核中 - } - { - CaseDetail && CaseDetail.status == "refused" && 未通过 - } - - 返回 -

-
-
-
- 82274?1563067098 -
-
  • - {creator && creator.name} - { - operation && operation.can_deletable ? 删除:"" - } - - { - operation && operation.can_editable ? 编辑:"" - } -
  • -
  • - {creator && creator.school_name} - - 编码:{CaseDetail && CaseDetail.uuid} - { - CaseDetail && CaseDetail.status=="published" ? - 发布时间:{CaseDetail && CaseDetail.published_at} - : - 上传时间:{CaseDetail && CaseDetail.created_at} - } - -
  • -
    -
    -
    - 作者:{CaseDetail && CaseDetail.author_name}/{CaseDetail && CaseDetail.author_school_name} -
    - -
    - { CaseDetail && CaseDetail.content && } -
    - { attachments && -
    { - attachments.map((item,key)=>{ - return( -

    - - - - {item.title} - {item.filesize} -

    - ) - }) + CaseDetail.status == "refused" && 未通过 } + + 返回 +

    +
    +
    +
    + 82274?1563067098 +
    +
  • + {creator && creator.name} + { + operation && operation.can_deletable ? 删除:"" + } + + { + operation && operation.can_editable ? 编辑:"" + } +
  • +
  • + {creator && creator.school_name} + + 编码:{CaseDetail.uuid} + { + CaseDetail && CaseDetail.status=="published" ? + 发布时间:{CaseDetail.published_at} + : + 上传时间:{CaseDetail.created_at} + } + +
  • +
    +
    +
    + 作者:{CaseDetail.author_name}/{CaseDetail.author_school_name} +
    + +
    + { CaseDetail.content && } +
    + { attachments && +
    + { + attachments.map((item,key)=>{ + return( +

    + + + + {item.title} + {item.filesize} +

    + ) + }) + } +
    + } +
    + { + user_praised ? +

    + 已赞 + {praise_count} +

    + : +

    this.props.praisePoint(this.props.match.params.caseID)} className="pointsBtn"> + + {praise_count} +

    + } +
    - } -
    - { - user_praised ? -

    - 已赞 - {praise_count} -

    - : -

    this.props.praisePoint(this.props.match.params.caseID)} className="pointsBtn"> - - {praise_count} -

    - }
    -
    -
    + + }
    ) } From a7c6674fe2970d6b7834396cbca1974354b879da Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 19 Aug 2019 14:05:04 +0800 Subject: [PATCH 07/15] video: only teacher can visit video list --- app/controllers/users/base_controller.rb | 6 ++++++ app/controllers/users/videos_controller.rb | 1 + 2 files changed, 7 insertions(+) diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb index 01ddee8fc..3ba6940f5 100644 --- a/app/controllers/users/base_controller.rb +++ b/app/controllers/users/base_controller.rb @@ -26,6 +26,12 @@ class Users::BaseController < ApplicationController render_forbidden end + def require_teacher! + return if current_user.admin_or_business? || observed_user.is_teacher? + + render_forbidden + end + def require_auth_teacher! return if current_user.admin_or_business? || observed_user.certification_teacher? diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb index 8b445a7fb..1fb209970 100644 --- a/app/controllers/users/videos_controller.rb +++ b/app/controllers/users/videos_controller.rb @@ -1,5 +1,6 @@ class Users::VideosController < Users::BaseController before_action :private_user_resources!, :check_account + before_action :require_teacher! before_action :require_auth_teacher!, except: [:index, :review] helper_method :current_video From 957d8f1592c4081c03cf22f01dc3810be90fe517 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 19 Aug 2019 14:08:28 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B-?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8-=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/attachment/AttachmentList.js | 33 +++++++++++++++++++ public/react/src/common/educoder.js | 3 ++ .../src/modules/moop_cases/CaseDetail.js | 18 +++------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/public/react/src/common/components/attachment/AttachmentList.js b/public/react/src/common/components/attachment/AttachmentList.js index e69de29bb..8ece1c39d 100644 --- a/public/react/src/common/components/attachment/AttachmentList.js +++ b/public/react/src/common/components/attachment/AttachmentList.js @@ -0,0 +1,33 @@ +import React,{ Component } from "react"; + +class AttachmentsList extends Component{ + constructor(props){ + super(props); + } + render(){ + let { attachments } = this.props; + return( + + { + attachments.map((item,key)=>{ + return( +

    + + + + { + item.is_pdf && item.is_pdf == true ? + {item.title} + : + {item.title} + } + {item.filesize} +

    + ) + }) + } +
    + ) + } +} +export default AttachmentsList; \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 88f8e1210..30a98868a 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -30,6 +30,9 @@ export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const' + +export { default as AttachmentList } from './components/attachment/AttachmentList' + export { themes, ThemeContext } from './context/ThemeContext' export { ModalHOC } from './components/ModalHOC' diff --git a/public/react/src/modules/moop_cases/CaseDetail.js b/public/react/src/modules/moop_cases/CaseDetail.js index 4fc7ef84c..6e278307e 100644 --- a/public/react/src/modules/moop_cases/CaseDetail.js +++ b/public/react/src/modules/moop_cases/CaseDetail.js @@ -2,13 +2,15 @@ import React,{ Component } from "react"; import './css/moopCases.css' import '../courses/css/Courses.css' -import { getImageUrl , MarkdownToHtml , ActionBtn } from 'educoder'; +import { getImageUrl , MarkdownToHtml , ActionBtn , AttachmentList } from 'educoder'; import Tags from './CaseTags' import axios from 'axios'; import Modals from '../modals/Modals' +// import AttachmentList from '../../common/components/attachment/AttachmentList' + class CaseDetail extends Component{ constructor(props){ super(props); @@ -141,19 +143,7 @@ class CaseDetail extends Component{
    { attachments &&
    - { - attachments.map((item,key)=>{ - return( -

    - - - - {item.title} - {item.filesize} -

    - ) - }) - } +
    }
    From 59cf9693e2b44de7b6ee5cca11d4586c17ee75b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 19 Aug 2019 14:12:50 +0800 Subject: [PATCH 09/15] =?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/exercise/Testpapersettinghomepage.js | 4 ++-- public/react/src/modules/courses/poll/PollDetailIndex.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index 65e48962a..c279fb83b 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -413,8 +413,8 @@ class Testpapersettinghomepage extends Component{ this.setgameexercise(`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${this.props.current_user.login}`)}>开始答题: - {start_Value[Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status]} - + {Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status===3?"":Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status===4?"":start_Value[Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status]} + :""}
    diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index cdc6a5ae2..9400341e4 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -206,7 +206,9 @@ class PollDetailIndex extends Component{ { user_permission && user_permission.current_status!=3 ? - { user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" } + { user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? + (pollDetail && pollDetail.polls_status===3?"":pollDetail && pollDetail.polls_status===4?"":"查看答题") + : "开始答题" } :"" } From f2a8525aada3643d31e00de12ca5f7349976779c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 19 Aug 2019 14:20:19 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 271 +++++++------- .../courses/shixunHomework/CommitSummary.js | 344 +++++++++--------- 2 files changed, 323 insertions(+), 292 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 0556d94e9..921834b80 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -45,6 +45,7 @@ class Studentshavecompletedthelist extends Component { teacherlist: undefined, searchtext: "", Teacherliststudentlist: undefined, + mylistansum:0, review: null, course_groupysls: undefined, nocomment: false, @@ -109,17 +110,17 @@ class Studentshavecompletedthelist extends Component { -- : + }}>-- : record.stduynumber === "" ? -- : + }}>-- : {record.stduynumber} + }}>{record.stduynumber} } @@ -132,23 +133,23 @@ class Studentshavecompletedthelist extends Component { align: 'center', className: "edu-txt-center font-14", width:"260px", - render: (text, record) => ( + render: (text, record) => ( {record.classroom === null ? -- : + }}>-- : record.classroom === "" ? -- : + }}>-- : {record.classroom} + }}>{record.classroom} } @@ -159,16 +160,16 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'submitstate', key: 'submitstate', align: 'center', - className: "edu-txt-center font-14", + className: "edu-txt-center font-14", render: (text, record) => ( {record.submitstate} + }}>{record.submitstate} ) @@ -179,7 +180,7 @@ class Studentshavecompletedthelist extends Component { key: 'updatetime', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.updatetime === "--" ? {record.updatetime} @@ -195,30 +196,30 @@ class Studentshavecompletedthelist extends Component { key: 'completion', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( { record.completion === "--" ? + }}> {record.completion} : 90 ? { "color": '#DD1717', "text-align": "center" - } : parseInt(record.completion) <= 90 ? { + } : parseInt(record.completion) <= 90 ? { "color": '#FF6800', "text-align": "center" - } : parseInt(record.completion) <= 60 ? { + } : parseInt(record.completion) <= 60 ? { "color": '#747A7F', "text-align": "center" - } : + } : { "color": '#747A7F', "text-align": "center" - }}>{record.completion} + }}>{record.completion} } @@ -229,27 +230,27 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'levelscore', key: 'levelscore', align: 'center', - className: "edu-txt-center font-14", + className: "edu-txt-center font-14", render: (text, record) => ( {record.levelscore === "--" ? + }}> {record.levelscore} : 90 ? { "color": '#DD1717', "text-align": "center" - } : parseInt(record.levelscore) <= 90 ? { + } : parseInt(record.levelscore) <= 90 ? { "color": '#FF6800', "text-align": "center" - } : parseInt(record.levelscore) <= 60 ? { + } : parseInt(record.levelscore) <= 60 ? { "color": '#747A7F', "text-align": "center" - } : {"color": '#747A7F', "text-align": "center"}}>{record.levelscore} + } : {"color": '#747A7F', "text-align": "center"}}>{record.levelscore} } ) @@ -259,34 +260,34 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'efficiencyscore', key: 'efficiencyscore', align: 'center', - className: "edu-txt-center font-14", + className: "edu-txt-center font-14", render: (text, record) => ( {record.efficiencyscore === "--" ?
    未评分
    }> - - {record.efficiencyscore} - + + {record.efficiencyscore} + : 90 ? { "color": '#DD1717', "text-align": "center" - } : parseInt(record.efficiencyscore) <= 90 ? { + } : parseInt(record.efficiencyscore) <= 90 ? { "color": '#FF6800', "text-align": "center" - } : parseInt(record.efficiencyscore) <= 60 ? { + } : parseInt(record.efficiencyscore) <= 60 ? { "color": '#747A7F', "text-align": "center", } : { "color": '#747A7F', "text-align": "center" - }}>{record.efficiencyscore} + }}>{record.efficiencyscore} } ) @@ -298,7 +299,7 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'number', key: 'number', align: 'center', - className: "edu-txt-center tabletd font-14", + className: "edu-txt-center tabletd font-14", render: (text, record) => ( { @@ -318,7 +319,7 @@ class Studentshavecompletedthelist extends Component { key: 'name', align: 'center', className: "edu-txt-center tabletd font-14", - render: (text, record) => ( + render: (text, record) => ( { record.name === "--" ? @@ -336,24 +337,24 @@ class Studentshavecompletedthelist extends Component { key: 'stduynumber', align: 'center', className: "edu-txt-center tabletd font-14", - render: (text, record) => ( + render: (text, record) => ( {record.stduynumber === null ? -- + }}>-- : record.stduynumber === "" ? -- + }}>-- : {record.stduynumber} + }}>{record.stduynumber} } @@ -366,22 +367,22 @@ class Studentshavecompletedthelist extends Component { align: 'center', className: "edu-txt-center tabletd font-14", width:"260px", - render: (text, record) => ( + render: (text, record) => ( {record.classroom === null ? --: record.classroom === "" ? + }}>--: record.classroom === "" ? --: + }}>--: {record.classroom} - } + }}>{record.classroom} + } ) @@ -391,16 +392,16 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'submitstate', key: 'submitstate', align: 'center', - className: "edu-txt-center tabletd font-14", + className: "edu-txt-center tabletd font-14", render: (text, record) => ( {record.submitstate} + }}>{record.submitstate} ) @@ -411,7 +412,7 @@ class Studentshavecompletedthelist extends Component { key: 'updatetime', align: 'center', className: "edu-txt-center tabletd font-14", - render: (text, record) => ( + render: (text, record) => ( {record.updatetime === "--"? -- @@ -427,13 +428,13 @@ class Studentshavecompletedthelist extends Component { key: 'completion', align: 'center', className: "edu-txt-center tabletd font-14", - render: (text, record) => ( + render: (text, record) => ( {record.completion === "--" ? - + }}> -- @@ -441,16 +442,16 @@ class Studentshavecompletedthelist extends Component { 90 ? { "color": '#DD1717', "text-align": "center" - } : parseInt(record.completion) <= 90 ? { + } : parseInt(record.completion) <= 90 ? { "color": '#FF6800', "text-align": "center" - } : parseInt(record.completion) <= 60 ? { + } : parseInt(record.completion) <= 60 ? { "color": '#747A7F', "text-align": "center" - } : { + } : { "color": '#747A7F', "text-align": "center" - }}>{record.completion} + }}>{record.completion} } ) @@ -460,27 +461,27 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'levelscore', key: 'levelscore', align: 'center', - className: "edu-txt-center tabletd font-14", + className: "edu-txt-center tabletd font-14", render: (text, record) => ( {record.levelscore === "--"? + }}> -- : 90 ? { "color": '#DD1717', "text-align": "center" - } : parseInt(record.levelscore) <= 90 ? { + } : parseInt(record.levelscore) <= 90 ? { "color": '#FF6800', "text-align": "center" - } : parseInt(record.levelscore) <= 60 ? { + } : parseInt(record.levelscore) <= 60 ? { "color": '#747A7F', "text-align": "center" - } : {"color": '#747A7F', "text-align": "center"}}>{record.levelscore} + } : {"color": '#747A7F', "text-align": "center"}}>{record.levelscore} } ) @@ -490,7 +491,7 @@ class Studentshavecompletedthelist extends Component { dataIndex: 'efficiencyscore', key: 'efficiencyscore', align: 'center', - className: "edu-txt-center tabletd font-14", + className: "edu-txt-center tabletd font-14", render: (text, record) => ( { @@ -498,25 +499,25 @@ class Studentshavecompletedthelist extends Component {
    未评分
    }> - -- + --
    : 90 ? { "color": '#DD1717', "text-align": "center" - } : parseInt(record.efficiencyscore) <= 90 ? { + } : parseInt(record.efficiencyscore) <= 90 ? { "color": '#FF6800', "text-align": "center" - } : parseInt(record.efficiencyscore) <= 60 ? { + } : parseInt(record.efficiencyscore) <= 60 ? { "color": '#747A7F', "text-align": "center", } : { "color": '#747A7F', "text-align": "center" - }}>{record.efficiencyscore} + }}>{record.efficiencyscore}
    } @@ -536,7 +537,7 @@ class Studentshavecompletedthelist extends Component { record.number=== "--"? -- : - {record.number} + {record.number} } @@ -569,20 +570,20 @@ class Studentshavecompletedthelist extends Component { {record.stduynumber === null ? -- + "color": '#999999', + "text-align": "center" + }}>-- : record.stduynumber === "" ? -- + "color": '#999999', + "text-align": "center" + }}>-- : {record.stduynumber} - } + } ), @@ -609,7 +610,7 @@ class Studentshavecompletedthelist extends Component { "color": '#07111B', "text-align": "center" }}>{record.classroom} - } + } ) @@ -662,10 +663,10 @@ class Studentshavecompletedthelist extends Component { { record.completion === "--"? - -- + -- : 90 ? { "color": '#DD1717', @@ -727,12 +728,12 @@ class Studentshavecompletedthelist extends Component {
    未评分
    }> - -- + --
    - : + : 90 ? { "color": '#DD1717', "text-align": "center", @@ -763,9 +764,9 @@ class Studentshavecompletedthelist extends Component { :record.submitstate === "未提交"? -- : - {record.operating} - } + {record.operating} + } ) @@ -785,7 +786,7 @@ class Studentshavecompletedthelist extends Component { key: 'number', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.number === "--" ? -- @@ -801,7 +802,7 @@ class Studentshavecompletedthelist extends Component { key: 'name', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.name==="--"? {record.name} @@ -817,12 +818,12 @@ class Studentshavecompletedthelist extends Component { key: 'stduynumber', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( - + render: (text, record) => ( + {record.stduynumber === "--" ? - {record.stduynumber} - : - {record.stduynumber} + {record.stduynumber} + : + {record.stduynumber} } ), @@ -850,7 +851,7 @@ class Studentshavecompletedthelist extends Component { key: 'submitstate', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( ( {record.updatetime==="--"? @@ -886,7 +887,7 @@ class Studentshavecompletedthelist extends Component { key: 'completion', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.completion=== "--"? -- @@ -902,7 +903,7 @@ class Studentshavecompletedthelist extends Component { key: 'levelscore', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.levelscore==="--"? -- @@ -918,30 +919,30 @@ class Studentshavecompletedthelist extends Component { key: 'efficiencyscore', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.efficiencyscore === "--" ?
    未评分
    }> - --
    - : - 90 ? { - "color": '#DD1717', - "text-align": "center", - } : parseInt(record.efficiencyscore) <= 90 ? { - "color": '#FF6800', - "text-align": "center", - } : parseInt(record.efficiencyscore) <= 60 ? { - "color": '#747A7F', - "text-align": "center", - } : { - "color": '#747A7F', - "text-align": "center", - }}>{record.efficiencyscore} - } + : + 90 ? { + "color": '#DD1717', + "text-align": "center", + } : parseInt(record.efficiencyscore) <= 90 ? { + "color": '#FF6800', + "text-align": "center", + } : parseInt(record.efficiencyscore) <= 60 ? { + "color": '#747A7F', + "text-align": "center", + } : { + "color": '#747A7F', + "text-align": "center", + }}>{record.efficiencyscore} + }
    ) }, @@ -951,7 +952,7 @@ class Studentshavecompletedthelist extends Component { key: 'finalscore', align: 'center', className: "edu-txt-center font-14", - render: (text, record) => ( + render: (text, record) => ( {record.finalscore==="--"? -- - : - {record.finalscore} + : + {record.finalscore} } @@ -1114,8 +1115,8 @@ class Studentshavecompletedthelist extends Component {
    未评分
    }> - -- + --
    : 90 ? { @@ -1149,9 +1150,9 @@ class Studentshavecompletedthelist extends Component { :record.submitstate === "未提交"? -- - : - {record.finalscore} + : + {record.finalscore} } @@ -1252,6 +1253,7 @@ class Studentshavecompletedthelist extends Component { exercise_users: response.data.exercise_users, current_answer_user: response.data.current_answer_user, course_groups: response.data.course_groups, + mylistansum:response.data.exercise_types.answer_users+response.data.exercise_types.unanswer_users }) if (response.data.current_answer_user === undefined || response.data.current_answer_user === null) { // 学生未截止 @@ -1389,7 +1391,7 @@ class Studentshavecompletedthelist extends Component { loadingstate: true, }) } - console.log(response); + console.log(response); console.log(1393); thiss.Generatenewdatasy(response.data.exercise_users, response); } @@ -1622,6 +1624,7 @@ class Studentshavecompletedthelist extends Component { commit_status: response.data.commit_status, exercise_users: response.data.exercise_users, current_answer_user: response.data.current_answer_user, + mylistansum:response.data.exercise_types.answer_users+response.data.exercise_types.unanswer_users, }) if (response.data.exercise_types.subjective === 0) { @@ -1756,6 +1759,7 @@ class Studentshavecompletedthelist extends Component { commit_status: response.data.commit_status, exercise_users: response.data.exercise_users, course_groups: response.data.course_groups, + mylistansum:response.data.exercise_types.answer_users+response.data.exercise_types.unanswer_users, loadingstate: false, columnsys: arr, }) @@ -1788,6 +1792,7 @@ class Studentshavecompletedthelist extends Component { commit_status: response.data.commit_status, exercise_users: response.data.exercise_users, course_groups: response.data.course_groups, + mylistansum:response.data.exercise_types.answer_users+response.data.exercise_types.unanswer_users, columnsys: arr, }) } @@ -1799,7 +1804,7 @@ class Studentshavecompletedthelist extends Component { //显示分班 //8ge - var arr =[]; + var arr =[]; for(var i=0;i { - Teacherliststudentlist && Teacherliststudentlist.exercise_types.total_users && Teacherliststudentlist.exercise_types.total_users > limit ? + mylistansum && mylistansum > limit ?
    + total={mylistansum}>
    : "" } diff --git a/public/react/src/modules/courses/shixunHomework/CommitSummary.js b/public/react/src/modules/courses/shixunHomework/CommitSummary.js index 8ee260ccd..f332acc58 100644 --- a/public/react/src/modules/courses/shixunHomework/CommitSummary.js +++ b/public/react/src/modules/courses/shixunHomework/CommitSummary.js @@ -5,70 +5,70 @@ import "../css/Courses.css"; import CoursesMarkdown from "../coursesPublic/CoursesMarkdown"; import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import { - Form, Icon, Input, Button, Checkbox,message, + Form, Icon, Input, Button, Checkbox,message, } from "antd"; import {WordsBtn} from 'educoder'; //引入对应跳转的组件 import axios from 'axios'; //提交总结 class CommitSummary extends Component{ - constructor(props) { - super(props) - this.state = { - contents: [{val:"",id:1}], - course_id:0, - course_name:"", - category:[], - homework_id:0, - user_name:"", - work_id:0, - description:"", - data:undefined, - cancels:false, - } - - } - componentDidMount() { - - this.Getsubmissionsummaryinterface(); - let query = this.props.location.pathname; - const type = query.split('/'); - this.setState({ - shixuntypes:type[3] - }) + constructor(props) { + super(props) + this.state = { + contents: [{val:"",id:1}], + course_id:0, + course_name:"", + category:[], + homework_id:0, + user_name:"", + work_id:0, + description:"", + data:undefined, + cancels:false, } + } + componentDidMount() { + + this.Getsubmissionsummaryinterface(); + let query = this.props.location.pathname; + const type = query.split('/'); + this.setState({ + shixuntypes:type[3] + }) + } - //获取提交总结接口 - Getsubmissionsummaryinterface=()=>{ - var worksid=this.props.match.params.id; - // console.log("Getsubmissionsummaryinterface"); - // console.log(this.props.match.params); - // console.log(worksid); - var url = `/student_works/${worksid}/commit_des.json`; - axios.get(url).then((result) => { - // console.log(result); - if (result.status === 200) { - // console.log(url) - // console.log("提交总结接口") - // console.log(JSON.stringify(result)) - this.setState({ - data:result.data, - description: result.data.description, - cancels:true, - }) - }else { - this.props.showNotification(result.data.message); - - } - }).catch((error) => { - console.log(error) + + //获取提交总结接口 + Getsubmissionsummaryinterface=()=>{ + var worksid=this.props.match.params.id; + // console.log("Getsubmissionsummaryinterface"); + // console.log(this.props.match.params); + // console.log(worksid); + var url = `/student_works/${worksid}/commit_des.json`; + axios.get(url).then((result) => { + // console.log(result); + if (result.status === 200) { + // console.log(url) + // console.log("提交总结接口") + // console.log(JSON.stringify(result)) + this.setState({ + data:result.data, + description: result.data.description, + cancels:true, }) - } + }else { + this.props.showNotification(result.data.message); - submitCommitSummary=()=> { - const mdContnet = this.refs[`md${1}`].getValue().trim(); - console.log(mdContnet) + } + }).catch((error) => { + console.log(error) + }) + } + + submitCommitSummary=()=> { + const mdContnet = this.refs[`md${1}`].getValue().trim(); + console.log(mdContnet) } gotohome=()=>{ // let courseId=this.props.match.params.coursesId; @@ -77,126 +77,146 @@ class CommitSummary extends Component{ // }else{ // this.props.history.push(this.props.current_user.first_category_url); // } - this.props.history.goBack() - } + this.props.history.goBack() + } asdasdsad=()=>{ - this.setState({ - contents:"" - }) + this.setState({ + contents:"" + }) } - handleSubmit=(e) => { - e.preventDefault(); - this.props.form.validateFields((err, values) => { - if (!err) { - console.log(values.description); - if(values.description === undefined|| values.description === "" || values.description ===null){ - this.props.showNotification(`请输入提交内容`); - return - - } - var worksid=this.props.match.params.id; - - var url = `/student_works/${worksid}/update_des.json`; - axios.post(url,{ - description:values.description, - }).then((result) => { - if (result.status === 200) { - // console.log(url) - // console.log("提交总结接口") - // console.log(JSON.stringify(result)) - // message.success(result.data.message); - // 这里以前是学生 - this.props.history.push(`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${this.props.match.params.homeworkid}/list?tab=0`); - } - }).catch((error) => { - console.log(error) - }) - } - - }); - } + handleSubmit=(e) => { + e.preventDefault(); + this.props.form.validateFields((err, values) => { + if (!err) { + console.log(values.description); + if(values.description === undefined|| values.description === "" || values.description ===null){ + this.props.showNotification(`请输入提交内容`); + return + + } + var worksid=this.props.match.params.id; + + var url = `/student_works/${worksid}/update_des.json`; + axios.post(url,{ + description:values.description, + }).then((result) => { + if (result.status === 200) { + // console.log(url) + // console.log("提交总结接口") + // console.log(JSON.stringify(result)) + // message.success(result.data.message); + // 这里以前是学生 + this.props.history.push(`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${this.props.match.params.homeworkid}/list?tab=0`); + } + }).catch((error) => { + console.log(error) + }) + } + + }); + } + + render() { + const {getFieldDecorator} = this.props.form; + let {contents,data}=this.state; + // console.log(this.props); + return ( +
    +
    + {/*
    */} +
    +
    + - render() { - const {getFieldDecorator} = this.props.form; - let {contents,data}=this.state; - // console.log(this.props); - return ( -
    -
    - {/**/} -
    - -
    -

    {this.state.description ? '修改总结' : '提交总结'}

    - this.gotohome()} className="color-grey-6 fr font-16 ml30 mt10">返回 -
    - {/*educontentbox*/} -
    - -
    -
    +
    +
    +

    {this.state.description ? '修改总结' : '提交总结'}

    + this.gotohome()} className="color-grey-6 fr font-16 ml30 mt10">返回 +
    + {/*educontentbox*/} +
    + +
    +
    * 内容 -
    -
    - - -
    - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请在此输入总结内容,最多5000个字符', - }, { - max: 5000, message: '最大限制为5000个字符', - }], - })( - - )} -
    -
    - - -
    - - 取消 -
    -
    - -
    -
    - +
    +
    +
    + +
    + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请在此输入总结内容,最多5000个字符', + }, { + max: 5000, message: '最大限制为5000个字符', + }], + })( + + )} +
    +
    + + +
    + + 取消 +
    +
    +
    +
    +
    -
    -
    - {/**/} -
    - ) - } + +
    + {/**/} +
    +
    + ) + } } const GraduationTasksnewApp = Form.create({ name: 'coursesNew' })(CommitSummary); export default GraduationTasksnewApp; From 87e7e854bbda1a54da680cdf7089394600175d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 19 Aug 2019 14:27:28 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/CommitSummary.js | 2 +- .../src/modules/courses/shixunHomework/ShixunHomeworkPage.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/CommitSummary.js b/public/react/src/modules/courses/shixunHomework/CommitSummary.js index f332acc58..fcd8ef1e9 100644 --- a/public/react/src/modules/courses/shixunHomework/CommitSummary.js +++ b/public/react/src/modules/courses/shixunHomework/CommitSummary.js @@ -131,7 +131,7 @@ class CommitSummary extends Component{ height:'20px' }} >
    -

    +

    this.gotohome()}>{data === undefined ? "" :data.course_name===undefined?"": data.course_name} > {/* style="grey" */} diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index ccf6c4547..4bf7f970b 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -135,7 +135,7 @@ class ShixunHomeworkPage extends Component {

    -

    +

    this.gotohome()}>{jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name} > Date: Mon, 19 Aug 2019 14:28:55 +0800 Subject: [PATCH 12/15] =?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/shixunHomework/ShixunHomeworkPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index 4bf7f970b..7263594af 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -132,10 +132,10 @@ class ShixunHomeworkPage extends Component {

    -
    +
    -

    +

    this.gotohome()}>{jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name} > Date: Mon, 19 Aug 2019 16:21:48 +0800 Subject: [PATCH 13/15] add filesize to video --- app/services/videos/dispatch_callback_service.rb | 1 + db/migrate/20190819081514_add_filesize_to_videos.rb | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 db/migrate/20190819081514_add_filesize_to_videos.rb diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 3bdabd91a..e4ad1628a 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -13,6 +13,7 @@ class Videos::DispatchCallbackService < ApplicationService case params['EventType'] when 'FileUploadComplete' then # 视频上传完成 video.file_url = params['FileUrl'] + video.filesize = params['Size'] video.upload_success video.save! when 'SnapshotComplete' then # 封面截图完成 diff --git a/db/migrate/20190819081514_add_filesize_to_videos.rb b/db/migrate/20190819081514_add_filesize_to_videos.rb new file mode 100644 index 000000000..da5b6fb50 --- /dev/null +++ b/db/migrate/20190819081514_add_filesize_to_videos.rb @@ -0,0 +1,5 @@ +class AddFilesizeToVideos < ActiveRecord::Migration[5.2] + def change + add_column :videos, :filesize, :integer, default: 0 + end +end From f105c938af6283822421f197572a61fdf6a00bfe Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 19 Aug 2019 16:30:49 +0800 Subject: [PATCH 14/15] video: title limit 30 --- app/services/videos/create_auth_service.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/services/videos/create_auth_service.rb b/app/services/videos/create_auth_service.rb index 3c7ecf2f6..8dc0ddbb3 100644 --- a/app/services/videos/create_auth_service.rb +++ b/app/services/videos/create_auth_service.rb @@ -21,7 +21,14 @@ class Videos::CreateAuthService < ApplicationService private def title - @_title ||= params.delete(:title).to_s.strip + @_title ||= begin + str = params.delete(:title).to_s.strip + if str.length > 30 + "#{str[0, 15]}...#{str.reverse[0,10].reverse}" + else + str + end + end end def filename From b93c7f9f46d75cccc1483c6a0601242561e2a606 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 19 Aug 2019 16:36:23 +0800 Subject: [PATCH 15/15] video modify --- app/libs/aliyun_vod/service/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index e100eadcc..a2d34b6ef 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -13,8 +13,8 @@ module AliyunVod::Service::Base if response.status != 200 message = case result['Code'] - when 'InvalidFileName.Extension' then '不支持的文件格式' - when 'IllegalCharacters' then '文件名称包含非法字符' + when 'InvalidFileName.Extension' then '不支持的视频格式' + when 'IllegalCharacters' then '视频名称包含非法字符' else raise AliyunVod::Error, result['Message'] end raise AliyunVod::Error, message if message.present?