From 935932cf5f17d6bd16cce541bc27fb843aadc974 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 31 Dec 2019 18:03:29 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tag_disciplines_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/controllers/tag_disciplines_controller.rb diff --git a/app/controllers/tag_disciplines_controller.rb b/app/controllers/tag_disciplines_controller.rb new file mode 100644 index 000000000..b527e455d --- /dev/null +++ b/app/controllers/tag_disciplines_controller.rb @@ -0,0 +1,7 @@ +class TagDisciplinesController < ApplicationController + before_action :require_login + + def create + + end +end \ No newline at end of file From 827d8b568c624bf4d4d835adcfc607e63f92e64e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 2 Jan 2020 09:56:42 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 15 +++++++++++++-- config/routes.rb | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 4f2a19536..c641231a6 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -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] @@ -883,7 +883,18 @@ class ShixunsController < ApplicationController author_name = current_user.real_name author_email = current_user.git_mail @content = update_file_content content, @repo_path, @path, author_email, author_name, "Edit by browser" - end + 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(',') + ")" diff --git a/config/routes.rb b/config/routes.rb index b61b2e608..69d6d9377 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -279,6 +279,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 From 8dd3414c37eddf08bccf661f9682f22fd945a674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 2 Jan 2020 10:06:38 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 26 ++++++++-------- .../question/questioncss/questioncom.css | 4 ++- .../src/modules/testpaper/Testpaperlibrary.js | 26 ++++++++++++++-- .../testpaper/component/Contentpart.js | 3 ++ .../modules/testpaper/component/Listjihe.js | 31 +++++++++++-------- .../testpaper/testioncss/testioncss.css | 8 ++++- 6 files changed, 68 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 2da5f0d0e..26b909fea 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -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) => { diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 1eaed0f85..6c5e54924 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -258,8 +258,10 @@ width:70%; } .w30s{ - width:70%; + width:30%; } + + .w50s{ width: 50%; } diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 4c2ae7a00..89768e2fc 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -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)} > diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index fa20b3093..765be880f 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -69,6 +69,9 @@ class Contentpart extends Component { width: 31px !important; left: 14px; } + .ant-tabs-nav{ + z-index: 1000; + } ` } </style> diff --git a/public/react/src/modules/testpaper/component/Listjihe.js b/public/react/src/modules/testpaper/component/Listjihe.js index cd541f429..da10214a0 100644 --- a/public/react/src/modules/testpaper/component/Listjihe.js +++ b/public/react/src/modules/testpaper/component/Listjihe.js @@ -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> diff --git a/public/react/src/modules/testpaper/testioncss/testioncss.css b/public/react/src/modules/testpaper/testioncss/testioncss.css index fb4bf231b..6cfb3a724 100644 --- a/public/react/src/modules/testpaper/testioncss/testioncss.css +++ b/public/react/src/modules/testpaper/testioncss/testioncss.css @@ -258,7 +258,13 @@ width:70%; } .w30s{ - width:70%; + width:30%; +} +.w60s{ + width:60%; +} +.w40s{ + width:40%; } .w50s{ width: 50%; From 54474ccbb5706bcaaf51115baf719d0ba93a71f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 2 Jan 2020 10:12:36 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkList.js | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index d60f68b22..35b2a1ee8 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -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,16 +880,17 @@ class CommonWorkList extends Component{ </Spin> : <React.Fragment> - - <Table - className="stageTable" - dataSource={student_works} - columns={columns} - showQuickJumper - pagination={false} - onChange={this.table1handleChange} - loading={loadingstate} - /> + <Spin tip="正在加载..." spinning={loadingstate}> + <Table + className="stageTable" + dataSource={student_works} + columns={columns} + showQuickJumper + pagination={false} + onChange={this.table1handleChange} + // loading={loadingstate} + /> + </Spin> </React.Fragment> } From 2b4162bb77b672fe30d30ebe6e8568e97903041f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 2 Jan 2020 10:16:06 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=A2=98=E5=BA=93=E7=9A=84=E5=A4=9A?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tag_disciplines_controller.rb | 4 +++- app/models/tag_discipline.rb | 4 +++- config/routes.rb | 1 + db/migrate/20200102020737_migrate_item_type.rb | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20200102020737_migrate_item_type.rb diff --git a/app/controllers/tag_disciplines_controller.rb b/app/controllers/tag_disciplines_controller.rb index b527e455d..2650f51eb 100644 --- a/app/controllers/tag_disciplines_controller.rb +++ b/app/controllers/tag_disciplines_controller.rb @@ -2,6 +2,8 @@ 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 \ No newline at end of file diff --git a/app/models/tag_discipline.rb b/app/models/tag_discipline.rb index 24567505e..6be032a58 100644 --- a/app/models/tag_discipline.rb +++ b/app/models/tag_discipline.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 24edd4109..2c60a703e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/db/migrate/20200102020737_migrate_item_type.rb b/db/migrate/20200102020737_migrate_item_type.rb new file mode 100644 index 000000000..d5a247926 --- /dev/null +++ b/db/migrate/20200102020737_migrate_item_type.rb @@ -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