diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index 964951003..d337fbd73 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -35,9 +35,9 @@ namespace :excellent_course_exercise do members.each_with_index do |member, index| exercise_user = exercise.exercise_users.where(user_id: member.user_id).take if exercise_question_ids.length == 20 - rand_num = index < pass_count - 1 ? 20 : rand(1..16) + rand_num = index < pass_count - 1 ? rand(15..20) : rand(1..10) elsif exercise_question_ids.length == 17 - rand_num = index < pass_count - 1 ? rand(13..17) : rand(1..11) + rand_num = index < pass_count - 1 ? rand(12..17) : rand(1..9) elsif exercise_question_ids.length == 39 rand_num = index < pass_count - 1 ? rand(30..39) : rand(1..18) else diff --git a/lib/tasks/public_course.rake b/lib/tasks/public_course.rake index 13ef7b2e7..24fa3e844 100644 --- a/lib/tasks/public_course.rake +++ b/lib/tasks/public_course.rake @@ -48,27 +48,17 @@ namespace :public_course do end end - # - task :message => :environment do - discusses = Discuss.find_by_sql("select content, user_id, created_on, updated_on from discusses where dis_id in (select shixun_id from stage_shixuns where - stage_id in (select id from stages where subject_id=#{subject_id})) and created_at > #{start_time} and - created_at<#{end_time}") - discusses.find_each do |discuss| - puts discuss.user_id - puts discuss.content - # 回复帖子 - # 讨论区发布帖子 - # Message.create!(board: @message.board, root_id: @message.root_id || @message.id, - # author: current_user, parent: @message, - # message_detail_attributes: { - # content: params[:content] - # }) + task :test_user => :environment do + users = User.where(is_test: true) + users.find_each do |user| + puts user.id + CourseMember.create!(course_id: course_id, user_id: user.id, role: 4) end end # 更新某个课程的某类时间 - # 执行示例 bundle exec rake public_course:student args=2903,1 + # 执行示例 RAILS_ENV=production bundle exec rake public_course:time args=-1,2932,1,1 task :time => :environment do # course_id = ENV['args'].split(",")[0] # 对应课堂的id # type = ENV['args'].split(",")[1] @@ -78,10 +68,16 @@ namespace :public_course do case type.to_i when 1 # 讨论区 - + created_on = random_time start_time, end_time + puts created_on + messages = Message.where(board_id: course.boards) + messages.each do |message| + message.update_columns(created_on: created_on, updated_on: created_on) + MessageDetail.where(message_id: message.id).update_all(created_at: created_on, updated_at: created_on) + end when 2 # 作业 - course.homework_commons.each do |homework| + course.homework_commons.each do |homework| created_at = random_time(start_time, end_time) publish_time = random_larger_time created_at, start_time, end_time end_time = random_larger_time publish_time, start_time, end_time diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake new file mode 100644 index 000000000..7e2cd2c57 --- /dev/null +++ b/lib/tasks/user.rake @@ -0,0 +1,67 @@ +# add test user +namespace :sync do + task :add_user => :environment do + DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + user_count = ENV['args'].split(",")[0].to_i # 用户数 + rand_chart = ENV['args'].split(",")[1] # 手机号或者邮箱等前面的随机数 + + puts rand_chart + puts user_count + + (1..user_count).each do |i| + puts i + + no = sprintf("%04d", i) + phone = "#{rand_chart}160731#{no}" + mail = "#{rand_chart}#{no}@educoder.net" + code = generate_identifier User, 8 + login = "m" + code + + + l = "赵,钱,孙,李,周,吴,郑,王,冯,陈,褚,卫,蒋,沈,韩,杨,朱,秦,尤,许,何,吕,施,张,孔,曹,严,华,金,魏,陶,姜,黄".split(",") + f = "爱童,安妮,若婷,安煜,博,雷,梅,静,士红,大龙,冰波,慧娟,梅,婧婧,军,淋,真,维,涛,程程, + 谷南,慕儿,夏岚,友儿,小萱,紫青,妙菱,冬寒,曼柔,语蝶,青筠,夜安,觅海,问安,晓槐,雅山,访云,翠容,寒凡,晓绿,以菱, + 冬云,含玉,访枫,含卉,夜白,冷安,灵竹,醉薇,元珊,幻波,盼夏,元瑶,迎曼,水云,访琴,谷波,乐之,笑白,之山,妙海,紫霜, + 平夏,凌旋,孤丝,怜寒,向萍,凡松,青丝,翠安,如天,凌雪,绮菱,代云,南莲,寻南,春文,香薇,冬灵,凌珍,采绿,天春,沛文, + 紫槐,幻柏,采文,春梅,雪旋,盼海,映梦,安雁,映容,凝阳,访风,天亦,平绿,盼香,觅风,小霜,雪萍,半雪,山柳,谷雪,靖易, + 白薇,梦菡,飞绿,如波,又晴,友易,香菱,冬亦,问,妙春,海冬,半安,平春,幼柏,秋灵,凝芙,念烟,白山,从灵,尔芙,迎蓉, + 念寒,翠绿,翠芙,靖儿,妙柏,千凝,小珍,天巧,妙旋,雪枫,夏菡,元绿,痴灵,绮琴,雨双,听枫,觅荷,凡之,晓凡,雅彤,香薇, + 孤风,从安,绮彤,之玉,雨珍,幻丝,代梅,香波,青亦,元菱,海瑶,飞槐,听露,梦岚,幻竹,新冬,盼翠,谷云".split(",") + + lastname = l[rand(l.length)].strip + f[rand(f.length)].strip + + edit_params = { + login: login, + admin: false, + type: User, + phone: phone, + lastname: lastname, + mail: mail, + authentication: 1, + professional_certification: 1, + profile_completed: true, + is_test: true + } + user = User.create!(edit_params) + puts "aa" + UserExtension.create!(user_id: user.id, school_id: 117) + puts i + end + end + + # 随机生成字符 + def generate_identifier(container, num) + code = DCODES.sample(num).join + if container == User + while container.exists?(login: code) do + code = DCODES.sample(num).join + end + else + while container.exists?(identifier: code) do + code = DCODES.sample(num).join + end + end + code + end + +end \ No newline at end of file diff --git a/public/react/src/App.css b/public/react/src/App.css index cb36f7d63..a6f1d45e7 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -73,4 +73,13 @@ html, body { } .formItemInline .ant-form-item-control-wrapper { flex: 1; +} + + +/* 兼容性 */ +/* 火狐有滚动条时高度问题 */ +@-moz-document url-prefix() { + .newContainers { + min-height: calc(100% - 60px) !important; + } } \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/video/VideoUpload.js b/public/react/src/modules/user/usersInfo/video/VideoUpload.js index ec63454f9..26036529a 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUpload.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUpload.js @@ -37,7 +37,7 @@ function VideoUpload (props) { -
+
标题: {String(title.length)}/{MAX_LENGTH} diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index bcfb0deb2..8ad7ea9c2 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -61,7 +61,14 @@ function VideoUploadList (props) { // alert("请先选择需要上传的文件!") return } - if (file.type && file.type.indexOf('ogm') != -1) { + // avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm + if (file.name + && file.name.indexOf('.avi') == -1 && file.name.indexOf('.flv') == -1 + && file.name.indexOf('.f4v') == -1 && file.name.indexOf('.m4v') == -1 + && file.name.indexOf('.mov') == -1 && file.name.indexOf('.mp4') == -1 + && file.name.indexOf('.rmvb') == -1 && file.name.indexOf('.swf') == -1 + && file.name.indexOf('.webm') == -1 + ) { showNotification(`不支持的视频格式`) return; }