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

dev_forum
hjm 5 years ago
commit f6a6c39429

@ -14,7 +14,7 @@ class CoursesController < ApplicationController
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner]
before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner, :apply_to_join_course]
:left_banner, :top_banner, :apply_to_join_course, :exit_course]
before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt,
:set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers,
:top_banner, :left_banner, :add_teacher_popup, :add_teacher,
@ -891,7 +891,7 @@ class CoursesController < ApplicationController
# end
# 创建学生身份
if params[:student].present?
if params[:student].present? && params[:student].to_i == 1
existing_student = CourseMember.find_by(course_id: course.id, role: %i[STUDENT], user_id: current_user.id)
if existing_student.present?
# 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班
@ -911,7 +911,7 @@ class CoursesController < ApplicationController
end
# 创建教师身份
if params[:professor].present? || params[:assistant_professor].present?
if (params[:professor].present? && params[:professor].to_i == 1) || (params[:assistant_professor].present? && params[:assistant_professor].to_i == 1)
teacher_already_exist = current_user.teacher_of_course_non_active? course
unless teacher_already_exist
existing_course_message = CourseMessage.find_by(course_id: course.id, course_message_id: current_user.id,
@ -920,8 +920,8 @@ class CoursesController < ApplicationController
course_message = CourseMessage.new(course_id: course.id, user_id: course.tea_id, status: 0,
course_message_id: current_user.id, course_message_type: "JoinCourseRequest",
viewed: false)
course_message.content = 2 if params[:professor].present?
course_message.content = 3 if params[:assistant_professor].present?
course_message.content = 2 if params[:professor].present? && params[:professor].to_i == 1
course_message.content = 3 if params[:assistant_professor].present? && params[:assistant_professor].to_i == 1
course_message.save!

@ -1,7 +1,7 @@
class SubjectsController < ApplicationController
before_action :require_login, :check_auth, except: [:index]
# before_action :check_auth, except: [:index]
before_action :find_subject, except: [:index, :create, :append_to_stage]
before_action :find_subject, except: [:index, :create, :new, :append_to_stage]
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
:up_member_position, :down_member_position]
@ -94,6 +94,10 @@ class SubjectsController < ApplicationController
@subject.increment!(:visits)
end
def new
normal_status("")
end
def create
ActiveRecord::Base.transaction do
begin

@ -21,7 +21,7 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选
user_answer_b = user_answer.include?(a.id)
json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现
json.choice_id a.id
json.choice_text "#{(index+65).chr}.#{a.choice_text}"
json.choice_text (edit_type.present? ? a.choice_text : "#{(index+65).chr}.#{a.choice_text}")
json.choice_position a.choice_position
if exercise_type == 1 || exercise_type == 4 #1为教师编辑/预览 试卷或问题2为空白试卷即标准答案和用户答案都不显示3为用户开始答题的显示4为老师评阅试卷或学生在截止后查看试卷
json.standard_boolean standard_answer_b

@ -6,4 +6,5 @@ json.partial! "exercise_questions/exercise_questions",
shixun_challenges: @exercise_question_shixun,
exercise_type:1,
user_answer:[],
ques_position:nil
ques_position:nil,
edit_type:true

@ -18,10 +18,9 @@ function locationurl(list){
}
// TODO 开发期多个身份切换
const debugType =""
// window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
// window._debugType = debugType;
const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
window.location.search.indexOf('debug=s') != -1 ? 'mfp2guqj3' : 'admin'
window._debugType = debugType;
export function initAxiosInterceptors(props) {
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation

@ -117,7 +117,7 @@ class Addcourses extends Component{
hidetojoinclass=()=>{
let {Addcoursestype}=this.props;
// console.log(this.props)
this.setState({
invite_code:undefined,
@ -132,11 +132,16 @@ class Addcourses extends Component{
student:null,
Addcoursestypes:false
})
if(Addcoursestype===true){
this.props.hideAddcoursestype();
}
}
submitasyn=(course_id)=>{
let{professor}=this.state;
let{professor,Addcoursestype}=this.state;
if(professor===1){
this.setState({
loadtype:true,
@ -145,13 +150,17 @@ class Addcourses extends Component{
modalSave:(course_id)=>this.submitasyns(course_id),
Addcoursestype:false
})
if(Addcoursestype===true){
this.props.hideAddcoursestype();
}
}else{
// let{course_id}=this.state;
this.setState({
Addcoursestype:false
})
if(Addcoursestype===true){
this.props.hideAddcoursestype();
}
window.location.href ="/courses/"+course_id+"/students";
}
@ -161,6 +170,7 @@ class Addcourses extends Component{
}
submittojoinclass=()=>{
let{Addcoursestype}=this.state;
this.setState({
isSpin:true
})
@ -213,7 +223,9 @@ class Addcourses extends Component{
message:"提示",
description:response.data.message
});
if(Addcoursestype===true){
this.props.hideAddcoursestype();
}
// this.props.showNotification(response.data.message);
@ -226,7 +238,9 @@ class Addcourses extends Component{
this.setState({
Addcoursestype:false
})
if(Addcoursestype===true){
this.props.hideAddcoursestype();
}
// this.setState({
@ -324,7 +338,7 @@ class Addcourses extends Component{
keyboard={false}
className={"HomeworkModal"}
title="加入课堂"
visible={Addcoursestype===undefined?Addcoursestypes:Addcoursestype}
visible={Addcoursestype===undefined||Addcoursestype===false?Addcoursestypes:Addcoursestype}
closable={false}
footer={null}
destroyOnClose={true}

Loading…
Cancel
Save