From 814aa13c21518c8c463761e09e8c993364ed1c98 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 30 Jul 2019 14:05:26 +0800
Subject: [PATCH 01/56] =?UTF-8?q?Mp3=E3=80=81mp4=E7=B1=BB=E5=AE=9E?=
=?UTF-8?q?=E8=AE=AD=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 2 +-
app/controllers/myshixuns_controller.rb | 2 +-
app/helpers/games_helper.rb | 8 +++++++-
app/models/challenge.rb | 1 +
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index b2de6dcad..667d45f2b 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -116,7 +116,7 @@ class GamesController < ApplicationController
@qrcode_str = Base64.encode64( qr.to_img.resize(400,400).to_s )
else
- @type = "image"
+ @type = ""
#conv = Iconv.new("GBK", "utf-8")
@game_challenge = @game.challenge
type = @game_challenge.show_type
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index fa47fd7f6..1d6b15969 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -24,7 +24,7 @@ class MyshixunsController < ApplicationController
ActiveRecord::Base.transaction do
begin
@shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id)
- @myshixun.destroy
+ @myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
diff --git a/app/helpers/games_helper.rb b/app/helpers/games_helper.rb
index aff05904f..dfc3fb321 100644
--- a/app/helpers/games_helper.rb
+++ b/app/helpers/games_helper.rb
@@ -6,7 +6,7 @@ module GamesHelper
end
# 获取目录下所有文件,返回一个文件名的数组 type是查看文件的类型image表示图片
- # type [[1, "图片"], [2, "apk/exe"], [3, "txt"], [4, "html"]]
+ # type [[1, "图片"], [2, "apk/exe"], [3, "txt"], [4, "html"], [5, "mp3"], [6, "mp4"]]
def get_dir_filename(path, type, game_id)
answer_picture = []
return answer_picture unless File.directory?(path)
@@ -39,6 +39,12 @@ module GamesHelper
end
f.close
@type = 'txt'
+ elsif extension == 'mp3' && type == 5
+ answer_picture << file
+ @type = 'mp3'
+ elsif extension == 'mp4' && type == 6
+ answer_picture << file
+ @type = 'mp4'
end
end
diff --git a/app/models/challenge.rb b/app/models/challenge.rb
index 0bea54eb4..8e4d2ae42 100644
--- a/app/models/challenge.rb
+++ b/app/models/challenge.rb
@@ -1,5 +1,6 @@
class Challenge < ApplicationRecord
# difficulty: 关卡难度: 1.简单 2.中等 3.困难
+ # show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4
default_scope { order("challenges.position asc") }
belongs_to :shixun, :touch => true, counter_cache: true
From 1b41c1c00b20debd7d98bfb0004257a6fe6e0909 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, 30 Jul 2019 14:46:17 +0800
Subject: [PATCH 02/56] b
---
.../projectPackages/PackageIndex/PackageConcent.js | 1 +
.../PackageIndexNEITaskDetails.js | 2 +-
.../PackageIndexNEIBannerConcent.js | 14 +++++++-------
public/react/src/modules/tpm/NewHeader.js | 3 ++-
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
index 7875c5c46..cfc54bb98 100644
--- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
@@ -14,6 +14,7 @@ let categorylist=[
{name:"数据库",value:"database"},
{name:"云计算和大数据",value:"cloud_compute_and_big_data"},
{name:"人工智能",value:"ai"},
+ {name:"运维与测试",value:"devops_and_test"},
{name:"其他",value:"other"},
]
//
diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
index c9fdebc05..4788a7dc1 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
@@ -252,7 +252,7 @@ class PackageIndexNEITaskDetails extends Component {
'} className={"fl"}>
{/*{this.props.current_user.username}*/}
- 众包创新
+ 众包创新
{data&&data.title}
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 335f9d27e..c9d49e542 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -407,7 +407,7 @@ class PackageIndexNEIBannerConcent extends Component {
// }
- if(modalCancel===true||this.props.current_user.phone===null){
+ if(this.props.current_user&&this.props.current_user.phone===null||modalCancel===true){
if(contact_phone===undefined||contact_phone===null||contact_phone===""){
this.setState({
contact_phonetype:true
@@ -445,7 +445,7 @@ class PackageIndexNEIBannerConcent extends Component {
min_price:parseInt(min_price),
max_price:parseInt(max_price),
contact_name: contact_name===null||contact_name===undefined?this.props.current_user.username:contact_name,
- contact_phone: contact_phone===undefined?this.props.current_user.phone:contact_phone,
+ contact_phone: contact_phone===undefined?this.props.current_user&&this.props.current_user.phone:contact_phone,
code:code,
publish:types
}
@@ -493,7 +493,7 @@ class PackageIndexNEIBannerConcent extends Component {
min_price:parseInt(min_price),
max_price:parseInt(max_price),
contact_name: contact_name===null||contact_name===undefined?this.props.current_user.username:contact_name,
- contact_phone: contact_phone===undefined?this.props.current_user.phone:contact_phone,
+ contact_phone: contact_phone===undefined?this.props.current_user&&this.props.current_user.phone:contact_phone,
code:code,
publish:types
}
@@ -629,7 +629,7 @@ class PackageIndexNEIBannerConcent extends Component {
// })
// }
// }
- if(modalCancel===true||this.props.current_user.phone===null){
+ if(this.props.current_user&&this.props.current_user.phone===null||modalCancel===true){
if(e.target.value===undefined||e.target.value===null||e.target.value===""){
this.setState({
contact_phonetype:true
@@ -847,12 +847,12 @@ class PackageIndexNEIBannerConcent extends Component {
{this.state.contact_nametype===true?不能为空
:""}
- {modalCancel===false&&this.props.current_user.phone!=null?
+ {this.props.current_user&&this.props.current_user.phone!=null&&modalCancel===false?
手机号:
@@ -861,7 +861,7 @@ class PackageIndexNEIBannerConcent extends Component {
:""}
{/*{this.state.current_userphonetype===true?不能为空
:""}*/}
- {modalCancel===true||this.props.current_user.phone===null?
+ {this.props.current_user&&this.props.current_user.phone===null||modalCancel===true?
{/*未注册才显示!*/}
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index 23330e779..1798bfca8 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -718,7 +718,7 @@ submittojoinclass=(value)=>{
教学案例
众包创新
交流问答
{
我的实训
我的实践课程
我的项目
+ 我的众包
账号管理
{/*this.educoderlogin()} >登入测试接口*/}
{/*this.trialapplications()} >试用申请 */}
From 263a809e78f941bbb091b314d432ea42621ff108 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Tue, 30 Jul 2019 14:52:59 +0800
Subject: [PATCH 03/56] fix create project package api bug
---
app/services/project_packages/save_service.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/services/project_packages/save_service.rb b/app/services/project_packages/save_service.rb
index bcfc19a10..caf4cf6c7 100644
--- a/app/services/project_packages/save_service.rb
+++ b/app/services/project_packages/save_service.rb
@@ -15,7 +15,7 @@ class ProjectPackages::SaveService < ApplicationService
is_create = package.new_record?
raise Error, '类型不存在' unless ProjectPackageCategory.where(id: params[:category_id]).exists?
- params[:project_package_category_id] = params[:category_id].to_i
+ params[:project_package_category_id] = params.delete(:category_id).to_i
raise Error, '竞标截止时间不能小于当前时间' if params[:deadline_at].present? && params[:deadline_at].to_time < Time.now
From c90358cdfaa96f47674c751823430288e2a17124 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Tue, 30 Jul 2019 14:57:25 +0800
Subject: [PATCH 04/56] private message feature apis
---
app/controllers/concerns/paginate_helper.rb | 2 +-
app/controllers/users/base_controller.rb | 17 +++++++-
.../private_message_details_controller.rb | 23 +++++++++++
.../users/private_messages_controller.rb | 39 +++++++++++++++++++
.../users/recent_contacts_controller.rb | 8 ++++
.../users/unread_message_infos_controller.rb | 12 ++++++
.../users_for_private_messages_controller.rb | 17 ++++++++
app/decorators/private_message_decorator.rb | 9 +++++
app/models/private_message.rb | 6 +++
app/models/user.rb | 3 +-
.../private_messages/create_service.rb | 35 +++++++++++++++++
.../show.json.jbuilder | 11 ++++++
.../private_messages/create.json.jbuilder | 10 +++++
.../private_messages/index.json.jbuilder | 13 +++++++
.../users/recent_contacts/index.json.jbuilder | 2 +
.../index.json.jbuilder | 2 +
config/routes.rb | 6 +++
17 files changed, 211 insertions(+), 4 deletions(-)
create mode 100644 app/controllers/users/private_message_details_controller.rb
create mode 100644 app/controllers/users/private_messages_controller.rb
create mode 100644 app/controllers/users/recent_contacts_controller.rb
create mode 100644 app/controllers/users/unread_message_infos_controller.rb
create mode 100644 app/controllers/users_for_private_messages_controller.rb
create mode 100644 app/decorators/private_message_decorator.rb
create mode 100644 app/services/private_messages/create_service.rb
create mode 100644 app/views/users/private_message_details/show.json.jbuilder
create mode 100644 app/views/users/private_messages/create.json.jbuilder
create mode 100644 app/views/users/private_messages/index.json.jbuilder
create mode 100644 app/views/users/recent_contacts/index.json.jbuilder
create mode 100644 app/views/users_for_private_messages/index.json.jbuilder
diff --git a/app/controllers/concerns/paginate_helper.rb b/app/controllers/concerns/paginate_helper.rb
index 34740eb5d..bbe84a348 100644
--- a/app/controllers/concerns/paginate_helper.rb
+++ b/app/controllers/concerns/paginate_helper.rb
@@ -1,7 +1,7 @@
module PaginateHelper
def paginate(objs, **opts)
page = params[:page].to_i <= 0 ? 1 : params[:page].to_i
- per_page = params[:per_page].to_i > 0 ? params[:per_page].to_i : opts[:per_page] || 20
+ per_page = params[:per_page].to_i > 0 && params[:per_page].to_i < 50 ? params[:per_page].to_i : opts[:per_page] || 20
Kaminari.paginate_array(objs).page(page).per(per_page)
end
diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb
index afc03ee13..fd138a182 100644
--- a/app/controllers/users/base_controller.rb
+++ b/app/controllers/users/base_controller.rb
@@ -26,9 +26,22 @@ class Users::BaseController < ApplicationController
render_forbidden
end
+ def page_value
+ params[:page].to_i <= 0 ? 1 : params[:page].to_i
+ end
+
+ def per_page_value
+ params[:per_page].to_i > 0 && params[:per_page].to_i < 50 ? params[:per_page].to_i : 20
+ end
+ alias_method :limit_value, :per_page_value
+
+ def offset_value
+ (page_value - 1) * limit_value
+ end
+
def paginate(objs, **opts)
- page = params[:page].to_i <= 0 ? 1 : params[:page].to_i
- per_page = params[:per_page].to_i > 0 ? params[:per_page].to_i : 20
+ page = page_value
+ per_page = per_page_value
return Kaminari.paginate_array(objs).page(page).per(per_page) unless observed_logged_user? && opts[:special]
diff --git a/app/controllers/users/private_message_details_controller.rb b/app/controllers/users/private_message_details_controller.rb
new file mode 100644
index 000000000..486d23d7f
--- /dev/null
+++ b/app/controllers/users/private_message_details_controller.rb
@@ -0,0 +1,23 @@
+class Users::PrivateMessageDetailsController < Users::BaseController
+ before_action :private_user_resources!
+
+ after_action :update_message_status, only: [:show]
+
+ def show
+ messages = observed_user.private_messages.without_deleted.where(target: target_user)
+
+ @count = messages.count
+ @messages = messages.order(send_time: :asc).includes(sender: :user_extension)
+ end
+
+ private
+
+ def target_user
+ @_target_user ||= User.find(params[:target_id])
+ end
+
+ # 置为已读
+ def update_message_status
+ observed_user.private_messages.only_unread.where(target: target_user).update_all(status: 1)
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/users/private_messages_controller.rb b/app/controllers/users/private_messages_controller.rb
new file mode 100644
index 000000000..b80b6152b
--- /dev/null
+++ b/app/controllers/users/private_messages_controller.rb
@@ -0,0 +1,39 @@
+class Users::PrivateMessagesController < Users::BaseController
+ before_action :private_user_resources!
+ after_action :update_onclick_time!, only: [:index]
+
+ def index
+ @count = observed_user.private_messages.without_deleted.group(:target_id).count.count
+
+ subquery = observed_user.private_messages.without_deleted.order(send_time: :desc).to_sql
+ query = "SELECT subquery.*, COUNT(*) message_count FROM (#{subquery}) subquery "\
+ "GROUP BY subquery.target_id ORDER BY subquery.send_time desc LIMIT #{limit_value} OFFSET #{offset_value}"
+ @messages = PrivateMessage.select('*').from("(#{query}) AS query").includes(target: :user_extension)
+ end
+
+ def create
+ receiver = User.find_by(id: params[:target_id])
+ return render_error('用户未找到') if receiver.blank?
+
+ @message = PrivateMessages::CreateService.call(observed_user, receiver, create_params)
+ rescue PrivateMessages::CreateService::Error => ex
+ render_error(ex.message)
+ end
+
+ def destroy
+ message = observed_user.private_messages.without_deleted.find(params[:id])
+ message.destroy!
+
+ render_ok
+ end
+
+ private
+
+ def update_onclick_time!
+ current_user.onclick_time.touch(:onclick_time)
+ end
+
+ def create_params
+ params.permit(:content)
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/users/recent_contacts_controller.rb b/app/controllers/users/recent_contacts_controller.rb
new file mode 100644
index 000000000..bc4b8ea8f
--- /dev/null
+++ b/app/controllers/users/recent_contacts_controller.rb
@@ -0,0 +1,8 @@
+class Users::RecentContactsController < Users::BaseController
+ before_action :private_user_resources!
+
+ def index
+ contacts = observed_user.recent_contacts.distinct
+ @contacts = contacts.order('private_messages.created_at DESC').limit(10).includes(:user_extension)
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/users/unread_message_infos_controller.rb b/app/controllers/users/unread_message_infos_controller.rb
new file mode 100644
index 000000000..7abd36304
--- /dev/null
+++ b/app/controllers/users/unread_message_infos_controller.rb
@@ -0,0 +1,12 @@
+class Users::UnreadMessageInfosController < Users::BaseController
+ before_action :private_user_resources!
+
+ def show
+ click_time = observed_user.click_time
+
+ unread_tiding_count = observed_user.tidings.where('created_at > ?', click_time).count
+ unread_message_count = observed_user.private_messages.only_unread.group(:target_id).count.count
+
+ render_ok(unread_tiding_count: unread_tiding_count, unread_message_count: unread_message_count)
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/users_for_private_messages_controller.rb b/app/controllers/users_for_private_messages_controller.rb
new file mode 100644
index 000000000..bbd5682a1
--- /dev/null
+++ b/app/controllers/users_for_private_messages_controller.rb
@@ -0,0 +1,17 @@
+class UsersForPrivateMessagesController < ApplicationController
+ before_action :require_login, :check_auth
+
+ def index
+ users = User.active.where.not(id: current_user.id)
+
+ keyword = params[:keyword].to_s.strip
+ if keyword.blank?
+ @users = []
+ return
+ end
+
+ users = users.where('LOWER(concat(lastname, firstname, nickname)) LIKE ?', "%#{keyword}%")
+
+ @users = users.limit(10).includes(:user_extension)
+ end
+end
\ No newline at end of file
diff --git a/app/decorators/private_message_decorator.rb b/app/decorators/private_message_decorator.rb
new file mode 100644
index 000000000..6db17acf3
--- /dev/null
+++ b/app/decorators/private_message_decorator.rb
@@ -0,0 +1,9 @@
+module PrivateMessageDecorator
+ extend ApplicationDecorator
+
+ display_time_method :send_time
+
+ def unread?
+ status.zero?
+ end
+end
\ No newline at end of file
diff --git a/app/models/private_message.rb b/app/models/private_message.rb
index 1db4c9f66..640e48db7 100644
--- a/app/models/private_message.rb
+++ b/app/models/private_message.rb
@@ -1,3 +1,9 @@
class PrivateMessage < ApplicationRecord
belongs_to :user
+ belongs_to :target, class_name: "User"
+ belongs_to :sender, class_name: "User"
+ belongs_to :receiver, class_name: "User"
+
+ scope :without_deleted, -> { where.not(status: 2) }
+ scope :only_unread, -> { where(status: 0) }
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 14d7b2697..ed9d70c00 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -54,7 +54,8 @@ class User < ApplicationRecord
has_one :onclick_time, :dependent => :destroy
# 新版私信
- has_many :private_messages, :dependent => :destroy
+ has_many :private_messages, dependent: :destroy
+ has_many :recent_contacts, through: :private_messages, source: :target
has_many :tidings, :dependent => :destroy
has_many :games, :dependent => :destroy
diff --git a/app/services/private_messages/create_service.rb b/app/services/private_messages/create_service.rb
new file mode 100644
index 000000000..560f1a540
--- /dev/null
+++ b/app/services/private_messages/create_service.rb
@@ -0,0 +1,35 @@
+class PrivateMessages::CreateService < ApplicationService
+ Error = Class.new(StandardError)
+
+ attr_reader :sender, :receiver, :params
+
+ def initialize(sender, receiver, **params)
+ @sender = sender
+ @receiver = receiver
+ @params = params
+ end
+
+ def call
+ validate!
+
+ same_attr = { sender: sender, receiver: receiver, content: content, send_time: Time.now }
+
+ message = nil
+ ActiveRecord::Base.transaction do
+ message = sender.private_messages.create!(same_attr.merge(target: receiver, status: 1))
+ receiver.private_messages.create!(same_attr.merge(target: sender, status: 0))
+ end
+ message
+ end
+
+ private
+
+ def content
+ @_content ||= params[:content].to_s.strip
+ end
+
+ def validate!
+ raise Error, '内容不能为空' if content.blank?
+ raise Error, '内容太长' if content.size > 255
+ end
+end
\ No newline at end of file
diff --git a/app/views/users/private_message_details/show.json.jbuilder b/app/views/users/private_message_details/show.json.jbuilder
new file mode 100644
index 000000000..065767fb4
--- /dev/null
+++ b/app/views/users/private_message_details/show.json.jbuilder
@@ -0,0 +1,11 @@
+json.count @count
+json.messages do
+ json.array! @messages.each do |message|
+ json.extract! message, :id, :user_id, :receiver_id, :sender_id, :content
+
+ json.send_time message.display_send_time
+ json.sender do
+ json.partial! 'users/user_simple', user: message.sender
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/views/users/private_messages/create.json.jbuilder b/app/views/users/private_messages/create.json.jbuilder
new file mode 100644
index 000000000..888cfeff6
--- /dev/null
+++ b/app/views/users/private_messages/create.json.jbuilder
@@ -0,0 +1,10 @@
+json.status 0
+json.message 'success'
+json.private_message do
+ json.extract! @message, :id, :user_id, :receiver_id, :sender_id, :content
+
+ json.send_time @message.display_send_time
+ json.sender do
+ json.partial! 'users/user_simple', user: @message.sender
+ end
+end
\ No newline at end of file
diff --git a/app/views/users/private_messages/index.json.jbuilder b/app/views/users/private_messages/index.json.jbuilder
new file mode 100644
index 000000000..c18a7d209
--- /dev/null
+++ b/app/views/users/private_messages/index.json.jbuilder
@@ -0,0 +1,13 @@
+json.count @count
+json.private_messages do
+ json.array! @messages.each do |message|
+ json.extract! message, :id, :content, :message_count
+
+ json.unread message.unread?
+ json.send_time message.display_send_time
+
+ json.target do
+ json.partial! 'users/user_simple', user: message.target
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/views/users/recent_contacts/index.json.jbuilder b/app/views/users/recent_contacts/index.json.jbuilder
new file mode 100644
index 000000000..f2f7f025a
--- /dev/null
+++ b/app/views/users/recent_contacts/index.json.jbuilder
@@ -0,0 +1,2 @@
+json.users @contacts, partial: 'users/user_simple', as: :user
+json.count @contacts.size
\ No newline at end of file
diff --git a/app/views/users_for_private_messages/index.json.jbuilder b/app/views/users_for_private_messages/index.json.jbuilder
new file mode 100644
index 000000000..be040e368
--- /dev/null
+++ b/app/views/users_for_private_messages/index.json.jbuilder
@@ -0,0 +1,2 @@
+json.users @users, partial: 'users/user_simple', as: :user
+json.count @users.size
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 6623edd99..2f9eed61b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -53,6 +53,11 @@ Rails.application.routes.draw do
resource :grade_records, only: [:show]
resource :watch, only: [:create, :destroy]
resources :project_packages, only: [:index]
+ # 私信
+ resources :private_messages, only: [:index, :create, :destroy]
+ resources :recent_contacts, only: [:index]
+ resource :private_message_details, only: [:show]
+ resource :unread_message_info, only: [:show]
end
@@ -91,6 +96,7 @@ Rails.application.routes.draw do
end
end
end
+ resources :users_for_private_messages, only: [:index]
resources :myshixuns, param: :identifier, shallow: true do
member do
From 1cb74baff7c2cc16a17e9055aa14f22f2de81205 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, 30 Jul 2019 15:01:05 +0800
Subject: [PATCH 05/56] b
---
.../PackageIndexNEIBannerConcent.js | 4 +-
public/react/src/modules/tpm/NewHeader.js | 2 +-
.../react/src/modules/user/usersInfo/Infos.js | 27 ++-
.../modules/user/usersInfo/InfosPackage.js | 197 ++++++++++++++++++
4 files changed, 225 insertions(+), 5 deletions(-)
create mode 100644 public/react/src/modules/user/usersInfo/InfosPackage.js
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index c9d49e542..e4926e02c 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -69,7 +69,7 @@ class PackageIndexNEIBannerConcent extends Component {
componentDidUpdate = (prevProps) => {
if(prevProps.current_user.username!=this.props.current_user.username){
this.setState({
- contact_name:this.props.current_user.username
+ contact_name:this.props.current_user&&this.props.current_user.username
})
}
}
@@ -100,7 +100,7 @@ class PackageIndexNEIBannerConcent extends Component {
})
}else{
this.setState({
- contact_name:this.props.current_user.username
+ contact_name:this.props.current_user&&this.props.current_user.username
})
}
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index 1798bfca8..79b0aa443 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -816,7 +816,7 @@ submittojoinclass=(value)=>{
我的实训
我的实践课程
我的项目
- 我的众包
+ 我的众包
账号管理
{/*this.educoderlogin()} >登入测试接口*/}
{/*this.trialapplications()} >试用申请 */}
diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js
index 3b58681da..5286c5797 100644
--- a/public/react/src/modules/user/usersInfo/Infos.js
+++ b/public/react/src/modules/user/usersInfo/Infos.js
@@ -17,6 +17,12 @@ import "../../courses/css/Courses.css"
import Trialapplication from '../../login/Trialapplication'
+
+const InfosPackage = Loadable({
+ loader: () => import('./InfosPackage'),
+ loading:Loading,
+})
+
const InfosCourse = Loadable({
loader: () => import('./InfosCourse'),
loading:Loading,
@@ -373,11 +379,17 @@ class Infos extends Component{
to={`/users/${username}/paths`}>实践课程
- this.setState({moduleName: 'projects'})}
to={`/users/${username}/projects`}>项目
-
+
+
+ this.setState({moduleName: 'package'})}
+ to={`/users/${username}/package`}>众包
+
+
{/*{ data && data.identity!="学生" && 题库}*/}
@@ -389,6 +401,15 @@ class Infos extends Component{
{/* --------------------------------------------------------------------- */}
+
+ {/* 众包 */}
+ {/* http://localhost:3007/courses/1309/homework/9300/setting */}
+ ()
+ }
+ >
+
{/* 课堂 */}
{/* http://localhost:3007/courses/1309/homework/9300/setting */}
()
}
>
+
+
()
diff --git a/public/react/src/modules/user/usersInfo/InfosPackage.js b/public/react/src/modules/user/usersInfo/InfosPackage.js
new file mode 100644
index 000000000..8222c951b
--- /dev/null
+++ b/public/react/src/modules/user/usersInfo/InfosPackage.js
@@ -0,0 +1,197 @@
+import React, { Component } from 'react';
+import { SnackbarHOC } from 'educoder';
+import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
+import {Tooltip,Menu,Pagination,Spin} from 'antd';
+import Loadable from 'react-loadable';
+import Loading from '../../../Loading';
+import axios from 'axios';
+import NoneData from '../../courses/coursesPublic/NoneData'
+import {getImageUrl} from 'educoder';
+import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
+import { CNotificationHOC } from '../../courses/common/CNotificationHOC'
+import "./usersInfo.css"
+import Create from './publicCreatNew'
+
+class InfosCourse extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ category:undefined,
+ status:undefined,
+ page:1,
+ per_page:16,
+
+ totalCount:undefined,
+ data:undefined,
+ isSpin:false
+ }
+ }
+
+ componentDidMount=()=>{
+ this.setState({
+ isSpin:true
+ })
+ let{category,status,page}=this.state;
+ this.getCourses(category,status,page);
+ }
+
+ getCourses=(category,status,page)=>{
+ let url=`/users/${this.props.match.params.username}/courses.json`;
+ axios.get((url),{params:{
+ category,
+ status,
+ page,
+ per_page: this.props.is_current && category && page ==1?17:16
+ }}).then((result)=>{
+ if(result){
+ this.setState({
+ totalCount:result.data.count,
+ data:result.data,
+ isSpin:false
+ })
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+
+ //切换种类
+ changeCategory=(cate)=>{
+ this.setState({
+ category:cate,
+ page:1,
+ isSpin:true
+ })
+ let{status}=this.state;
+ this.getCourses(cate,status,1);
+ }
+ //切换状态
+ changeStatus=(status)=>{
+ this.setState({
+ status:status,
+ page:1,
+ isSpin:true
+ })
+ let{category}=this.state;
+ this.getCourses(category,status,1);
+ }
+ //切换页数
+ changePage=(page)=>{
+ this.setState({
+ page,
+ isSpin:true
+ })
+ let{category,status}=this.state;
+ this.getCourses(category,status,page);
+ }
+
+ // 进入课堂
+ turnToCourses=(url,flag)=>{
+ if(flag){
+ this.props.history.push(url);
+ }
+ }
+
+ render(){
+ let{
+ category,
+ status,
+ page,
+ data,
+ totalCount,
+ isSpin
+ } = this.state;
+ let is_current=this.props.is_current;
+
+ console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
+ return(
+
+
+
+
+
+ 共{totalCount}个
+ 发布时间
+
+
+ {
+ page == 1 && is_current &&
+ this.props.current_user && this.props.current_user.user_identity != "学生" ?
: ""
+ }
+ {
+ (!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) &&
+ }
+ {
+ data && data.courses && data.courses.map((item,key)=>{
+ return(
+
this.turnToCourses(`${item.first_category_url}`,item.can_visited)} style={{"cursor": "pointer"}}>
+ {
+ item.is_public == 1 &&
+
+
+
+ 公开
+
+ }
+ {
+ item.can_visited ==false?
+
+
+
非成员不能访问
+
:""
+ }
+
+
+
+ {item.name}
+
+
+
{item.teacher && item.teacher.real_name}
+
{item.teacher && item.teacher.school_name}
+
+
+
+ {
+ item.members_count > 0 &&
+
+
+ {item.members_count}
+
+ }
+ {
+ item.homework_commons_count > 0 &&
+
+
+ {item.homework_commons_count}
+
+ }
+ {
+ item.attachments_count > 0 &&
+
+
+ {item.attachments_count}
+
+ }
+
+
+
+ )
+ })
+ }
+
+ {
+ totalCount > 15 &&
+
+ }
+
+
+ )
+ }
+}
+export default InfosCourse;
\ No newline at end of file
From d959a2ea9c7cd6a439584b296df21d2f7661747a Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 30 Jul 2019 15:07:30 +0800
Subject: [PATCH 06/56] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/assets/javascripts/forums.js | 2 ++
app/assets/javascripts/memos.js | 2 ++
app/assets/stylesheets/forums.scss | 3 +++
app/controllers/forums_controller.rb | 2 ++
app/helpers/export_helper.rb | 2 +-
app/helpers/forums_helper.rb | 2 ++
app/models/forum.rb | 2 ++
db/migrate/20190730070155_create_forums.rb | 8 ++++++++
spec/controllers/forums_controller_spec.rb | 5 +++++
spec/helpers/forums_helper_spec.rb | 15 +++++++++++++++
spec/models/forum_spec.rb | 5 +++++
11 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 app/assets/javascripts/forums.js
create mode 100644 app/assets/javascripts/memos.js
create mode 100644 app/assets/stylesheets/forums.scss
create mode 100644 app/controllers/forums_controller.rb
create mode 100644 app/helpers/forums_helper.rb
create mode 100644 app/models/forum.rb
create mode 100644 db/migrate/20190730070155_create_forums.rb
create mode 100644 spec/controllers/forums_controller_spec.rb
create mode 100644 spec/helpers/forums_helper_spec.rb
create mode 100644 spec/models/forum_spec.rb
diff --git a/app/assets/javascripts/forums.js b/app/assets/javascripts/forums.js
new file mode 100644
index 000000000..dee720fac
--- /dev/null
+++ b/app/assets/javascripts/forums.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/memos.js b/app/assets/javascripts/memos.js
new file mode 100644
index 000000000..dee720fac
--- /dev/null
+++ b/app/assets/javascripts/memos.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/stylesheets/forums.scss b/app/assets/stylesheets/forums.scss
new file mode 100644
index 000000000..fafd631e1
--- /dev/null
+++ b/app/assets/stylesheets/forums.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the forums controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
new file mode 100644
index 000000000..82573fdd0
--- /dev/null
+++ b/app/controllers/forums_controller.rb
@@ -0,0 +1,2 @@
+class ForumsController < ApplicationController
+end
diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb
index 6af88de33..5d36c465f 100644
--- a/app/helpers/export_helper.rb
+++ b/app/helpers/export_helper.rb
@@ -497,7 +497,7 @@ module ExportHelper
def make_zip_name(work, file_name="")
Rails.logger.info("######################file_name: #{file_name}")
# name = file_name === "" ? "" : (file_name[0, file_name.rindex('.')]+"_")
- "#{work&.user&.student_id}_#{work.&user.&real_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
+ "#{work&.user&.student_id}_#{work&.user&.real_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
diff --git a/app/helpers/forums_helper.rb b/app/helpers/forums_helper.rb
new file mode 100644
index 000000000..2e531fd46
--- /dev/null
+++ b/app/helpers/forums_helper.rb
@@ -0,0 +1,2 @@
+module ForumsHelper
+end
diff --git a/app/models/forum.rb b/app/models/forum.rb
new file mode 100644
index 000000000..88aafa676
--- /dev/null
+++ b/app/models/forum.rb
@@ -0,0 +1,2 @@
+class Forum < ApplicationRecord
+end
diff --git a/db/migrate/20190730070155_create_forums.rb b/db/migrate/20190730070155_create_forums.rb
new file mode 100644
index 000000000..f1f6eb96a
--- /dev/null
+++ b/db/migrate/20190730070155_create_forums.rb
@@ -0,0 +1,8 @@
+class CreateForums < ActiveRecord::Migration[5.2]
+ def change
+ create_table :forums do |t|
+
+ t.timestamps
+ end
+ end
+end
diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb
new file mode 100644
index 000000000..a4143d232
--- /dev/null
+++ b/spec/controllers/forums_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe ForumsController, type: :controller do
+
+end
diff --git a/spec/helpers/forums_helper_spec.rb b/spec/helpers/forums_helper_spec.rb
new file mode 100644
index 000000000..46766dbff
--- /dev/null
+++ b/spec/helpers/forums_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ForumsHelper. For example:
+#
+# describe ForumsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe ForumsHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/forum_spec.rb b/spec/models/forum_spec.rb
new file mode 100644
index 000000000..56c246346
--- /dev/null
+++ b/spec/models/forum_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Forum, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
From 60137fc05aeb5b30008f19890dd000fd5b779e49 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, 30 Jul 2019 15:08:07 +0800
Subject: [PATCH 07/56] b
---
public/react/src/App.js | 2 +-
.../projectPackages/PackageIndex/PackageConcent.js | 4 ++--
.../PackageIndexNEITaskDetails.js | 6 +++---
.../PackageIndexNEIBannerConcent.js | 4 ++--
.../PackageIndexNewandEdit/PackageIndexNEISubmit.js | 4 ++--
.../src/modules/projectPackages/ProjectPackageIndex.js | 8 ++++----
public/react/src/modules/user/usersInfo/InfosPackage.js | 6 ------
7 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/public/react/src/App.js b/public/react/src/App.js
index e713cd0fd..6d1e2a521 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -304,7 +304,7 @@ class App extends Component {
{/**/}
{/*众包创新*/}
-
+
{/*认证*/}
diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
index cfc54bb98..921c3e555 100644
--- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
@@ -158,7 +158,7 @@ class PackageConcent extends Component {
enterButton={ 搜索}
onSearch={ (value)=>this.setdatafuns(value)} />
@@ -224,7 +224,7 @@ class PackageConcent extends Component {
diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
index 4788a7dc1..bcd46dbb0 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
@@ -230,7 +230,7 @@ class PackageIndexNEITaskDetails extends Component {
}
goback = () => {
// window.history.go(-1)
- window.location.href="/crowdsourcings";
+ window.location.href="/crowdsourcing";
}
render() {
@@ -252,7 +252,7 @@ class PackageIndexNEITaskDetails extends Component {
'} className={"fl"}>
{/*{this.props.current_user.username}*/}
- 众包创新
+ 众包创新
{data&&data.title}
@@ -352,7 +352,7 @@ class PackageIndexNEITaskDetails extends Component {
需求详情:
{data&&data.status==="pending"&&data&&data.operation.can_select_bidding_user===true?:""}
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index e4926e02c..3caedebde 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -454,7 +454,7 @@ class PackageIndexNEIBannerConcent extends Component {
if(type===true){
this.props.setPublicationfun(response.data.id)
}else{
- window.location.href="/crowdsourcings/"+response.data.id
+ window.location.href="/crowdsourcing/"+response.data.id
}
this.setState({
springtype:false
@@ -502,7 +502,7 @@ class PackageIndexNEIBannerConcent extends Component {
if(type===true){
this.props.setPublicationfun(response.data.id)
}else{
- window.location.href="/crowdsourcings/"+response.data.id
+ window.location.href="/crowdsourcing/"+response.data.id
}
this.setState({
springtype:false
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js
index a64e222e4..9f287e90e 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js
@@ -14,10 +14,10 @@ class PackageIndexNEISubmit extends Component {
}
setageload=(sum)=>{
if(sum===undefined){
- window.location.href="/crowdsourcings/new"
+ window.location.href="/crowdsourcing/new"
}else{
// this.props.history.push("/project_packages/"+sum)
- window.location.href="/crowdsourcings/"+sum
+ window.location.href="/crowdsourcing/"+sum
}
}
diff --git a/public/react/src/modules/projectPackages/ProjectPackageIndex.js b/public/react/src/modules/projectPackages/ProjectPackageIndex.js
index 6f2e32b8b..097e012e0 100644
--- a/public/react/src/modules/projectPackages/ProjectPackageIndex.js
+++ b/public/react/src/modules/projectPackages/ProjectPackageIndex.js
@@ -43,25 +43,25 @@ class ProjectPackageIndex extends Component {
{/*众包首页*/}
- ()
}
>
- ()
}
>
- ()
}
>
- ()
}
diff --git a/public/react/src/modules/user/usersInfo/InfosPackage.js b/public/react/src/modules/user/usersInfo/InfosPackage.js
index 8222c951b..135f9f52e 100644
--- a/public/react/src/modules/user/usersInfo/InfosPackage.js
+++ b/public/react/src/modules/user/usersInfo/InfosPackage.js
@@ -183,12 +183,6 @@ class InfosCourse extends Component{
})
}
- {
- totalCount > 15 &&
-
- }
)
From 6440bfabe266acca359c4a7143393e70d3054e49 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Tue, 30 Jul 2019 15:15:17 +0800
Subject: [PATCH 08/56] fix create project package api
---
app/services/project_packages/save_service.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/services/project_packages/save_service.rb b/app/services/project_packages/save_service.rb
index caf4cf6c7..a876f56b3 100644
--- a/app/services/project_packages/save_service.rb
+++ b/app/services/project_packages/save_service.rb
@@ -25,7 +25,9 @@ class ProjectPackages::SaveService < ApplicationService
end
ActiveRecord::Base.transaction do
- package.assign_attributes(params)
+ columns = %i[project_package_category_id title content deadline_at
+ min_price max_price contact_name contact_phone]
+ package.assign_attributes(params.slice(*columns))
package.save!
# 处理附件
From 0cce3471436edac605a17663bca16e972d541fc7 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, 30 Jul 2019 15:20:52 +0800
Subject: [PATCH 09/56] b
---
.../PackageIndexNEITaskDetails.js | 8 ++++----
.../PackageIndexNEIBannerConcent.js | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
index bcd46dbb0..dd1e176e4 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
@@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {Link} from "react-router-dom";
import axios from 'axios';
import { Input ,Icon,Button,Pagination,DatePicker,Breadcrumb} from 'antd';
-import { handleDateString,markdownToHTML,bytesToSize} from 'educoder';
+import { handleDateString,markdownToHTML,bytesToSize,getImageUrl} from 'educoder';
import NEITaskDetailsModel from './NEITaskDetailsModel';
import moment from 'moment';
import '../packageconcnet.css';
@@ -281,7 +281,7 @@ class PackageIndexNEITaskDetails extends Component {
+ src={getImageUrl("images/"+data&&data.creator.image_url)} width="70"/>
{data&&data.creator.name}
@@ -403,7 +403,7 @@ class PackageIndexNEITaskDetails extends Component {
return(
{item.status==="bidding_won"?
:""}
-
+
{this.props.current_user&&this.props.current_user.login!=item.login?
联系TA
@@ -451,7 +451,7 @@ class PackageIndexNEITaskDetails extends Component {
return(
this.Clickteacher2(item.id)} key={key}>
{item.bool===true?
:
}
-
+
{item.name}
)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 3caedebde..04a8c9c4a 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -67,7 +67,7 @@ class PackageIndexNEIBannerConcent extends Component {
}
}
componentDidUpdate = (prevProps) => {
- if(prevProps.current_user.username!=this.props.current_user.username){
+ if(prevProps.current_user.username!=this.props.current_user&&this.props.current_user.username){
this.setState({
contact_name:this.props.current_user&&this.props.current_user.username
})
From f6fe2f0ed20f47ea2176d30f5386ca4d1cab8b47 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 30 Jul 2019 15:24:48 +0800
Subject: [PATCH 10/56] top
---
.../src/modules/courses/busyWork/CommonWorkDetailIndex.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
index a690fedc0..2d3361492 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
@@ -305,9 +305,6 @@ class CommonWorkDetailIndex extends Component{
.floatSpinParent .ant-spin-nested-loading {
float: right;
}
- .floatSpinParent .ant-spin-nested-loading .ant-spin-spinning{
- top: 10px;
- }
`}
{this.props.isAdmin()?
From 578f2ab200a4cd135c85ffb17e073cb15b288eeb 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, 30 Jul 2019 15:28:18 +0800
Subject: [PATCH 11/56] b
---
.../PackageIndexNEIBannerConcent.js | 14 ++---
.../modules/user/usersInfo/InfosPackage.js | 58 +------------------
2 files changed, 8 insertions(+), 64 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 04a8c9c4a..8db157a65 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -66,13 +66,13 @@ class PackageIndexNEIBannerConcent extends Component {
categories:[]
}
}
- componentDidUpdate = (prevProps) => {
- if(prevProps.current_user.username!=this.props.current_user&&this.props.current_user.username){
- this.setState({
- contact_name:this.props.current_user&&this.props.current_user.username
- })
- }
- }
+ // componentDidUpdate = (prevProps) => {
+ // if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user&&prevProps.current_user.username){
+ // this.setState({
+ // contact_name:this.props.current_user&&this.props.current_user.username
+ // })
+ // }
+ // }
componentDidMount() {
window.document.title = '众包创新'
diff --git a/public/react/src/modules/user/usersInfo/InfosPackage.js b/public/react/src/modules/user/usersInfo/InfosPackage.js
index 135f9f52e..ad1a38964 100644
--- a/public/react/src/modules/user/usersInfo/InfosPackage.js
+++ b/public/react/src/modules/user/usersInfo/InfosPackage.js
@@ -125,63 +125,7 @@ class InfosCourse extends Component{
{
(!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) &&
}
- {
- data && data.courses && data.courses.map((item,key)=>{
- return(
- this.turnToCourses(`${item.first_category_url}`,item.can_visited)} style={{"cursor": "pointer"}}>
- {
- item.is_public == 1 &&
-
-
-
- 公开
-
- }
- {
- item.can_visited ==false?
-
-
-
非成员不能访问
-
:""
- }
-
-
-
- {item.name}
-
-
-
{item.teacher && item.teacher.real_name}
-
{item.teacher && item.teacher.school_name}
-
-
-
- {
- item.members_count > 0 &&
-
-
- {item.members_count}
-
- }
- {
- item.homework_commons_count > 0 &&
-
-
- {item.homework_commons_count}
-
- }
- {
- item.attachments_count > 0 &&
-
-
- {item.attachments_count}
-
- }
-
-
-
- )
- })
- }
+
From fb55382dd131b90117eec2cc835e64f7c41089b4 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 30 Jul 2019 15:34:21 +0800
Subject: [PATCH 12/56] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=BC=80=E5=90=AF?=
=?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/concerns/git_helper.rb | 2 +-
app/controllers/shixuns_controller.rb | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb
index d77e1c3f6..c0c68ee81 100644
--- a/app/controllers/concerns/git_helper.rb
+++ b/app/controllers/concerns/git_helper.rb
@@ -48,7 +48,7 @@ module GitHelper
def project_fork(container, original_rep_path, username)
raise Educoder::TipException.new("fork源路径为空,fork失败!") if original_rep_path.blank?
# 将要生成的仓库名字
- new_repo_name = "#{username.try(:strip)}/#{container.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}"
+ new_repo_name = "#{username.try(:strip)} /#{container.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}"
uid_logger("start fork container: repo_name is #{new_repo_name}")
GitService.fork_repository(repo_path: original_rep_path, fork_repository_path: (new_repo_name + ".git"))
container.update_attributes!(:repo_name => new_repo_name)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 6c3f34a60..26effd12e 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -714,6 +714,7 @@ class ShixunsController < ApplicationController
end
end
rescue Exception => e
+ logger.info("shixun_exec error: #{e.message}")
if e.message != "ActiveRecord::RecordInvalid"
logger.error("##########project_fork error #{e.message}")
@myshixun.destroy!
From 8b5636734478aba6904c193136f771a338c516bf Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 30 Jul 2019 15:36:14 +0800
Subject: [PATCH 13/56] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/memo.rb | 4 +++-
db/migrate/20190730070155_create_forums.rb | 8 --------
2 files changed, 3 insertions(+), 9 deletions(-)
delete mode 100644 db/migrate/20190730070155_create_forums.rb
diff --git a/app/models/memo.rb b/app/models/memo.rb
index 610a7684d..4dc153c81 100644
--- a/app/models/memo.rb
+++ b/app/models/memo.rb
@@ -1,7 +1,9 @@
class Memo < ApplicationRecord
include Searchable::Memo
- has_many :memo_tag_repertoires, :dependent => :destroy
+ belongs_to :forum, touch: true
+
+ has_many :memo_tag_repertoires, dependent: :destroy
has_many :tag_repertoires, :through => :memo_tag_repertoires
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
diff --git a/db/migrate/20190730070155_create_forums.rb b/db/migrate/20190730070155_create_forums.rb
deleted file mode 100644
index f1f6eb96a..000000000
--- a/db/migrate/20190730070155_create_forums.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class CreateForums < ActiveRecord::Migration[5.2]
- def change
- create_table :forums do |t|
-
- t.timestamps
- end
- end
-end
From a70fc2c8c9753b287fef9240f5a585984c113849 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, 30 Jul 2019 15:36:17 +0800
Subject: [PATCH 14/56] b
---
.../PackageIndexNEIBannerConcent.js | 17 ++++++++++-------
.../src/modules/user/usersInfo/InfosPackage.js | 15 +++------------
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 8db157a65..eaacc9367 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -66,13 +66,7 @@ class PackageIndexNEIBannerConcent extends Component {
categories:[]
}
}
- // componentDidUpdate = (prevProps) => {
- // if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user&&prevProps.current_user.username){
- // this.setState({
- // contact_name:this.props.current_user&&this.props.current_user.username
- // })
- // }
- // }
+
componentDidMount() {
window.document.title = '众包创新'
@@ -99,6 +93,7 @@ class PackageIndexNEIBannerConcent extends Component {
})
}else{
+ console.log(this.props.current_user&&this.props.current_user.username)
this.setState({
contact_name:this.props.current_user&&this.props.current_user.username
})
@@ -121,6 +116,14 @@ class PackageIndexNEIBannerConcent extends Component {
// this.contentMdRef.current.setValue("测试赋值")
}
+
+ // componentDidUpdate = (prevProps) => {
+ // if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user&&prevProps.current_user.username){
+ // this.setState({
+ // contact_name:this.props.current_user&&this.props.current_user.username
+ // })
+ // }
+ // }
//获取验证码;
getverificationcode =()=>{
// if (this.state.logins&&this.state.logins.length === 0) {
diff --git a/public/react/src/modules/user/usersInfo/InfosPackage.js b/public/react/src/modules/user/usersInfo/InfosPackage.js
index ad1a38964..638b2ecd2 100644
--- a/public/react/src/modules/user/usersInfo/InfosPackage.js
+++ b/public/react/src/modules/user/usersInfo/InfosPackage.js
@@ -110,23 +110,14 @@ class InfosCourse extends Component{
- 共{totalCount}个
+ 共{0}个
发布时间
-
- {
- page == 1 && is_current &&
- this.props.current_user && this.props.current_user.user_identity != "学生" ? : ""
- }
- {
- (!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) &&
- }
-
-
+
)
From 6e96556e1a662795f636ce989ebbd68d9f5a9a67 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, 30 Jul 2019 15:39:54 +0800
Subject: [PATCH 15/56] b
---
.../PackageIndexNEIBannerConcent.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index eaacc9367..96980160b 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -117,13 +117,13 @@ class PackageIndexNEIBannerConcent extends Component {
// this.contentMdRef.current.setValue("测试赋值")
}
- // componentDidUpdate = (prevProps) => {
- // if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user&&prevProps.current_user.username){
- // this.setState({
- // contact_name:this.props.current_user&&this.props.current_user.username
- // })
- // }
- // }
+ componentDidUpdate = (prevProps) => {
+ if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user.username){
+ this.setState({
+ contact_name:this.props.current_user&&this.props.current_user.username
+ })
+ }
+ }
//获取验证码;
getverificationcode =()=>{
// if (this.state.logins&&this.state.logins.length === 0) {
From 6febcf56e3c4c5322983f81f11cba4037b268004 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, 30 Jul 2019 15:42:16 +0800
Subject: [PATCH 16/56] b
---
.../PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 96980160b..42a107444 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -859,7 +859,7 @@ class PackageIndexNEIBannerConcent extends Component {
placeholder="请输入手机号"
disabled={true}
/>
-
+
this.editmodels()}>
:""}
@@ -900,7 +900,7 @@ class PackageIndexNEIBannerConcent extends Component {
{/**/}
-
+
this.modalCancel()}>X
:""}
From 2a373cffe02e59fc3293b8905ba120db4946dbd0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 30 Jul 2019 15:43:48 +0800
Subject: [PATCH 17/56] =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/concerns/git_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb
index c0c68ee81..d77e1c3f6 100644
--- a/app/controllers/concerns/git_helper.rb
+++ b/app/controllers/concerns/git_helper.rb
@@ -48,7 +48,7 @@ module GitHelper
def project_fork(container, original_rep_path, username)
raise Educoder::TipException.new("fork源路径为空,fork失败!") if original_rep_path.blank?
# 将要生成的仓库名字
- new_repo_name = "#{username.try(:strip)} /#{container.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}"
+ new_repo_name = "#{username.try(:strip)}/#{container.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}"
uid_logger("start fork container: repo_name is #{new_repo_name}")
GitService.fork_repository(repo_path: original_rep_path, fork_repository_path: (new_repo_name + ".git"))
container.update_attributes!(:repo_name => new_repo_name)
From 00390cffbd5216b5d541218a12b9c4d4625dea75 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, 30 Jul 2019 15:48:54 +0800
Subject: [PATCH 18/56] b
---
.../PackageIndexNEIBannerConcent.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 42a107444..a279f7f13 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -118,11 +118,14 @@ class PackageIndexNEIBannerConcent extends Component {
}
componentDidUpdate = (prevProps) => {
- if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user.username){
- this.setState({
- contact_name:this.props.current_user&&this.props.current_user.username
- })
- }
+ console.log(this.props.current_user)
+ console.log("____________")
+ console.log(prevProps.current_user)
+ // if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user.username){
+ // this.setState({
+ // contact_name:this.props.current_user&&this.props.current_user.username
+ // })
+ // }
}
//获取验证码;
getverificationcode =()=>{
From 4ab00b3a663eed8460ee5750e1661e2416db3116 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, 30 Jul 2019 15:54:05 +0800
Subject: [PATCH 19/56] b
---
.../PackageIndexNEIBannerConcent.js | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index a279f7f13..e8ae230a7 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -118,14 +118,11 @@ class PackageIndexNEIBannerConcent extends Component {
}
componentDidUpdate = (prevProps) => {
- console.log(this.props.current_user)
- console.log("____________")
- console.log(prevProps.current_user)
- // if(this.props.current_user&&this.props.current_user.username!=prevProps.current_user.username){
- // this.setState({
- // contact_name:this.props.current_user&&this.props.current_user.username
- // })
- // }
+ if(prevProps.current_user.username!=this.props.current_user){
+ this.setState({
+ contact_name:this.props.current_user&&this.props.current_user.username
+ })
+ }
}
//获取验证码;
getverificationcode =()=>{
From 336bc6edc30b3ec7429ce896ada7afe6e1c1ad52 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, 30 Jul 2019 15:57:10 +0800
Subject: [PATCH 20/56] b
---
.../PackageIndexNEIBannerConcent.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index e8ae230a7..a9de27f27 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -119,9 +119,12 @@ class PackageIndexNEIBannerConcent extends Component {
componentDidUpdate = (prevProps) => {
if(prevProps.current_user.username!=this.props.current_user){
- this.setState({
- contact_name:this.props.current_user&&this.props.current_user.username
- })
+ if(this.props.current_user!=undefined){
+ this.setState({
+ contact_name:this.props.current_user.username
+ })
+ }
+
}
}
//获取验证码;
From 728784e20c6ee3c6840f90620e8c01e92690de17 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, 30 Jul 2019 16:00:43 +0800
Subject: [PATCH 21/56] b
---
.../PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index a9de27f27..0dda4f029 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -120,6 +120,7 @@ class PackageIndexNEIBannerConcent extends Component {
componentDidUpdate = (prevProps) => {
if(prevProps.current_user.username!=this.props.current_user){
if(this.props.current_user!=undefined){
+ console.log(this.props.current_user)
this.setState({
contact_name:this.props.current_user.username
})
From c1e0871861888ecbc2b78b8cdd88b3519d8b0b0b 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, 30 Jul 2019 16:03:16 +0800
Subject: [PATCH 22/56] b
---
.../PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
index dd1e176e4..1dd130a87 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
@@ -236,7 +236,7 @@ class PackageIndexNEITaskDetails extends Component {
render() {
let {overtype,data}=this.state;
// console.log(data&&data.creator.login)
- // console.log(this.props.current_user.login)
+ console.log(data)
return (