Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

master
杨树明 5 years ago
commit 6ed147b077

@ -1,10 +1,2 @@
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
def search
query_params = { keyword: params[:keyword], category: 'manage' }
projects = Users::ProjectService.new(current_user, query_params).call
params[:limit] = params[:per_page].to_i.zero? ? 20 : params[:per_page].to_i
@count = projects.count
@projects = paginate projects
end
end end

@ -43,7 +43,7 @@ class Users::BaseController < ApplicationController
page = page_value page = page_value
per_page = per_page_value per_page = per_page_value
return Kaminari.paginate_array(objs).page(page).per(per_page) unless observed_logged_user? && opts[:special] return Kaminari.paginate_array(objs).page(page).per(per_page) unless opts[:special] && observed_logged_user?
# note: 为实现第一页少一条记录,让前端放置新建入口 # note: 为实现第一页少一条记录,让前端放置新建入口
if page == 1 if page == 1

@ -1,4 +1,6 @@
class Users::ProjectsController < Users::BaseController class Users::ProjectsController < Users::BaseController
skip_before_action :check_observed_user_exists!, only: [:search]
def index def index
projects = Users::ProjectService.new(observed_user, query_params).call projects = Users::ProjectService.new(observed_user, query_params).call
@ -6,6 +8,15 @@ class Users::ProjectsController < Users::BaseController
@projects = paginate(projects.includes(:project_score, owner: { user_extension: :school }), special: true) @projects = paginate(projects.includes(:project_score, owner: { user_extension: :school }), special: true)
end end
def search
query_params = { keyword: params[:keyword], category: 'manage' }
projects = Users::ProjectService.new(current_user, query_params).call
params[:limit] = params[:per_page].to_i.zero? ? 20 : params[:per_page].to_i
@count = projects.count
@projects = paginate projects
end
private private
def query_params def query_params

@ -75,7 +75,7 @@ Rails.application.routes.draw do
get :system_update get :system_update
resource :trial_apply, only: [:create] resource :trial_apply, only: [:create]
resources :projects, only: [] do resources :projects, module: :users, only: [] do
get :search, on: :collection get :search, on: :collection
end end

@ -2312,11 +2312,13 @@ class Studentshavecompletedthelist extends Component {
}; };
_getRequestParams() { _getRequestParams() {
const { order, checkedValuesineinfo,searchtext, page ,limit} = this.state const { order, checkedValuesineinfo,course_groupyslstwo ,searchtext, page ,limit,course_groupyslsthree} = this.state
return { return {
page, page,
review:course_groupyslsthree,
commit_status:course_groupyslstwo,
search:searchtext, search:searchtext,
group_id:checkedValuesineinfo, exercise_group_id:checkedValuesineinfo,
limit: limit, limit: limit,
order, order,
} }

@ -193,7 +193,7 @@ class Testpapersettinghomepage extends Component{
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url+`?${queryString.stringify(params)}`, '_blank'); window.open("/api"+url+`?${queryString.stringify(params)}`+ '&export=true', '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -357,7 +357,7 @@ class Testpapersettinghomepage extends Component{
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`,this.child)}>学生成绩</a></li> <li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`,this.child)}>学生成绩</a></li>
{/*<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li>*/} <li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/export_exercise`,this.child)} >空白试卷</a></li>
{/*<li><a onClick={()=>this.confirmysl(`/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval===null||this.state.groupyslsval===undefined?null:this.state.groupyslsval}`)}>学生答题试卷</a></li>*/} {/*<li><a onClick={()=>this.confirmysl(`/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval===null||this.state.groupyslsval===undefined?null:this.state.groupyslsval}`)}>学生答题试卷</a></li>*/}
</ul> </ul>
</li>:""} </li>:""}

Loading…
Cancel
Save