diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb
index 917f3ad8e..096a0fe52 100644
--- a/app/controllers/subjects_controller.rb
+++ b/app/controllers/subjects_controller.rb
@@ -10,6 +10,7 @@ class SubjectsController < ApplicationController
include ApplicationHelper
include SubjectsHelper
+ include GitCommon
def index
@tech_system = current_laboratory.subject_repertoires
@@ -219,6 +220,18 @@ class SubjectsController < ApplicationController
@shixun = Shixun.create!(name: params[:name], user_id: current_user.id, identifier: identifier)
# 添加合作者
@shixun.shixun_members.create!(user_id: current_user.id, role: 1)
+ # 创建长字段
+ ShixunInfo.create!(shixun_id: @shixun.id, description: "请在此处添加实训描述")
+ # 创建版本库
+ repo_path = repo_namespace(current_user.login, identifier)
+ GitService.add_repository(repo_path: repo_path)
+ # todo: 为什么保存的时候要去除后面的.git呢??
+ @shixun.update_column(:repo_name, repo_path.split(".")[0])
+ mirror_id = MirrorRepository.find_by(type_name: 'Python3.6')&.id
+ if mirror_id
+ ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
+ @shixun.shixun_service_configs.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
+ end
end
end
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index 32051575b..d0b54671f 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -1289,7 +1289,7 @@ submittojoinclass=(value)=>{
}
{shixuntype===true?"":
this.getUser("/shixuns/new")}>新建实训项目}
{this.props.Headertop===undefined?"":
- pathstype===true?"":this.props.user&&this.props.user.main_site===true||this.props.user&&this.props.user.admin===true?this.getUser("/paths/new")} >新建实践课程:""
+ pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?this.getUser("/paths/new")} >新建实践课程:""
}
{this.props.user&&this.props.user.main_site===true?this.getUser("/projects/new","projects")} target="_blank">新建开发项目:""}
diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer2.js b/public/react/src/modules/tpm/challengesnew/TPManswer2.js
index 6cbfcd081..ba38776cd 100644
--- a/public/react/src/modules/tpm/challengesnew/TPManswer2.js
+++ b/public/react/src/modules/tpm/challengesnew/TPManswer2.js
@@ -177,7 +177,8 @@ export default class TPManswer extends Component {
this.props.showSnackbar(response.data.message);
}
if (response.data.status == 1) {
- $("html").animate({ scrollTop: 0 })
+ window.location.href=`/shixuns/${id}/challenges`;
+ // $("html").animate({ scrollTop: 0 })
}
}
diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js
index 9da0b79f5..f6bac13a5 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js
@@ -240,8 +240,8 @@ export default class TPMchallengesnew extends Component {
}).then((response) => {
if (response.data.status === 1) {
// $("html").animate({ scrollTop: 0 })
-
- window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/editcheckpoint`;
+ //window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/editcheckpoint?tab=2`;
+ window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`;
// this.setState({
// setopen: true,
// CreatePracticesendtype:false,
@@ -363,6 +363,7 @@ export default class TPMchallengesnew extends Component {
}).then((response) => {
this.props.showSnackbar(response.data.messages);
if (response.data.status === 1) {
+ window.location.href=`/shixuns/${id}/challenges/${checkpointId}/tab=2`;
this.setState({
setopen: true,
editPracticesendtype:false,
diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
index f29e9311e..c4e28a883 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
@@ -673,6 +673,7 @@ export default class TPMevaluation extends Component {
}
).then((response) => {
this.props.showSnackbar(response.data.messages);
+ window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=3`;
// if(response.data.status===1){
// window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3"
// }
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js
index 1470d45db..b6d70af87 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js
@@ -380,31 +380,31 @@ class Challenges extends Component {
全部任务
- {this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?
-
-
-
- 实践任务
-
-
- : ""
- }
- {this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?
-
-
-
- 选择题任务
-
- : ""
- }
+ {/*{this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?*/}
+ {/**/}
+ {/**/}
+ {/*
*/}
+ {/*实践任务*/}
+ {/**/}
+
+ {/* : ""*/}
+ {/*}*/}
+ {/*{this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?*/}
+ {/**/}
+ {/**/}
+ {/*
*/}
+ {/*选择题任务*/}
+ {/**/}
+ {/* : ""*/}
+ {/*}*/}