chromesetting
daiao 5 years ago
commit 1a169315c4

@ -1,8 +1,8 @@
class HacksController < ApplicationController
before_action :require_login, except: [:index]
before_action :require_teacher_identity, only: [:create, :edit, :update]
before_action :require_auth_identity, only: [:update, :edit, :publish]
before_action :find_hack, only: [:edit, :update, :publish, :start]
before_action :require_teacher_identity, only: [:create, :update_set]
before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set]
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set]
# 开启编程,如果第一次开启,创建一条记录,如果已经开启过的话,直接返回标识即可
def start
@ -75,6 +75,20 @@ class HacksController < ApplicationController
end
end
# 更新测试集接口
def update_set
set = @hack.hack_sets.find_by(id: params[:id])
set.update_attributes!(hack_set_params)
render_ok
end
# 单独删除测试集
def delete_set
set = @hack.hack_sets.find_by(id: params[:id])
set.destroy!
render_ok
end
# 发布功能
def publish
@hack.update_attribute(:status, 1)
@ -119,6 +133,10 @@ class HacksController < ApplicationController
params.permit(hack_sets: [:input, :output, :position])[:hack_sets]
end
def hack_set_params
params.require(:hack_set).permit(:id, :input, :output, :position)
end
def hack_code_params
params.require(:hack_codes).permit(:code, :language)
end

@ -1,4 +1,6 @@
class HackSet < ApplicationRecord
validates :input, presence: { message: "测试集输入不能为空" }
validates :output, uniqueness: { message: "测试集输出不能为空" }
# 编程题测试集
belongs_to :hack
end

@ -43,6 +43,8 @@ Rails.application.routes.draw do
post :publish
get :start
get :result
post :update_set
delete :delete_set
end
resources :comments do
post :reply

@ -616,7 +616,7 @@ class NewShixunModel extends Component{
}
</Checkbox.Group>
{shixun_list===undefined||shixuns_count===undefined?"":shixun_list.length===0||shixuns_count===0?"":shixuns_count>15?<div className={" edu-txt-center pd303010"}>
{shixun_list===undefined||shixuns_count===undefined?"":shixun_list.length===0||shixuns_count===0?"":shixuns_count>15?<div className={" edu-txt-center pd303010 newshixunmodels"}>
<Pagination
showQuickJumper
defaultCurrent={1}

@ -5,6 +5,7 @@
.newshixunheadersear{
display: flex;
justify-content: center;
margin: 0 auto;
}
.packinput .ant-input{
height: 55px;
@ -376,3 +377,11 @@
display: flex;
flex-direction:initial;
}
.newshixunheadersear{
margin: 0 auto;
}
.newshixunmodels{
margin: 0 auto;
}

@ -65,7 +65,7 @@ class AccountPhoneemail extends Component {
width="530px"
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16"> 您需要完成手机号码邮箱的绑定才能使用此功能</p>
<p className="task-popup-text-center font-16"> 您需要完成手机号码或者邮箱的绑定才能使用此功能</p>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={()=>this.gotoback()}>稍后绑定</a>
<a className="task-btn task-btn-orange" href={ "/account/secure" }> {'立即绑定'}</a>

Loading…
Cancel
Save