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

dev_jupyter
daiao 5 years ago
commit 578edc6f45

@ -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

@ -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>
}

@ -394,19 +394,19 @@ class Question extends Component {
this.setState({
keywords: e.target.value
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: e.target.value,
page: this.state.page,
per_page:10,
};
this.getdata(data);
// var data = {
// discipline_id:this.state.discipline_id,
// sub_discipline_id:this.state.sub_discipline_id,
// tag_discipline_id:this.state.tag_discipline_id,
// public: this.state.defaultActiveKey,
// difficulty: this.state.difficulty,
// item_type: this.state.item_type,
// keywords: e.target.value,
// page: this.state.page,
// per_page:10,
// };
//
// this.getdata(data);
}
setdatafuns = (value) => {

@ -258,8 +258,10 @@
width:70%;
}
.w30s{
width:70%;
width:30%;
}
.w50s{
width: 50%;
}

@ -35,7 +35,7 @@ class Testpaperlibrary extends Component {
booljupyterurls:false,
Contentdata:[],
items_count:0,
defaultActiveKey:"0",
}
}
getContainer = () => {
@ -86,9 +86,28 @@ class Testpaperlibrary extends Component {
this.getdata(data);
}
setdatafunsval = (e) => {
this.setState({
keywords: e.target.value
})
callback=()=>{
}
setdatafuns = (value) => {
this.setState({
keywords: value,
})
}
callback = (key) => {
this.setState({
defaultActiveKey: key,
})
var data={
page:1,
per_page:10,
public:key,
}
this.getdata(data);
}
//搜索框的内容
@ -217,6 +236,9 @@ class Testpaperlibrary extends Component {
<Contentpart
{...this.props}
{...this.state}
setdatafuns={(key)=>this.setdatafuns(key)}
callback={(key)=>this.callback(key)}
setdatafunsval={(key)=>this.setdatafunsval(key)}
setdifficulty={(bool)=>this.setdifficulty(bool)}
>

@ -69,6 +69,9 @@ class Contentpart extends Component {
width: 31px !important;
left: 14px;
}
.ant-tabs-nav{
z-index: 1000;
}
`
}
</style>

@ -64,8 +64,13 @@ class Listjihe extends Component {
let {page,name,nd,chakanjiexibool}=this.state;
let {defaultActiveKey,items}=this.props;
////console.log("Listjihe");
////console.log(this.props);
const names= items&&items.name&&items.name;
const question_counts=items&&items.question_count&&items.question_count;
const total_scores =items&&items.total_score&&items.total_score;
const difficultys=items&&items.difficulty&&items.difficulty===1?"简单":items&&items.difficulty&&items.difficulty===2?"适中":items&&items.difficulty&&items.difficulty===3?"困难":""
const update_times=items&&items.update_time&&items.update_time;
const quotess =items&&items.quotes&&items.quotes;
const authors=items&&items.author&&items.author.name;
return (
<div className={chakanjiexibool===true?"w100s borderwds283 pd20 mb20":"w100s borderwds pd20 mb20 intermediatecenter"}>
<div className="sortinxdirection w100s">
@ -74,27 +79,27 @@ class Listjihe extends Component {
</div>
<div className="w100s verticallayout ml37" >
<div className="w100s"> <p className="sjtitle">前端开发评测试题1</p></div>
<div className="w100s"> <p className="sjtitle">{names}</p></div>
<div className="w100s sortinxdirection mt9">
<p className="sjtitles">试题数<span >35</span></p>
<p className="sjtitles ml48">总分<span >100</span></p>
<p className="sjtitles ml48">难度<span >适中</span></p>
<p className="sjtitles">试题数<span >{question_counts}</span></p>
<p className="sjtitles ml48">总分<span >{total_scores}</span></p>
<p className="sjtitles ml48">难度<span >{difficultys}</span></p>
</div>
<div className="w100s sortinxdirection mt11">
<div className="w50s sortinxdirection">
<div className="w60s sortinxdirection">
<p className='sjtitlesysl'>
更新时间<span>2019-12-09</span>
更新时间<span>{update_times}</span>
</p>
<p className='sjtitlesysl'>
使用次数<span>1245</span>
<p className='sjtitlesysl ml30'>
使用次数<span>{quotess}</span>
</p>
<p className='sjtitlesysl'>
创建者<span>王老师</span>
<p className='sjtitlesysl ml30'>
创建者<span>{authors}</span>
</p>
</div>
<div className="w50s xaxisreverseorder">
<div className="w40s xaxisreverseorder">
<p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-shanchu1 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>删除</span>

@ -258,7 +258,13 @@
width:70%;
}
.w30s{
width:70%;
width:30%;
}
.w60s{
width:60%;
}
.w40s{
width:40%;
}
.w50s{
width: 50%;

Loading…
Cancel
Save