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

chromesetting
杨树林 5 years ago
commit a3bccd5687

@ -1,8 +1,8 @@
class HacksController < ApplicationController class HacksController < ApplicationController
before_action :require_login, except: [:index] before_action :require_login, except: [:index]
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set, :destroy] before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set, :destroy, :cancel_publish]
before_action :require_teacher_identity, only: [:create] before_action :require_teacher_identity, only: [:create]
before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set, :destroy] before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set, :destroy, :cancel_publish]
# 开启编程,如果第一次开启,创建一条记录,如果已经开启过的话,直接返回标识即可 # 开启编程,如果第一次开启,创建一条记录,如果已经开启过的话,直接返回标识即可
@ -99,6 +99,12 @@ class HacksController < ApplicationController
render_ok render_ok
end end
# 取消发布
def cancel_publish
@hack.update_attribute(:status, 0)
render_ok
end
# 发布列表 # 发布列表
def unpulished_list def unpulished_list
limit = params[:limit] || 16 limit = params[:limit] || 16

@ -1,5 +1,5 @@
json.hack do json.hack do
json.(@hack, :name, :difficult, :time_limit, :description, :score, :identifier) json.(@hack, :name, :difficult, :time_limit, :description, :score, :identifier, :status)
json.language @hack.language json.language @hack.language
json.username @hack.user.real_name json.username @hack.user.real_name
json.code @my_hack.code json.code @my_hack.code

@ -8,6 +8,6 @@ end
json.hacks_count @hacks_count json.hacks_count @hacks_count
json.hacks_list do json.hacks_list do
json.array! @hacks do |hack| json.array! @hacks do |hack|
json.(hack,:identifier, :name , :hack_user_lastest_codes_count, :difficult, :passed_rate, :category) json.(hack,:identifier, :name , :hack_user_lastest_codes_count, :difficult, :passed_rate, :category, :open_or_not, :status)
end end
end end

@ -55,6 +55,7 @@ Rails.application.routes.draw do
end end
member do member do
post :publish post :publish
post :cancel_publish
get :start get :start
post :update_set post :update_set
delete :delete_set delete :delete_set

@ -150,6 +150,7 @@ export default class Shixuninformation extends Component {
}) })
}) })
} }
CheckboxonChange = (e) => { CheckboxonChange = (e) => {
this.setState({ this.setState({

@ -701,6 +701,9 @@ class Shixuninformation extends Component {
}) })
} }
}); });
this.setState({
loading: false
})
} }
Selectthestudent = (value) => { Selectthestudent = (value) => {

@ -123,12 +123,11 @@ class Newshixuns extends Component {
}) })
}else{
this.setState({
loading: true
})
} }
}); });
this.setState({
loading: false
})
}; };
Selectthestudent = (value) => { Selectthestudent = (value) => {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
@ -466,7 +465,7 @@ class Newshixuns extends Component {
> >
{getFieldDecorator('name', { {getFieldDecorator('name', {
rules: [{ rules: [{
required: true, message: '请输入选题名称', required: true, message: '请输入名称',
}, { }, {
max: 60, message: '请输入名称最大限制60个字符', max: 60, message: '请输入名称最大限制60个字符',
}, { }, {

Loading…
Cancel
Save