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

dev_jupyter
杨树林 5 years ago
commit e2c72af555

@ -19,7 +19,7 @@ class ShixunsController < ApplicationController
:add_file, :jupyter_exec]
before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public,
:shixun_members_added, :change_manager, :collaborators_delete,
:shixun_members_added, :change_manager, :collaborators_delete, :upload_git_file,
:cancel_apply_public, :cancel_publish, :add_collaborators, :add_file]
before_action :portion_allowed, only: [:copy]
@ -885,6 +885,17 @@ class ShixunsController < ApplicationController
@content = update_file_content content, @repo_path, @path, author_email, author_name, "Edit by browser"
end
def upload_git_file
upload_file = params["file"]
uid_logger("#########################file_params####{params["#{params[:file]}"]}")
raise "未上传文件" unless upload_file
content = upload_file.tempfile.read
author_name = current_user.real_name
author_email = current_user.git_mail
update_file_content(content, @repo_path, author_email, author_name, "upload by browser")
render_ok
end
def add_collaborators
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
user_name = "%#{params[:user_name].to_s.strip}%"

@ -0,0 +1,9 @@
class TagDisciplinesController < ApplicationController
before_action :require_login
def create
sub_discipline = SubDiscipline.find_by!(id: params[:sub_discipline_id])
tag_discipline = TagDiscipline.create!(name: params[:name].to_s.strip, sub_discipline: sub_discipline, user_id: current_user.id)
render_ok({tag_discipline_id: tag_discipline.id})
end
end

@ -1,8 +1,10 @@
class TagDiscipline < ApplicationRecord
belongs_to :sub_discipline
belongs_to :user
belongs_to :user, optional: true
has_many :tag_discipline_containers, dependent: :destroy
validates_presence_of :name
def discipline
sub_discipline&.discipline
end

@ -1,5 +1,8 @@
# 编程内容
json.(@hack, :name, :description, :language, :difficult, :category, :time_limit, :open_or_not, :status)
json.(@hack, :name, :description, :language, :difficult, :category, :time_limit, :open_or_not, :status, :sub_discipline_id)
# 课程
json.tag_discipline_id @hack.tag_discipline_containers.pluck(:tag_discipline_id)
# 代码
json.language @hack.language

@ -56,6 +56,7 @@ Rails.application.routes.draw do
end
resources :disciplines, only: [:index]
resources :tag_disciplines, only: [:create]
resources :item_banks do
member do
@ -301,6 +302,7 @@ Rails.application.routes.draw do
post :set_secret_dir
post :commits
post :file_content
post :upload_git_file
post :update_file
post :close
post :add_file

@ -0,0 +1,6 @@
class MigrateItemType < ActiveRecord::Migration[5.2]
def change
add_column :item_banks, :container_id, :integer
add_column :item_banks, :container_type, :string
end
end

@ -403,7 +403,8 @@ class CommonWorkList extends Component{
left_time: {},
category: {},
b_order: 'desc',
searchtypes:false
searchtypes:false,
loadingstate:false
}
}
onTablePagination = (page) => {
@ -420,9 +421,11 @@ class CommonWorkList extends Component{
})
}else{
this.setState({
searchtypes:true
searchtypes:true,
loadingstate:true
})
}
this.fetchList()
}
onSearchValueInput = (e) => {
@ -482,7 +485,8 @@ class CommonWorkList extends Component{
if (response.data) {
this.setState({
...response.data,
isSpin:false
isSpin:false,
loadingstate:false
})
this.props.initWorkDetailCommonState && this.props.initWorkDetailCommonState( Object.assign({...response.data}, {
@ -492,7 +496,8 @@ class CommonWorkList extends Component{
}).catch((error)=>{
console.log(error)
this.setState({
isSpin:false
isSpin:false,
loadingstate:false
})
})
@ -850,9 +855,9 @@ class CommonWorkList extends Component{
<div className={"justify break_full_word new_li edu-back-white course_table_wrap"} style={{minHeight:"480px", marginBottom: '30px'}}>
<style>{`
.ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
top: 72%;}
}
// .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
// top: 72%;}
// }
.singleLine tr.ant-table-row {
background: #f1f9ff;
}
@ -875,7 +880,7 @@ class CommonWorkList extends Component{
</Spin>
:
<React.Fragment>
<Spin tip="正在加载..." spinning={loadingstate}>
<Table
className="stageTable"
dataSource={student_works}
@ -883,8 +888,9 @@ class CommonWorkList extends Component{
showQuickJumper
pagination={false}
onChange={this.table1handleChange}
loading={loadingstate}
// loading={loadingstate}
/>
</Spin>
</React.Fragment>
}

Loading…
Cancel
Save