Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl

dev_oauth
杨树林 6 years ago
commit 632f6d1905

@ -1129,12 +1129,12 @@ class CoursesController < ApplicationController
def validate_course_name
tip_exception("课堂名称不能为空!") if params[:course][:name].blank?
if params[:subject_id].blank? || @course.subject.blank?
if params[:subject_id].blank? || (@course && @course.subject.blank?)
tip_exception("课程名称不能为空!") if params[:course_list_name].blank?
tip_exception("课堂名称应以课程名称开头命名") unless params[:course][:name].index(params[:course_list_name]) &&
params[:course][:name].index(params[:course_list_name]) == 0
else
@subject = @course ? @course.subject : Subject.find_by!(id: params[:subject_id])
@subject = @course.present? ? @course.subject : Subject.find_by!(id: params[:subject_id])
tip_exception("开始时间不能为空") if params[:start_date].blank?
tip_exception("结束时间不能为空") if params[:end_date].blank?
tip_exception("结束时间必须晚于开始时间") if params[:end_date] <= params[:start_date]

@ -23,24 +23,19 @@ class MyshixunsController < ApplicationController
begin
ActiveRecord::Base.transaction do
begin
@shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id)
@shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id)
@myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
# 实训在申请发布前,是否玩过实训,如果玩过需要更改记录,防止二次重置
shixun_mod = ShixunModify.where(:shixun_id => @shixun.id, :myshixun_id => @myshixun.id, :status => 1).take
shixun_mod.update_column(:status, 0) if shixun_mod
rescue Exception => e
logger.error("######reset_my_game_failed:#{e.message}")
raise("ActiveRecord::RecordInvalid")
end
end
# 删除版本库
GitService.delete_repository(repo_path: @repo_path)
GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type?
rescue Exception => e
if e.message != "ActiveRecord::RecordInvalid"
logger.error("######delete_repository_error:#{e.message}")
logger.error("######delete_repository_error-:#{e.message}")
end
raise "delete_repository_error:#{e.message}"
end

@ -5,7 +5,7 @@ class Course < ApplicationRecord
belongs_to :teacher, class_name: 'User', foreign_key: :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, class_name: 'School', foreign_key: :school_id #定义一个方法school该方法通过school_id来调用School表
belongs_to :course_list
belongs_to :course_list, optional: true
# 所属实践课程
belongs_to :subject, optional: true
@ -91,7 +91,7 @@ class Course < ApplicationRecord
NORMAL = 6 # 普通用户
Anonymous = 7 # 普未登录
validates :name, presence: true, length: { maximum: 30 }
validates :name, presence: true, length: { maximum: 60 }
after_create :create_board_sync, :act_as_course_activity, :send_tiding

@ -1,5 +1,5 @@
json.course_list_id @course.course_list.id
json.course_list_name @course.course_list.name
json.course_list_id @course.course_list&.id
json.course_list_name @course.course_list&.name
json.name @course.name
json.course_id @course.id
json.school @course.school&.name

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -149,18 +149,18 @@ class ListPageIndex extends Component{
<div className="newMain clearfix">
{/*头部banner*/}
<CoursesBanner {...this.props}></CoursesBanner>
{yslGuideone!==undefined?
(
yslGuideone===true?
<Guide
setwindowlocal={(b)=>this.setwindowlocal(b)}
>
</Guide>
:""
)
:""
}
{/*下面是指引哦*/}
{/*{yslGuideone!==undefined?*/}
{/*(*/}
{/* yslGuideone===true?*/}
{/* <Guide*/}
{/* setwindowlocal={(b)=>this.setwindowlocal(b)}*/}
{/* >*/}
{/* </Guide>*/}
{/* :""*/}
{/* )*/}
{/* :""*/}
{/*}*/}
<div className="educontent clearfix" style={{flex: "1 0 auto"}}>
<div className="stud-class-set">

@ -41,7 +41,8 @@ class CoursesNew extends Component {
searchlist: [],
searchlistscholl:[],
listvalue: undefined,
fetching:false
fetching:false,
boolxinjian:false,
}
}
@ -80,6 +81,9 @@ class CoursesNew extends Component {
}).catch((error) => {
console.log(error);
})
this.setState({
boolxinjian:false,
});
}else{
let url = "/courses/new.json"
axios.get(url).then((result) => {
@ -96,18 +100,25 @@ class CoursesNew extends Component {
});
this.handleSearchschool(user_school);
this.setState({
boolxinjian:true,
});
}
}
componentDidUpdate(prevProps){
// if(prevProps.current_user!=this.props.current_user){
// if(this.props.current_user.user_identity==="学生"){
// window.location.href ="/403"
// }
// }
}
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user){
let user_school=this.props.current_user&&this.props.current_user.user_school;
this.props.form.setFieldsValue({
school:user_school,
});
this.setState({
school:user_school,
});
this.handleSearchschool(user_school);
}
}
onChangeTimepublishs = (date, dateString) => {
if(dateString===""){
this.setState({
@ -207,18 +218,20 @@ class CoursesNew extends Component {
// this.goback()
window.location.href=first_category_url;
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if(yslGuideone=== null){
window.localStorage.setItem('yslGuideone', "true");
return
}
if(yslGuideone=== undefined){
window.localStorage.setItem('yslGuideone', "true");
return
}
}catch (e) {
if(this.state.boolxinjian===true) {
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if (yslGuideone === null) {
window.localStorage.setItem('yslGuideone', "true");
return
}
if (yslGuideone === undefined) {
window.localStorage.setItem('yslGuideone', "true");
return
}
} catch (e) {
}
}
}
@ -265,19 +278,23 @@ class CoursesNew extends Component {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url;
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if(yslGuideone=== null){
window.localStorage.setItem('yslGuideone', "true");
return
}
if(yslGuideone=== undefined){
window.localStorage.setItem('yslGuideone', "true");
return
}
}catch (e) {
if(this.state.boolxinjian===true){
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if(yslGuideone=== null){
window.localStorage.setItem('yslGuideone', "true");
return
}
if(yslGuideone=== undefined){
window.localStorage.setItem('yslGuideone', "true");
return
}
}catch (e) {
}
}
}
}
}).catch((error) => {
console.log(error)

@ -6,7 +6,9 @@ import guihome2 from "../../../images/guideimg/guihome2.jpg";
import guihome3 from "../../../images/guideimg/guihome3.jpg";
import guihome4 from "../../../images/guideimg/guihome4.jpg";
import guihome5 from "../../../images/guideimg/guihome5.jpg";
import guihome6 from "../../../images/guideimg/guihome6.jpg";
import guihome6 from "../../../images/guideimg/guihome6.jpg";
// import guihome6 from "../../../images/guideimg/guihome6.png";
// import guihome7 from "../../../images/guideimg/guihome7.png";
class Guide extends Component {
@ -123,6 +125,7 @@ class Guide extends Component {
page===6?
<div className="guide-content">
<img className={mywidth===1?"ysldiv61024":mywidth===2?"ysldiv61280":mywidth===3?"ysldiv61440":mywidth===4?"ysldiv61680":mywidth===5?"ysldiv61900":mywidth===6?"ysldiv61366":mywidth===7?"ysldiv61600":"ysldiv61900"} src={guihome6} onClick={(i)=>this.thissetPage(7)}/>
{/*<img className={mywidth===1?"ysldiv71024":mywidth===2?"ysldiv71280":mywidth===3?"ysldiv71440":mywidth===4?"ysldiv71680":mywidth===5?"ysldiv71900":mywidth===6?"ysldiv71366":mywidth===7?"ysldiv71600":"ysldiv71900"} src={guihome7} onClick={(i)=>this.thissetPage(7)}/>*/}
</div>
:
""

@ -470,4 +470,49 @@
margin-left: 27%;
margin-right: 0;
height: 40%;
}
.ysldiv71900{
margin-top: 16%;
margin-left: 34%;
margin-right: 19%
}
.ysldiv71680{
margin-top: 18%;
margin-left: 31%;
margin-right: 14%;
}
.ysldiv71600{
margin-top: 19%;
margin-left: 30%;
margin-right: 12%;
}
.ysldiv71440{
margin-top: 21%;
margin-left: 28%;
margin-right: 8%;
}
.ysldiv71280{
margin-top: 24%;
margin-left: 25%;
margin-right: 3%;
height: 53%;
}
.ysldiv71366{
margin-top: 22%;
margin-left: 26%;
margin-right: 6%;
height: 53%;
}
.ysldiv71024{
margin-top: 31%;
margin-left: 27%;
margin-right: 0;
height: 40%;
}
Loading…
Cancel
Save