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

dev_cs_new
hjm 6 years ago
commit b37ecec3e5

@ -9,8 +9,7 @@ class BiddingUsersController < ApplicationController
end end
def win def win
package = current_user.project_packages.find(params[:project_package_id]) ProjectPackages::WinBiddingService.call(current_package, current_user, params)
ProjectPackages::WinBiddingService.call(package, params)
render_ok render_ok
rescue ProjectPackages::WinBiddingService::Error => ex rescue ProjectPackages::WinBiddingService::Error => ex
render_error(ex.message) render_error(ex.message)

@ -17,8 +17,8 @@ class FilesController < ApplicationController
sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序 sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序
course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id
@user = current_user @user = current_user
@attachments = @course.attachments.by_course_second_category_id(course_second_category_id) @attachments = course_second_category_id.to_i == 0 ? @course.attachments : @course.attachments.by_course_second_category_id(course_second_category_id)
.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members]) @attachments = @attachments.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members])
.ordered(sort: sort.to_i, sort_type: sort_type.strip) .ordered(sort: sort.to_i, sort_type: sort_type.strip)
get_category(@course, course_second_category_id) get_category(@course, course_second_category_id)

@ -194,7 +194,7 @@ module CoursesHelper
# 获取课堂的资源数 # 获取课堂的资源数
def get_attachment_count(course, category_id) def get_attachment_count(course, category_id)
course.attachments.where(course_second_category_id: category_id).size category_id.to_i == 0 ? course.attachments.size : course.attachments.where(course_second_category_id: category_id).size
end end
# 获取课堂的作业数 # 获取课堂的作业数

@ -1,14 +1,16 @@
class ProjectPackages::WinBiddingService < ApplicationService class ProjectPackages::WinBiddingService < ApplicationService
Error = Class.new(StandardError) Error = Class.new(StandardError)
attr_reader :package, :params attr_reader :package, :user, :params
def initialize(package, params) def initialize(package, user, params)
@package = package @package = package
@user = user
@params = params @params = params
end end
def call def call
raise Error, '没有权限' unless package.creator_id == user.id || user.admin_or_business?
raise Error, '竞标报名还未结束' unless package.bidding_end? raise Error, '竞标报名还未结束' unless package.bidding_end?
raise Error, '该状态下不能选择中标者' unless package.may_finish_bidding? raise Error, '该状态下不能选择中标者' unless package.may_finish_bidding?

@ -3,6 +3,7 @@ json.message 'success'
json.private_message do json.private_message do
json.extract! @message, :id, :user_id, :receiver_id, :sender_id, :content json.extract! @message, :id, :user_id, :receiver_id, :sender_id, :content
json.send_day @message.send_time.strftime('%Y-%m-%d')
json.send_time @message.display_send_time json.send_time @message.display_send_time
json.sender do json.sender do
json.partial! 'users/user_simple', user: @message.sender json.partial! 'users/user_simple', user: @message.sender

@ -294,7 +294,7 @@ class PackageConcent extends Component {
<div className=" item-head-blank"></div> <div className=" item-head-blank"></div>
<div className=" item-head-price"> <div className=" item-head-price mtf12">
{item.min_price===null?"":<span>{item.min_price}</span>} {item.min_price===null?"":<span>{item.min_price}</span>}
{item.max_price===null||item.min_price===null?"":<span>~</span>} {item.max_price===null||item.min_price===null?"":<span>~</span>}
{item.max_price===null?"":<span>{item.max_price}</span>} {item.max_price===null?"":<span>{item.max_price}</span>}

@ -313,7 +313,7 @@ class PackageIndexNEITaskDetails extends Component {
</span> </span>
</div> </div>
<div className=" item-head-price mtf7"> <div className=" item-head-price mt2">
{data&&data.min_price===null?"":<span><span className={"font-24"}>{data&&data.min_price}</span></span>} {data&&data.min_price===null?"":<span><span className={"font-24"}>{data&&data.min_price}</span></span>}
{data&&data.max_price===null||data&&data.min_price===null?"":<span>~</span>} {data&&data.max_price===null||data&&data.min_price===null?"":<span>~</span>}
{data&&data.max_price===null?"":<span><span className={"font-24"}>{data&&data.max_price}</span></span>} {data&&data.max_price===null?"":<span><span className={"font-24"}>{data&&data.max_price}</span></span>}

@ -363,3 +363,7 @@
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
.mtf12{
margin-top: -12px;
}

@ -176,7 +176,7 @@ class InfosPackage extends Component{
<div className="item-head-tags"> <div className="item-head-tags">
</div> </div>
<div className="item-head-blank"></div> <div className="item-head-blank"></div>
<div className="item-head-price"> <div className="item-head-price mtf15">
{item.min_price===null?"":<span>{item.min_price}</span>} {item.min_price===null?"":<span>{item.min_price}</span>}
{item.max_price===null||item.min_price===null?"":<span>~</span>} {item.max_price===null||item.min_price===null?"":<span>~</span>}
{item.max_price===null?"":<span>{item.max_price}</span>} {item.max_price===null?"":<span>{item.max_price}</span>}
@ -199,8 +199,9 @@ class InfosPackage extends Component{
<span className="item-group-icon"><i className="fa fa-user"></i></span> <span className="item-group-icon"><i className="fa fa-user"></i></span>
<span className="item-group-text">{item.bidding_users_count}人竞标</span> <span className="item-group-text">{item.bidding_users_count}人竞标</span>
</div> </div>
<div className="item-group item-other-publish-at"> <div className="item-group item-other-publish-at">
发布于{moment(item.published_at).format("YYYY-MM-DD HH:mm")} {item.published_at===null?<span className="item-group-text">更新于{moment(item.updated_at).format("YYYY-MM-DD HH:mm")} </span>:
<span className=" item-group-text">发布于{moment(item.published_at).format("YYYY-MM-DD HH:mm")} </span>}
</div> </div>
</div> </div>
</div> </div>

@ -91,3 +91,7 @@
#sourceTag li a{color: #4e7a9b!important;} #sourceTag li a{color: #4e7a9b!important;}
#sourceTag li.active{background-color: #4CACFF;color: #fff;} #sourceTag li.active{background-color: #4CACFF;color: #fff;}
#sourceTag li.active a{background-color: #4CACFF;color: #fff!important;} #sourceTag li.active a{background-color: #4CACFF;color: #fff!important;}
.mtf15{
margin-top:-15px;
}
Loading…
Cancel
Save