daiao 6 years ago
commit de91b3384f

@ -33,14 +33,14 @@ class TaskBanksController < ApplicationController
end end
def gtask_bank_params def gtask_bank_params
tip_exception("name参数不能为空") if params[:gtask_bank][:name].blank? tip_exception("name参数不能为空") if params[:task_bank][:name].blank?
tip_exception("description参数不能为空") if params[:gtask_bank][:description].blank? tip_exception("description参数不能为空") if params[:task_bank][:description].blank?
if @bank.task_type == 2 if @bank.task_type == 2
tip_exception("base_on_project参数不能为空") if params[:gtask_bank][:base_on_project].nil? tip_exception("base_on_project参数不能为空") if params[:task_bank][:base_on_project].nil?
tip_exception("min_num参数不能为空") if params[:gtask_bank][:min_num].blank? tip_exception("min_num参数不能为空") if params[:task_bank][:min_num].blank?
tip_exception("max_num参数不能为空") if params[:gtask_bank][:max_num].blank? tip_exception("max_num参数不能为空") if params[:task_bank][:max_num].blank?
tip_exception("最小人数不能小于1") if params[:gtask_bank][:min_num].to_i < 1 tip_exception("最小人数不能小于1") if params[:task_bank][:min_num].to_i < 1
tip_exception("最大人数不能小于最小人数") if params[:gtask_bank][:max_num].to_i < params[:gtask_bank][:min_num].to_i tip_exception("最大人数不能小于最小人数") if params[:task_bank][:max_num].to_i < params[:gtask_bank][:min_num].to_i
end end
if @bank.task_type == 1 if @bank.task_type == 1
params.require(:gtask_bank).permit(:name, :description) params.require(:gtask_bank).permit(:name, :description)

@ -1,5 +1,6 @@
json.(@bank, :id, :name, :description, :task_type, :is_public) json.(@bank, :id, :name, :description, :task_type, :is_public)
# 附件 # 附件
json.authorize @bank.user_id == current_user.id || current_user.admin?
json.attachments @bank_attachments do |attachment| json.attachments @bank_attachments do |attachment|
json.partial! "attachments/attachment_simple", locals: {attachment: attachment} json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
end end

@ -59,7 +59,7 @@ class GtaskBanksEdit extends Component {
}); });
} }
toWorkDetail = () => { toWorkDetail = () => {
this.props.history.push(`/banks/gtask/${this.props.match.params.workId}/${this.props.match.params.type}?tab=0`); window.location.href=`/banks/gtask/${this.props.match.params.workId}/${this.props.match.params.type}?tab=0`;
this.props.initPublic(undefined); this.props.initPublic(undefined);
} }
onCancel = () => { onCancel = () => {

@ -110,8 +110,7 @@ class NewGtaskForms extends Component{
} }
handleSubmit = () => { handleSubmit = () => {
debugger
let {contentFileList,min_num,max_num,base_on_project}=this.state; let {contentFileList,min_num,max_num,base_on_project}=this.state;
let {data}=this.props; let {data}=this.props;
let task_type=data.task_type let task_type=data.task_type
@ -220,7 +219,7 @@ class NewGtaskForms extends Component{
` `
} }
</style> </style>
<Form className="courseForm" onClick={this.handleSubmit} > <Form className="courseForm" >
<div className={"ant-row ant-form-item AboutInputForm newAboutInputForm "}> <div className={"ant-row ant-form-item AboutInputForm newAboutInputForm "}>
<div className="ant-col ant-form-item-label margin0"> <div className="ant-col ant-form-item-label margin0">
<label htmlFor="coursesNew_course" className="ant-form-item-required ">类型</label> <span className={"tasktypes"}>{this.props.data&&this.props.data.task_type===1?"":this.props.data&&this.props.data.task_type===2?"":""}</span> <label htmlFor="coursesNew_course" className="ant-form-item-required ">类型</label> <span className={"tasktypes"}>{this.props.data&&this.props.data.task_type===1?"":this.props.data&&this.props.data.task_type===2?"":""}</span>
@ -340,7 +339,7 @@ class NewGtaskForms extends Component{
<Form.Item> <Form.Item>
<div className="clearfix mt30 mb30"> <div className="clearfix mt30 mb30">
{/* htmlType="submit" */} {/* htmlType="submit" */}
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button> <Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl" onClick={() => this.props.onCancel()}>取消</ a> <a className="defalutCancelbtn fl" onClick={() => this.props.onCancel()}>取消</ a>
</div> </div>
</Form.Item> </Form.Item>

Loading…
Cancel
Save