dev_home
jingquan huang 5 years ago
commit 7b37f7521c

@ -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

@ -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

@ -72,7 +72,7 @@ class ContactUs extends React.Component {
<div className="contact-item-label">公司地址</div>
<div className="contact-item-content">
<Row>
<Col span={12}>{ address }</Col>
<Col span={12}>长沙高新开发区尖山路39号长沙中电软件园一期13栋201室</Col>
</Row>
</div>
</div>

@ -1187,7 +1187,7 @@ submittojoinclass=(value)=>{
onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
<Search
id={"HeaderSearchs"}
placeholder="实践课程/课堂/实训项目/交流问答"
placeholder="实践课程/翻转课堂/实训项目/交流问答"
onInput={()=>this.onKeywordSearchKeyDowns()}
onSearch={(value) => this.onKeywordSearchKeyDown(value)}
// onPressEnter={this.onKeywordSearchKeyDown}
@ -1233,10 +1233,10 @@ submittojoinclass=(value)=>{
</a>
<ul className="edu-menu-list" style={{top:'60px'}}>
{/*<span className="bor-bottom-greyE currentName task-hide">{user.username}</span>*/}
{coursestypes===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的课堂</Link></li>}
{coursestypes===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>{this.props.user&&this.props.user.main_site===false?"我的课堂":"我的翻转课堂"}</Link></li>}
{/* p 老师 l 学生 */}
{shixuntype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>}
{pathstype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li>}
{pathstype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>{this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}</Link></li>}
{this.props.user&&this.props.user.main_site===true?<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的开发项目</Link></li>:""}
{/*<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/package`}>我的众包</Link></li>*/}
<li style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.customer_management_url===null || this.props.Headertop.customer_management_url===""? 'none' : 'block'}}>
@ -1284,17 +1284,17 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===false?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建课堂</a></li>}
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"翻转课堂"}</a></li>}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
pathstype===true?"":<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>
pathstype===true?"":this.props.user&&this.props.user.main_site===true||this.props.user&&this.props.user.admin===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""
}
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}
</ul>
{coursestypes===true&&this.props.user&&this.props.user.main_site===false?"":<ul className="fl with50 edu-txt-center">
{coursestypes===true?"":<li>
<a onClick={this.tojoinclass}>加入课堂</a>
<a onClick={this.tojoinclass}>{this.props.user&&this.props.user.main_site===false?"加入课堂":"加入翻转课堂"}</a>
</li>}
{Addcoursestypes===true?<Addcourses

@ -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"){

@ -118,7 +118,7 @@ class TPMRightSection extends Component {
}
{this.props.user&&this.props.user.main_site===true?<div className="padding20 edu-back-white mb10 mt10" style={{
<div className="padding20 edu-back-white mb10 mt10" style={{
display: TPMRightSectionData === undefined?"none":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "none" : "block"
}}>
<p className="mb20 font-16 clearfix">所属课程</p>
@ -159,7 +159,7 @@ class TPMRightSection extends Component {
})
}
</div>
</div>:""}
</div>
{TPMRightSectionData === undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "" :
this.props.user&&this.props.user.main_site===true?<div className="padding20 edu-back-white"

Loading…
Cancel
Save