-
+
开放课堂:所有用户可以随时访问
-
+
私有课堂:仅报名参与的课堂成员可以访问
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index 2d6bedf18..af3e228cd 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('')
- .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?6`));
+ .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?8`));
$('head').append($('')
- .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?6`));
+ .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?8`));
// index.html有加载
$('head').append($('')
- .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?6`));
+ .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?8`));
// $('head').append($('')
From a8abdfbd23b40d6a0a315c0e74faeffbc9cdf6f9 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 20 Aug 2019 09:09:30 +0800
Subject: [PATCH 09/18] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E7=99=BB?=
=?UTF-8?q?=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/subjects_controller.rb | 13 +------------
app/views/subjects/show.json.jbuilder | 22 ----------------------
2 files changed, 1 insertion(+), 34 deletions(-)
diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb
index 55f8722a2..ac5bd027f 100644
--- a/app/controllers/subjects_controller.rb
+++ b/app/controllers/subjects_controller.rb
@@ -1,5 +1,5 @@
class SubjectsController < ApplicationController
- before_action :require_login, :check_auth, except: [:index, :show]
+ before_action :require_login, :check_auth, except: [:index, :show, :right_banner]
# before_action :check_auth, except: [:index]
before_action :check_account, except: [:index, :show]
before_action :find_subject, except: [:index, :create, :new, :append_to_stage]
@@ -85,17 +85,6 @@ class SubjectsController < ApplicationController
# 合作团队
@shixuns = @subject.shixuns.published.pluck(:id)
@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
diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder
index ec76b5a2d..53e76a96f 100644
--- a/app/views/subjects/show.json.jbuilder
+++ b/app/views/subjects/show.json.jbuilder
@@ -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
\ No newline at end of file
From f461ffe1ed063ac8c7a419e8d26519d86bc4f5ef Mon Sep 17 00:00:00 2001
From: jingquan huang
Date: Tue, 20 Aug 2019 09:32:03 +0800
Subject: [PATCH 10/18] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=87=AA=E5=8A=A8?=
=?UTF-8?q?=E6=B3=A8=E5=86=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/public_course.rake | 12 ++---
lib/tasks/user.rake | 86 ++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 6 deletions(-)
create mode 100644 lib/tasks/user.rake
diff --git a/lib/tasks/public_course.rake b/lib/tasks/public_course.rake
index 0f10b84ad..6a16fcd3b 100644
--- a/lib/tasks/public_course.rake
+++ b/lib/tasks/public_course.rake
@@ -58,7 +58,7 @@ namespace :public_course do
# 更新某个课程的某类时间
- # 执行示例 bundle exec rake public_course:time args=-1,2932,1,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]
@@ -70,13 +70,13 @@ namespace :public_course do
# 讨论区
created_on = random_time start_time, end_time
messages = Message.where(board_id: course.boards)
- message_details = MessageDetail.where(message_id: messages)
- messages.update_columns(created_on: created_on, updated_on: created_on)
- message_details.update_columns(created_at: created_on, updated_at: created_on)
-
+ 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..8cd1d90ae
--- /dev/null
+++ b/lib/tasks/user.rake
@@ -0,0 +1,86 @@
+# 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.create!(edit_params)
+ puts "aa"
+ UserExtension.create!(user_id: @user.id, school_id: 117)
+ puts i
+ end
+
+
+ user = User.new(admin: false, login: login, mail: email, phone: phone, type: "User")
+ user.password = "edu12345678"
+ # 现在因为是验证码,所以在注册的时候就可以激活
+ user.status = 1
+ # 必须要用save操作,密码的保存是在users中
+ if user.save!
+ # todo user_extension
+ UserExtension.create!(user_id: @user.id)
+
+ # 注册时,记录是否是引流用户
+ ip = request.remote_ip
+ ua = UserAgent.find_by_ip(ip)
+ ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua
+ successful_authentication(@user)
+ session[:user_id] = @user.id
+ normal_status("注册成功")
+ 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
From bb1e7616b953d907963dec8a4174862564b83ff4 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 20 Aug 2019 09:35:14 +0800
Subject: [PATCH 11/18] =?UTF-8?q?=E9=87=91=E8=AF=BE=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/subjects_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb
index ac5bd027f..5389ff961 100644
--- a/app/controllers/subjects_controller.rb
+++ b/app/controllers/subjects_controller.rb
@@ -1,7 +1,7 @@
class SubjectsController < ApplicationController
before_action :require_login, :check_auth, except: [:index, :show, :right_banner]
# before_action :check_auth, except: [:index]
- before_action :check_account, except: [:index, :show]
+ before_action :check_account, except: [:index, :show, :right_banner]
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,
From ee2547d0151bc185e774b2df3786db829097ba2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 20 Aug 2019 09:37:46 +0800
Subject: [PATCH 12/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/paths/PathDetail/PathDetailIndex.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js
index 0e4a581a3..d64763980 100644
--- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js
+++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js
@@ -476,7 +476,7 @@ class PathDetailIndex extends Component{
}
{
- this.props.checkIfLogin()===false?"123213":progress === undefined ? "" : progress === null ? "" :
+ this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" :