Merge branch 'dev_aliyun' into develop

dev_hs
daiao 6 years ago
commit 1df26c65bb

@ -33,7 +33,7 @@ class AccountsController < ApplicationController
uid_logger("start register: verifi_code is #{verifi_code}, code is #{code}, time is #{Time.now.to_i - verifi_code.try(:created_at).to_i}")
# check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60)
# todo 上线前请删除万能验证码"513231"
unless code == "513231" && request.host == "47.96.87.25"
unless code == "513231" && request.subdomain == "pre-newweb"
return normal_status(-2, "验证码不正确") if verifi_code.try(:code) != code.strip
return normal_status(-2, "验证码已失效") if !verifi_code&.effective?
end

@ -240,12 +240,13 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
User.current = User.find 12
User.current = User.find 1
end
# 测试版前端需求
if request.host == "47.96.87.25"
logger.info("subdomain:#{request.subdomain}")
if request.subdomain == "pre-newweb"
if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除
User.current = User.find 81403
elsif params[:debug] == 'student'

@ -357,20 +357,20 @@ class ExerciseQuestionsController < ApplicationController
#当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数.
if standard_answer_change && @exercise.exercise_status >= Exercise::PUBLISHED
ex_users_committed = @exercise.exercise_users.exercise_user_committed
if ex_users_committed.size > 0
ex_users_committed.each do |ex_user|
update_objective_score = update_single_score(@exercise_question,ex_user.user_id,standard_answer)
if update_objective_score != 0
objective_score = ex_user.objective_score
new_objective_score = objective_score + update_objective_score
total_score = ex_user.score + update_objective_score
total_score = total_score < 0.0 ? 0.0 : total_score
ex_user.update_attributes(objective_score:new_objective_score,score:total_score)
end
end
end
normal_status(0,"试卷更新成功,因标准答案修改,需重新计算学生成绩!")
# ex_users_committed = @exercise.exercise_users.exercise_user_committed
# if ex_users_committed.size > 0
# ex_users_committed.each do |ex_user|
# update_objective_score = update_single_score(@exercise_question,ex_user.user_id,standard_answer)
# if update_objective_score != 0
# objective_score = ex_user.objective_score
# new_objective_score = objective_score + update_objective_score
# total_score = ex_user.score + update_objective_score
# total_score = total_score < 0.0 ? 0.0 : total_score
# ex_user.update_attributes(objective_score:new_objective_score,score:total_score)
# end
# end
# end
normal_status(3,"修改了标准答案\n是否重新计算学生答题的成绩?")
else
normal_status(0,"试卷更新成功!")
end
@ -383,6 +383,31 @@ class ExerciseQuestionsController < ApplicationController
end
end
def update_scores
ActiveRecord::Base.transaction do
begin
standard_answer = params[:standard_answers]
ex_users_committed = @exercise.exercise_users.exercise_user_committed
if ex_users_committed.size > 0
ex_users_committed.each do |ex_user|
update_objective_score = update_single_score(@exercise_question,ex_user.user_id,standard_answer)
if update_objective_score != 0
objective_score = ex_user.objective_score
new_objective_score = objective_score + update_objective_score
total_score = ex_user.score + update_objective_score
total_score = total_score < 0.0 ? 0.0 : total_score
ex_user.update_attributes(objective_score:new_objective_score,score:total_score)
end
end
end
normal_status(0,"学生成绩更新成功")
rescue Exception => e
uid_logger_error(e.message)
tip_exception("答案删除失败!")
end
end
end
# 试卷问题的上下移动
def up_down
ActiveRecord::Base.transaction do

@ -992,13 +992,15 @@ class HomeworkCommonsController < ApplicationController
@total_count = @subjects.size
if reorder != "myshixun_count"
@subjects = @subjects.page(page).per(limit).includes(:shixuns, user: [user_extension: :school])
# @subjects = @subjects.page(page).per(limit).includes(:shixuns, user: [user_extension: :school])
@subjects = @subjects.page(page).per(limit).includes(:shixuns)
else
@subjects = @subjects[offset, limit]
unless @subjects.blank?
subject_ids = @subjects.pluck(:id)
order_ids = subject_ids.size > 0 ? subject_ids.join(',') : -1
@subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, user: [user_extension: :school])
# @subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, user: [user_extension: :school])
@subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns)
end
end
end

@ -87,14 +87,6 @@ class SubjectsController < ApplicationController
@courses = @subject.courses if @subject.excellent
@members = @subject.subject_members.includes(:user)
shixuns = @subject.shixuns.published.pluck(:id)
challenge_ids = Challenge.where(shixun_id: shixuns).pluck(:id)
# 实训路径中的所有实训标签
@tags = ChallengeTag.where(challenge_id: challenge_ids).pluck(:name).uniq
# 用户获取的实训标签
# @user_tags = @subject.shixuns.map(&:user_tags_name).flatten.uniq
@user_tags = user_shixun_tags challenge_ids, @user.id
@my_subject_progress = @subject.my_subject_progress
# 访问数变更
@subject.increment!(:visits)
end

@ -461,45 +461,50 @@ module ExercisesHelper
end
elsif q.question_type == 5 #实训题时,主观题这里不评分
q.exercise_shixun_challenges&.each do |exercise_cha|
game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡
if game.present?
exercise_cha_score = 0.0
answer_status = 0
# if game.status == 2 && game.final_score >= 0
if game.final_score > 0
exercise_cha_score = game.real_score(exercise_cha.question_score)
# exercise_cha_score = exercise_cha.question_score #每一关卡的得分
answer_status = 1
end
ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id)
code = nil
if exercise_cha.challenge&.path.present?
cha_path = challenge_path(exercise_cha.challenge&.path)
game_challenge = game.game_codes.search_challenge_path(cha_path)&.first
if game_challenge.present?
game_code = game_challenge
code = game_code.try(:new_code)
user_shixun_score = exercise_cha&.exercise_shixun_answers&.where(user_id:user.id,exercise_question_id:q.id)
if user_shixun_score.present?
score5 += user_shixun_score&.first.score
else
game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡
if game.present?
exercise_cha_score = 0.0
answer_status = 0
# if game.status == 2 && game.final_score >= 0
if game.final_score > 0
exercise_cha_score = game.real_score(exercise_cha.question_score)
# exercise_cha_score = exercise_cha.question_score #每一关卡的得分
answer_status = 1
end
ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id)
code = nil
if exercise_cha.challenge&.path.present?
cha_path = challenge_path(exercise_cha.challenge&.path)
game_challenge = game.game_codes.search_challenge_path(cha_path)&.first
if game_challenge.present?
game_code = game_challenge
code = game_code.try(:new_code)
else
code = git_fle_content(game.myshixun.repo_path,cha_path)
end
end
if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里
### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了涉及到code的多个版本库的修改
sx_option = {
:exercise_question_id => q.id,
:exercise_shixun_challenge_id => exercise_cha.id,
:user_id => user.id,
:score => exercise_cha_score.round(1),
:answer_text => code,
:status => answer_status
}
ExerciseShixunAnswer.create(sx_option)
else
code = git_fle_content(game.myshixun.repo_path,cha_path)
ex_shixun_answer_content.first.update_attributes(score:exercise_cha_score.round(1),answer_text:code)
end
end
if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里
### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了涉及到code的多个版本库的修改
sx_option = {
:exercise_question_id => q.id,
:exercise_shixun_challenge_id => exercise_cha.id,
:user_id => user.id,
:score => exercise_cha_score.round(1),
:answer_text => code,
:status => answer_status
}
ExerciseShixunAnswer.create(sx_option)
score5 += exercise_cha_score
else
ex_shixun_answer_content.first.update_attributes(score:exercise_cha_score.round(1),answer_text:code)
score5 += 0.0
end
score5 += exercise_cha_score
else
score5 += 0.0
end
end
end

@ -0,0 +1,21 @@
class CreateStudentWorkJob < ApplicationJob
queue_as :default
def perform(homework_id)
homework = HomeworkCommon.find_by(id: homework_id)
course = homework&.course
return if homework.blank? || course.blank?
attrs = %i[homework_common_id user_id created_at updated_at]
same_attrs = {homework_common_id: homework.id}
StudentWork.bulk_insert(*attrs) do |worker|
student_ids = course.students.pluck(:user_id)
student_ids.each do |user_id|
worker.add same_attrs.merge(user_id: user_id)
end
end
end
end

@ -80,6 +80,11 @@ class HomeworkCommon < ApplicationRecord
end
end
# 实训作业的主目录信息
def main_category_info
{category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name)}
end
# 根据是否统一发布获取作业的作品列表
def all_works
student_works = self.unified_setting ? self.student_works :

@ -0,0 +1,2 @@
class OldMessageDetail < ApplicationRecord
end

@ -39,9 +39,10 @@ class Subject < ApplicationRecord
courses.pluck(:end_date).max
end
# 挑战过路径的成员数
# 挑战过路径的成员数(金课统计去重后的报名人数)
def member_count
shixuns.pluck(:myshixuns_count).sum
excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > shixuns.pluck(:myshixuns_count).sum ?
CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length : shixuns.pluck(:myshixuns_count).sum
end
def all_score

@ -15,7 +15,8 @@ class HomeworksService
homework_detail_manual.save! if homework_detail_manual
HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: shixun.id)
HomeworksService.new.create_shixun_homework_cha_setting(homework, shixun)
HomeworksService.new.create_works_list(homework, course)
CreateStudentWorkJob.perform_later(homework.id)
# HomeworksService.new.create_works_list(homework, course)
end
homework
end

@ -779,4 +779,7 @@ html>body #ajax-indicator { position: fixed; }
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.yslminHeigth{
min-height: 400px;
}

@ -2,6 +2,7 @@ json.course_id course.id
json.course_name course.name
json.is_end course.is_end
json.category homework.category_info
json.main_category homework.main_category_info if homework.homework_type == "practice"
member = course.course_members.find_by(user_id: user.id, is_active: 1)
curr_status = homework_curr_status(homework, user.course_identity(course), course, member, member&.teacher_course_groups)
json.homework_status curr_status[:status]

@ -6,12 +6,12 @@ end
json.subject_list @subjects do |subject|
json.subject_id subject.id
json.subject_name subject.name
json.challenge_tags subject.shixun_tags
# json.challenge_tags subject.shixun_tags
json.shixun_count subject.shixuns.unhidden.size
json.myshixun_count subject.shixuns.pluck(:myshixuns_count).sum
json.creator subject.user&.full_name
json.creator_login subject.user&.login
json.school subject.user&.school_name
# json.creator subject.user&.full_name
# json.creator_login subject.user&.login
# json.school subject.user&.school_name
end
json.subjects_count @total_count

@ -23,26 +23,4 @@ if @subject.excellent
json.course_identity @user.course_identity(course)
json.course_status subject_course_status course
end
end
json.members @members do |member|
json.partial! 'subject_member', locals: { user: member.user }
json.role member.role
end
# 技能标签
json.tags @tags do |tag|
unless tag.blank?
json.tag_name tag
json.status @user_tags.include?(tag)
end
end
# 我的进展
json.progress do
json.my_score @subject.my_subject_score
json.all_score @subject.all_score
json.learned @subject.my_subject_progress
json.time @subject.my_consume_time
end

@ -603,6 +603,7 @@ Rails.application.routes.draw do
post :up_down
post :delete_answer
post :adjust_score
post :update_scores
end
resource :exercise_answers,only:[:create,:destroy]
end

@ -1,19 +1,39 @@
class AddExerciseUserUpdate < ActiveRecord::Migration[5.2]
include ExercisesHelper
def change
# exs = Exercise.all.is_exercise_published.where("publish_time > ?",(Time.now - 2.months)).includes(:exercise_questions,:exercise_users)
# exs.each do |ex|
# ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",(Time.now - 2.months))
# if ex_users.present?
# ex_users.each do |ex_user|
# calculate_score = calculate_student_score(ex,ex_user.user)[:total_score]
# subjective_score = ex_user.subjective_score
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
# total_score = calculate_score + total_score_subjective_score
# ex_user.update_attributes(score:total_score,objective_score:calculate_score)
# puts ex_user.id
# end
# end
# end
end
# include ExercisesHelper
# def change
# #2019,8,22添加
# two_months = Time.now - 2.months
# exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users)
# exs.each do |ex|
# if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新
# ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months)
# if ex_users.exists?
# ex_users.each do |ex_user|
# calculate_score = calculate_student_score(ex,ex_user.user)[:total_score]
# subjective_score = ex_user.subjective_score
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
# total_score = calculate_score + total_score_subjective_score
# ex_user.update_attributes(score:total_score,objective_score:calculate_score)
# puts ex_user.id
# end
# end
# end
# end
#
# #1936的试卷成绩有问题。
# # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
# ex_special = Exercise.find_by_id(1936)
# ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months)
# if ex_special.present? && ex_special_users.exists?
# ex_special_users.each do |ex_user|
# calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
# subjective_score = ex_user.subjective_score
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
# total_score = calculate_score + total_score_subjective_score
# ex_user.update_attributes(score:total_score,objective_score:calculate_score)
# puts ex_user.id
# end
# end
# end
end

@ -0,0 +1,13 @@
class ModifyContentsForOldMessageDetails < ActiveRecord::Migration[5.2]
def change
messages = Message.where(subject: "新课导语").where.not(parent_id: 0).where("created_on < '2019-08-23 02:00:00'")
messages.find_each do |m|
m.update_column(:is_md, true)
message_detail = m.message_detail
if message_detail
content = OldMessageDetail.find_by_id(message_detail.id)&.content
message_detail.update_column(:content, content)
end
end
end
end

@ -17,6 +17,7 @@ import {getUploadActionUrl, bytesToSize, uploadNameSizeSeperator, appendFileSize
const confirm = Modal.confirm;
const $ = window.$
const { Option } = Select;
const MAX_TITLE_LENGTH = 60
// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=71072679-b925-4824-aceb-4649535e3652
class BoardsNew extends Component{
constructor(props){
@ -27,7 +28,7 @@ class BoardsNew extends Component{
this.state = {
fileList: [],
boards: [],
title_num: 60
title_num: 0
}
}
addSuccess = () => {
@ -95,7 +96,7 @@ class BoardsNew extends Component{
}
})
this.setState({ fileList: _fileList, board_name: data.board_name, title_num: 60 - parseInt(data.subject.length) })
this.setState({ fileList: _fileList, board_name: data.board_name, title_num: parseInt(data.subject.length) })
}
}
})
@ -233,9 +234,15 @@ class BoardsNew extends Component{
changeTitle=(e)=>{
console.log(e.target.value.length);
this.setState({
title_num: 60 - parseInt(e.target.value.length)
title_num: parseInt(e.target.value.length)
})
}
goBack = () => {
// this.props.history.goBack()
const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId
this.props.toListPage(courseId, boardId)
}
render() {
let { addGroup, fileList, course_id, title_num } = this.state;
const { getFieldDecorator } = this.props.form;
@ -309,8 +316,8 @@ class BoardsNew extends Component{
<p className="clearfix mt20 mb20">
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}帖子</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
onClick={() => this.props.history.goBack()}>
{/*返回*/}
onClick={this.goBack}>
返回
</a>
</p>
{/* notRequired */}
@ -339,11 +346,11 @@ class BoardsNew extends Component{
rules: [{
required: true, message: '请输入标题',
}, {
max: 60, message: '最大限制为60个字符',
max: MAX_TITLE_LENGTH, message: `最大限制为${MAX_TITLE_LENGTH}个字符`,
}],
})(
<Input placeholder="请输入帖子标题最大限制60个字符" className="searchViewAfter" maxLength="60"
onInput={this.changeTitle} addonAfter={String(title_num)} />
<Input placeholder={`请输入帖子标题,最大限制${MAX_TITLE_LENGTH}个字符 `}className="searchViewAfter" maxLength={MAX_TITLE_LENGTH}
onInput={this.changeTitle} suffix={`${title_num}/${MAX_TITLE_LENGTH}`} />
)}
</Form.Item>

@ -75,15 +75,15 @@ class CommonWorkDetailIndex extends Component{
})
}
goback = () => {
// let workId=this.props.match.params.workId;
let workId=this.props.match.params.workId;
//
// if ( window.location.pathname.indexOf('appraise') == -1) {
// let category_id= this.state.category.category_id;
// this.props.toListPage(this.props.match.params, category_id)
// } else {
// this.props.toWorkListPage(this.props.match.params, workId)
// }
this.props.history.goBack()
if ( window.location.pathname.indexOf('appraise') == -1) {
let category_id= this.state.category.category_id;
this.props.toListPage(this.props.match.params, category_id)
} else {
this.props.toWorkListPage(this.props.match.params, workId)
}
// this.props.history.goBack()
}
// 补交附件

@ -9,6 +9,7 @@ import CBreadcrumb from '../common/CBreadcrumb'
const confirm = Modal.confirm;
const $ = window.$
const MAX_TITLE_LENGTH = 60;
class NewWork extends Component{
constructor(props){
super(props);
@ -17,7 +18,7 @@ class NewWork extends Component{
this.state={
title_value:"",
title_num:60,
title_num: 0,
contentFileList: [],
answerFileList: [],
workLoaded: false,
@ -91,7 +92,7 @@ class NewWork extends Component{
// course_id: data.course_id,
// course_name: data.course_name,
// category: data.category,
title_num: 60 - parseInt(data.name.length),
title_num: parseInt(data.name.length),
workLoaded: true,
init_min_num: data.min_num,
init_max_num: data.max_num,
@ -125,7 +126,7 @@ class NewWork extends Component{
changeTitle=(e)=>{
console.log(e.target.value.length);
this.setState({
title_num: 60 - parseInt(e.target.value.length)
title_num: parseInt(e.target.value.length)
})
}
handleSubmit = () => {
@ -398,7 +399,7 @@ class NewWork extends Component{
required: true, message: '请输入标题'
}],
})(
<Input placeholder="请输入作业标题最大限制60个字符" onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength="60" addonAfter={String(title_num)}/>
<Input placeholder="请输入作业标题最大限制60个字符" onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength={MAX_TITLE_LENGTH} suffix={`${String(title_num)}/${MAX_TITLE_LENGTH}`}/>
)}
</Form.Item>
<style>{`

@ -652,10 +652,10 @@ class CoursesBanner extends Component {
`}
</style>
<Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")} className={"pointer"}>
<span className="color-grey-c font-16"><span className={"mr10"}>教师</span> <span className={"mr10"}>{coursedata.teacher_count}</span></span>
</Breadcrumb.Item>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")} className={"pointer"}>
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"":

@ -48,8 +48,8 @@ class Addcourses extends Component{
}
componentDidUpdate = (prevProps) => {
console.log(prevProps);
console.log(this.props);
// console.log(prevProps);
// console.log(this.props);
if(prevProps.occupation!==this.props.occupation){
this.setState({
Addcoursestype:false,
@ -222,8 +222,8 @@ class Addcourses extends Component{
student:student
}
).then((response) => {
console.log("submittojoinclass");
console.log(response);
// console.log("submittojoinclass");
// console.log(response);
if(response === undefined){
this.setState({
// Addcoursestype:false,
@ -302,7 +302,7 @@ class Addcourses extends Component{
isSpin:false
});
}).catch((error) => {
console.log(error)
console.log(error);
this.setState({
Addcoursestype:false,
isSpin:false
@ -326,8 +326,8 @@ class Addcourses extends Component{
Addcoursestypes
}=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
console.log("Addcourses");
console.log(Addcoursestypes)
// console.log("Addcourses");
// console.log(Addcoursestypes)
return(
<div>
<Modals

@ -34,7 +34,7 @@ const { TextArea } = Input;
const confirm = Modal.confirm;
const $ = window.$
const { Option } = Select;
const TITLE_MAX_LENGTH = 60;
class ExerciceNew extends Component{
constructor(props){
super(props);
@ -418,7 +418,8 @@ class ExerciceNew extends Component{
<p className="clearfix mt20 mb20">
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}试卷</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
onClick={() => this.props.history.length == 1 ? this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`): this.props.history.goBack()}>
// () => this.props.history.length == 1 ? : this.props.history.goBack()
onClick={() => this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`)}>
返回
</a>
</p>
@ -449,7 +450,9 @@ class ExerciceNew extends Component{
max: 20, message: '最大限制为20个字符',
}],
})( */}
<Input placeholder="请输入试卷标题最大限制60个字符" maxLength="60" className="input-100-40 mt5" value={exercise_name} onChange={this.exercise_name_change}/>
<Input placeholder={`请输入试卷标题,最大限制${TITLE_MAX_LENGTH}个字符`} maxLength={TITLE_MAX_LENGTH} className="input-100-40 mt5" value={exercise_name}
onChange={this.exercise_name_change} suffix={`${exercise_name ? exercise_name.length : 0}/${TITLE_MAX_LENGTH}`}
/>
{/* )} */}
</Form.Item>

@ -479,6 +479,12 @@ class ExerciseReviewAndAnswer extends Component{
})
}
// 返回
returnBtn = () =>{
let coursesId=this.props.match.params.coursesId;
let eId=this.props.match.params.Id;
this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`)
}
render(){
let coursesId=this.props.match.params.coursesId;
@ -561,7 +567,7 @@ class ExerciseReviewAndAnswer extends Component{
</span>
{
(isAdmin || ( isStudent && exercise && user_exercise_status == 1)) ?
<WordsBtn className="fr font-16 lineh-40" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
<WordsBtn className="fr font-16 lineh-40" style="grey" onClick={this.returnBtn}>返回</WordsBtn>
:
time && time != 0 ?
<div className="fr remainingTime">

@ -316,7 +316,7 @@ class shixunAnswer extends Component{
</span>
<span className="fl mt3 font-16">
<span className="font-bd mr15">{item[0].position}</span>
<Link to={"/shixuns/"+item[0].game_identifier+"/challenges"}>
<Link to={ "/tasks/" + item[0].game_identifier } style={{"cursor":"pointer"}}>
<span className={"font-16"}>{item[0].name}</span>
</Link>
</span>

@ -149,7 +149,7 @@ class Eduinforms extends Component{
</div>
:
<div className="edu-back-white ">
<div id="MakedownHTML" className={"markdown-body fonttext yslmtopcg"} dangerouslySetInnerHTML={{__html: markdownToHTML(description).replace(/▁/g, "▁▁▁")}}>
<div id="MakedownHTML" className={"markdown-body fonttext yslmtopcg yslminHeigth"} style={{minHeight:"400px"}} dangerouslySetInnerHTML={{__html: markdownToHTML(description).replace(/▁/g, "▁▁▁")}}>
</div>

@ -379,7 +379,7 @@ class GraduationTasksedit extends Component{
<Form.Item label="任务标题" >
{getFieldDecorator('name', {
rules: [{ required: true, message: "请输入标题" }],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={name} onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength="60" addonAfter={String(title_num)}/>)}
})(<Input placeholder="请输入任务名称最大限制60个字符" value={name} onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength="60" suffix={String(title_num)}/>)}
</Form.Item>
<input type="hidden" id='nametypes' />
</div>

@ -384,7 +384,7 @@ class GraduationTasksnew extends Component {
rules: [{required: true, message: "不能为空"}],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={title_value} onInput={this.changeTitle}
className="searchView searchViewAfter h40" style={{"width": "100%"}} maxLength="60"
addonAfter={String(title_num)}/>)}
suffix={String(title_num)}/>)}
</Form.Item>
<input type="hidden" id='nametypes' />
</div>

@ -114,7 +114,7 @@ class GraduateTopicDetail extends Component{
<p className="clearfix mb20 lineh-25">
<span className="color-grey-3 font-24 fl task-hide" style={{lineHeight:"25px",maxWidth:"900px"}}>{tableData && tableData.graduation_topic_name}</span>
<span className="fl mt1" style={{height:"25px"}}><CoursesListType typelist={[`${tableData && tableData.status_name}`]} typesylename={""} /></span>
<WordsBtn className="fr font-16 mt1" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
<WordsBtn className="fr font-16 mt1" style="grey" to={`/courses/${tableData.course_id}/graduation_topics/${tableData.graduation_id}`}>返回</WordsBtn>
</p>
<div>
<div className="clearfix edu-back-white bor-bottom-greyE" >

@ -12,6 +12,8 @@ import "../../common/formCommon.css"
import '../style.css'
import '../../css/Courses.css'
import { WordsBtn, City } from 'educoder'
import {Link} from 'react-router-dom'
// import City from './City'
// import './board.css'
@ -20,6 +22,7 @@ import { WordsBtn, City } from 'educoder'
const confirm = Modal.confirm;
const $ = window.$
const { Option } = Select;
const NAME_COUNT=60;
// 新建毕设选题
// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c
class GraduateTopicNew extends Component{
@ -38,7 +41,7 @@ class GraduateTopicNew extends Component{
topic_source:[],
topic_type:[],
attachments:undefined,
addonAfter:60,
addonAfter:0,
left_banner_id:undefined,
course_name:undefined
}
@ -99,7 +102,7 @@ class GraduateTopicNew extends Component{
topic_source:result.data.topic_source,
topic_type:result.data.topic_type,
attachments:result.data.attachments,
addonAfter:20-parseInt(result.data.selected_data.name.length)
addonAfter:parseInt(result.data.selected_data.name.length)
})
this.props.form.setFieldsValue({
tea_id:result.data.selected_data.tea_id,
@ -257,9 +260,9 @@ class GraduateTopicNew extends Component{
// 附件相关 ------------ END
changeTopicName=(e)=>{
let num= 60 - parseInt(e.target.value.length);
// let num= 60 - parseInt(e.target.value.length);
this.setState({
addonAfter:num < 0 ? 0 : num
addonAfter:e.target.value.length
})
}
render() {
@ -331,7 +334,7 @@ class GraduateTopicNew extends Component{
</p>
<div className="clearfix mb20 lineh-25">
<p className="fl color-black summaryname">{topicId==undefined?"新建":"编辑"}毕设选题</p>
<a onClick={()=>this.props.history.goBack()} className="color-grey-6 fr font-16">返回</a>
<Link to={`/courses/${coursesId}/graduation_topics/${left_banner_id}`} className="color-grey-6 fr font-16">返回</Link>
</div>
<Form {...formItemLayout} onSubmit={this.handleSubmit}>
@ -366,7 +369,7 @@ class GraduateTopicNew extends Component{
max: 60, message: '最大限制为60个字符',
}],
})(
<Input placeholder="请输入帖子选题名称最大限制60个字符" maxLength="60" onInput={this.changeTopicName} autoComplete="off" addonAfter={String(addonAfter)} className="searchViewAfter" />
<Input placeholder="请输入帖子选题名称最大限制60个字符" maxLength="60" onInput={this.changeTopicName} autoComplete="off" suffix={`${String(addonAfter)}/${NAME_COUNT}`} className="searchViewAfter" />
)}
</Form.Item>
</div>

@ -136,7 +136,7 @@ class PollDetailIndex extends Component{
<span className="mt3 fl" style={{height:"25px"}}>
<CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} />
</span>
<WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
<WordsBtn className="fr font-16 mt2" style="grey" to={`/courses/${this.props.match.params.coursesId}/polls/${user_permission && user_permission.left_banner_id}`}>返回</WordsBtn>
</p>
<div>
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">

@ -327,7 +327,7 @@ class PollInfo extends Component{
<span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"30px"}}>{poll && poll.polls_name}</span>
<CoursesListType typelist={[`${statudmap[poll && poll.poll_status]}`]} typesylename={""} />
{
isAdmin || (poll && poll.user_poll_status == 1) ? <WordsBtn className="fr font-16 mt5" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn> :''
isAdmin || (poll && poll.user_poll_status == 1) ? <WordsBtn className="fr font-16 mt5" style="grey" to={`/courses/${coursesId}/polls/${this.props.match.params.pollId}/detail`}>返回</WordsBtn> :''
}
</p>

@ -1,6 +1,9 @@
import React, {Component} from "react";
import {Form, Input, Tooltip, Checkbox, Radio, Select, message, Modal, Button} from 'antd'
import {WordsBtn, ActionBtn} from 'educoder'
import {Link} from 'react-router-dom'
import '../css/members.css'
import "../common/formCommon.css"
@ -65,6 +68,8 @@ class PollNew extends Component {
cancellation: false,
bindingid:undefined,
Newdisplay:false,
first_category_url:"",
left_banner_id:"",
}
// console.log("试卷新建和编辑");
// console.log(JSON.stringify(props));
@ -72,6 +77,7 @@ class PollNew extends Component {
}
changeTopicName = (e) => {
console.log("调用了changeTopicName");
let num = 60 - parseInt(e.target.value.length);
this.setState({
addonAfter: num < 0 ? 0 : num
@ -124,8 +130,35 @@ class PollNew extends Component {
console.log("问卷返回");
console.log(this.props);
try {
if(this.props.current_user!==undefined){
this.setState({
first_category_url :this.props.current_user.first_category_url,
});
console.log("=======================");
console.log(this.props.current_user.first_category_url);
}
}catch (e) {
console.log("12312312312")
console.log(e);
}
};
componentDidUpdate = (prevProps) => {
// console.log("componentDidUpdate");
// console.log(prevProps);
// console.log(this.props);
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user!==undefined){
// console.log(this.props.current_user.login);
// console.log(prevProps.current_user.login);
this.setState({
first_category_url :this.props.current_user.first_category_url,
})
}
}
}
//获取权限
// getPollInfo(){
// // console.log(this.props.match);
@ -144,12 +177,12 @@ class PollNew extends Component {
// }
//初始化请求网络
Initializatio_data = () => {
// console.log("Initializatio_data 582")
console.log("Initializatio_data 582")
//课堂id
let coursesId = this.props.match.params.coursesId;
//时间id
let pollid = this.props.match.params.pollid;
// console.log(pollid);
console.log(pollid);
// let coursesId = 557;
if (pollid === undefined) {
// console.log("没有问卷新建问卷~~~")
@ -215,6 +248,19 @@ class PollNew extends Component {
polls_nametest: result.data.poll.polls_name,
polls_descriptiontest: result.data.poll.polls_description,
});
if(result.data){
if(result.data.poll){
if(result.data.poll.polls_name){
let num = 60 - parseInt(result.data.poll.polls_name.length);
this.setState({
addonAfter: num < 0 ? 0 : num
})
}
}
}
this.setState({
projects: result.data,
pollid: pollid,
@ -229,6 +275,7 @@ class PollNew extends Component {
polls_nametest: result.data.poll.polls_name,
polls_descriptiontest: result.data.poll.polls_description,
questionnair: true,
left_banner_id:result.data.left_banner_id
})
// console.log(this.state.polls_nametest)
// console.log(this.state.polls_descriptiontest)
@ -2338,10 +2385,13 @@ class PollNew extends Component {
}
gotohome=()=>{
// const { current_user} = this.props
if(this.state.first_category_url){
window.location.href=this.state.first_category_url;
}else{
this.props.history.goBack();
}
// this.props.history.push(current_user && current_user.first_category_url);
//
this.props.history.goBack()
// let courseId=this.props.match.params.coursesId;
// if(courseId===undefined){
// this.props.history.push("/courses");
@ -2360,6 +2410,7 @@ class PollNew extends Component {
readOnlys,
newoption,
cancellation,
left_banner_id
} = this.state
//获取老师权限
// console.log("[`${maps[polls_status && polls_status]}`]]");
@ -2404,16 +2455,29 @@ class PollNew extends Component {
<p className="clearfix mb20 mt10">
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className=" btn colorgrey fl hovercolorblue"
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
{
this.props.match.params.news === "new"?
<a className=" btn colorgrey fl hovercolorblue"
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
:
<a className=" btn colorgrey fl hovercolorblue"
href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}>问卷</a>
}
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>
</p>
<div className="clearfix mb30">
<p
className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>
<a onClick={()=>this.gotohome()}
className=" fr font-16">返回</a>
{
this.props.match.params.news === "new" ?
<a href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}
className=" fr font-16">返回</a>
:
<a href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}
className=" fr font-16">返回</a>
}
</div>
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
@ -2461,12 +2525,13 @@ class PollNew extends Component {
}
</div>
{/*suffix={String(addonAfter)}*/}
<Input placeholder="请输入问卷标题最大限制60个字符" maxLength="60"
style={{"margin-top": "15px", "text-align": "left"}}
onInput={this.changeTopicName}
readOnly={readOnlys}
autoComplete="off" addonAfter={String(addonAfter)}
autoComplete="off"
suffix={String(addonAfter)+"/60"}
value={this.state.polls_nametest}
className="searchViewAfter"></Input>
@ -2491,7 +2556,7 @@ class PollNew extends Component {
readOnly={readOnlys}
onInput={this.changeTopicNametwo}
value={this.state.polls_descriptiontest}
autoComplete="off" addonAfter={"100"}></TextArea>
autoComplete="off" suffix={"100"}></TextArea>
{
this.state.Newedit === true || this.state.mysave === true ?
<div>

@ -1019,8 +1019,8 @@ class ShixunHomework extends Component{
<div className="edu-back-white">
<p className="clearfix padding30 bor-bottom-greyE">
<p style={{height: '20px'}}>
{/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/}
<span className="font-18 fl color-dark-21">实训作业</span>
<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>
{/* <span className="font-18 fl color-dark-21">实训作业</span>*/}
<li className="fr">
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>

@ -393,7 +393,7 @@ class PathDetailIndex extends Component{
<div className="color-grey-6 clearfix">
<div id="shixuns_propaedeutics" className="new_li fl" style={{"padding":" 0px","textAlign": "justify;"}}>
{detailInfoList === undefined ? "" :detailInfoList.description===null?"":
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(detailInfoList.description).replace(/▁/g,"▁▁▁")}}></div>
<div className={"markdown-body font-14"} dangerouslySetInnerHTML={{__html: markdownToHTML(detailInfoList.description).replace(/▁/g,"▁▁▁")}}></div>
}
</div>
</div>
@ -420,8 +420,8 @@ class PathDetailIndex extends Component{
</p>
<div id="subject_learning_notes" className="color-grey-6 new_li markdown-body editormd-html-preview justify">
{detailInfoList === undefined ? "" :detailInfoList.learning_notes===null?"":
<textarea>{detailInfoList.learning_notes}</textarea>
}
<div className={"markdown-body font-14"} dangerouslySetInnerHTML={{__html: markdownToHTML(detailInfoList.learning_notes).replace(/▁/g,"▁▁▁")}}></div>
}
</div>
</div>
{tags === undefined ? "" :tags === null ? "":

@ -139,8 +139,8 @@ class ShixunPathSearch extends Component{
<div className="mt20 educontent mb20 clearfix">
{/*<a href="javascript:void(0)" className={ order == "publish_time" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("publish_time")}>全部</a>*/}
{/*<a href="javascript:void(0)" className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("mine")}>我的</a>*/}
<span className={ order == "updated_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("updated_at")}>最新</span>
<span className={ order == "myshixun_count" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("myshixun_count")}>最热</span>
<span className={ order == "updated_at" ? "fl mr20 font-16 bestChoose active pointer" : "fl mr20 font-16 bestChoose pointer"} onClick={ () => this.changeStatus("updated_at")}>最新</span>
<span className={ order == "myshixun_count" ? "fl mr20 font-16 bestChoose active pointer" : "fl mr20 font-16 bestChoose pointer"} onClick={ () => this.changeStatus("myshixun_count")}>最热</span>
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="请输入路径名称进行搜索"*/}

@ -77,7 +77,7 @@ function EditVideoModal (props) {
}],
})(
<Input placeholder="" className="titleInput" maxLength={MAX_LENGTH}
addonAfter={String(_title ? `${String(_title.length)}/${MAX_LENGTH}` : 0)} />
suffix={String(_title ? `${String(_title.length)}/${MAX_LENGTH}` : 0)} />
)}
</Form.Item>
</ModalWrapper>

@ -3743,4 +3743,12 @@ a.singlepublishtwo{
.square-main p{
margin-bottom: 0em;
}
.bestChoose{
cursor: pointer;
}
.pointer{
cursor: pointer;
}

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe CreateStudentWorkJob, type: :job do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe OldMessageDetail, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save