From 372c4c49003cd24504327f3c08ae8328c642e5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sun, 17 Nov 2019 14:10:00 +0800 Subject: [PATCH 1/5] =?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/tpm/NewHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 9c5652aaf..c5121ede6 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1187,7 +1187,7 @@ submittojoinclass=(value)=>{ onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}> this.onKeywordSearchKeyDowns()} onSearch={(value) => this.onKeywordSearchKeyDown(value)} // onPressEnter={this.onKeywordSearchKeyDown} @@ -1236,7 +1236,7 @@ submittojoinclass=(value)=>{ {coursestypes===true?"":
  • 我的课堂
  • } {/* p 老师 l 学生 */} {shixuntype===true?"":
  • 我的实训项目
  • } - {pathstype===true?"":
  • 我的实践课程
  • } + {pathstype===true?"":
  • 我的课程
  • } {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} {/*
  • 我的众包
  • */}
  • From ecd847efdd331bda2504cc6ed3da610ddf50a7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sun, 17 Nov 2019 14:20:40 +0800 Subject: [PATCH 2/5] =?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/tpm/NewHeader.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index c5121ede6..7a3c545ce 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1187,7 +1187,7 @@ submittojoinclass=(value)=>{ onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}> this.onKeywordSearchKeyDowns()} onSearch={(value) => this.onKeywordSearchKeyDown(value)} // onPressEnter={this.onKeywordSearchKeyDown} @@ -1233,10 +1233,10 @@ submittojoinclass=(value)=>{
      {/*{user.username}*/} - {coursestypes===true?"":
    • 我的课堂
    • } + {coursestypes===true?"":
    • {this.props.user&&this.props.user.main_site===false?"我的课堂":"我的翻转课堂"}
    • } {/* p 老师 l 学生 */} {shixuntype===true?"":
    • 我的实训项目
    • } - {pathstype===true?"":
    • 我的课程
    • } + {pathstype===true?"":
    • {this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}
    • } {this.props.user&&this.props.user.main_site===true?
    • 我的开发项目
    • :""} {/*
    • 我的众包
    • */}
    • @@ -1284,17 +1284,17 @@ submittojoinclass=(value)=>{
      {coursestypes===true&&this.props.user&&this.props.user.main_site===false?"":
        {coursestypes===true?"":
      • - 加入课堂 + {this.props.user&&this.props.user.main_site===false?"加入课堂":"加入翻转课堂"}
      • } {Addcoursestypes===true? Date: Sun, 17 Nov 2019 16:27:35 +0800 Subject: [PATCH 3/5] =?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/help/ContactUs.js | 2 +- public/react/src/modules/tpm/TPMIndexHOC.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/help/ContactUs.js b/public/react/src/modules/help/ContactUs.js index 04e3404fe..7f579bcf1 100644 --- a/public/react/src/modules/help/ContactUs.js +++ b/public/react/src/modules/help/ContactUs.js @@ -72,7 +72,7 @@ class ContactUs extends React.Component {
        公司地址
        - { address } + 长沙高新开发区尖山路39号长沙中电软件园一期13栋201室
      diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 69f54bd77..4408265ce 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -153,7 +153,7 @@ export function TPMIndexHOC(WrappedComponent) { window.addEventListener('keyup', this.keyupListener) if(this.props.match.path==="/"){ - document.title="创新源于实践"; + // document.title="创新源于实践"; }else if(this.props.match.path==="/403"){ document.title="你没有权限访问"; }else if(this.props.match.path==="/nopage"){ From dcba8c1e2e1487860516dcc1dc18f0e0dac10be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sun, 17 Nov 2019 20:25:10 +0800 Subject: [PATCH 4/5] =?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/tpm/component/TPMRightSection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index 803e1caf2..4306fc6e3 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -118,7 +118,7 @@ class TPMRightSection extends Component { } - {this.props.user&&this.props.user.main_site===true?

      所属课程

      @@ -159,7 +159,7 @@ class TPMRightSection extends Component { }) }
      - :""} + {TPMRightSectionData === undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "" : this.props.user&&this.props.user.main_site===true?
      Date: Mon, 18 Nov 2019 11:02:49 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BA=91=E4=B8=8A=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AE=A4fork=E7=89=88=E6=9C=AC=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/laboratory_subjects_controller.rb | 2 +- app/services/subjects/copy_subject_service.rb | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/controllers/admins/laboratory_subjects_controller.rb b/app/controllers/admins/laboratory_subjects_controller.rb index e534c6b4b..866a20a76 100644 --- a/app/controllers/admins/laboratory_subjects_controller.rb +++ b/app/controllers/admins/laboratory_subjects_controller.rb @@ -10,7 +10,7 @@ class Admins::LaboratorySubjectsController < Admins::BaseController def create subject = Subject.find(params[:subject_id]) - Subjects::CopySubjectService.call(subject, current_user.id, current_laboratory) + Subjects::CopySubjectService.call(subject, current_user, current_laboratory) render_ok end diff --git a/app/services/subjects/copy_subject_service.rb b/app/services/subjects/copy_subject_service.rb index 7d32189a5..5f8481cae 100644 --- a/app/services/subjects/copy_subject_service.rb +++ b/app/services/subjects/copy_subject_service.rb @@ -1,9 +1,9 @@ class Subjects::CopySubjectService < ApplicationService - attr_reader :subject, :to_subject, :user_id, :laboratory + attr_reader :subject, :to_subject, :user, :laboratory - def initialize(subject, user_id, laboratory=nil) + def initialize(subject, user, laboratory=nil) @subject = subject - @user_id = user_id + @user = user @laboratory = laboratory subject_params = subject.attributes.dup.except('id', 'copy_subject_id', 'user_id', 'homepage_show') @to_subject = Subject.new(subject_params) @@ -21,7 +21,7 @@ class Subjects::CopySubjectService < ApplicationService # 复制实践课程表 def copy_subject! to_subject.copy_subject_id = subject.id - to_subject.user_id = user_id + to_subject.user_id = user.id to_subject.save! copy_stages_data!(subject, to_subject) @@ -34,7 +34,7 @@ class Subjects::CopySubjectService < ApplicationService subject.stages.each do |stage| to_stage = to_subject.stages.new to_stage.attributes = stage.attributes.dup.except('id', 'subject_id', 'user_id') - to_stage.user_id = user_id + to_stage.user_id = user.id to_stage.save! copy_stage_shixuns_data!(stage, to_stage) @@ -61,10 +61,15 @@ class Subjects::CopySubjectService < ApplicationService to_shixun.attributes = shixun.attributes.dup.except('id', 'user_id', 'identifier', 'homepage_show', 'use_scope', 'averge_star', 'myshixuns_count') to_shixun.identifier = Util::UUID.generate_identifier(Shixun, 8) - to_shixun.user_id = user_id + to_shixun.user_id = user.id if laboratory to_shixun.laboratory_id = laboratory.id end + # 复制版本库 + fork_repository_name = "#{user.login}/#{to_shixun.identifier}" + GitService.fork_repository(repo_path: "#{shixun.repo_name}.git", + fork_repository_path: (fork_repository_name + ".git")) + to_shixun.repo_name = fork_repository_name to_shixun.save! copy_shixun_info_data!(shixun, to_shixun) @@ -124,7 +129,7 @@ class Subjects::CopySubjectService < ApplicationService shixun.challenges.each do |challenge| to_challenge = to_shixun.challenges.new to_challenge.attributes = challenge.attributes.dup.except('id', 'shixun_id', 'praises_count', 'user_id', 'visits') - to_challenge.user_id = user_id + to_challenge.user_id = user.id to_challenge.shixun_id = to_shixun.id to_challenge.save! @@ -201,12 +206,12 @@ class Subjects::CopySubjectService < ApplicationService # 创建实训成员 def copy_shixun_members_data!(to_shixun) - to_shixun.shixun_members.create!(user_id: user_id, role: 1) + to_shixun.shixun_members.create!(user_id: user.id, role: 1) end # 创建课程成员 def copy_subject_members_data(to_subject) - to_subject.subject_members.create!(user_id: user_id, role: 1) + to_subject.subject_members.create!(user_id: user.id, role: 1) end end