From 17e619fc3ef7b01dbd01eb35be0401b74bc36cf8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 2 Jan 2020 15:50:27 +0800 Subject: [PATCH 1/4] 1 --- app/controllers/hacks_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 0db36556b..f19ef0cea 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -61,7 +61,8 @@ class HacksController < ApplicationController hack_codes = hack.hack_codes.new(hack_code_params) hack_codes.modify_time = Time.now hack_codes.save! - new_item_params = item_params.merge({container: hack, item_type: 'PROGRAM', difficulty: params[:hack][:difficult], user_id: current_user.id}) + logger.info("#############hack_codes:#{hack_codes.id}") + new_item_params = item_params.merge(container: hack, item_type: 'PROGRAM', difficulty: params[:hack][:difficult], user_id: current_user.id) ItemBank.create!(new_item_params) end render_ok({identifier: hack.identifier}) From 4ad1417d6dee47f52bcad7b002ea76919e57a8cf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 2 Jan 2020 15:59:54 +0800 Subject: [PATCH 2/4] 1 --- app/controllers/hacks_controller.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index f19ef0cea..235d8b8b7 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -48,20 +48,16 @@ class HacksController < ApplicationController hack = Hack.new(hack_params) hack.user_id = current_user.id hack.identifier = generate_identifier Hack, 8 - tag_params = - params[:tags].each do |tag| - {tag_discipline_id: tag} - end + tag_params = params[:tags].map{|tag| {tag_discipline_id: tag}} ActiveRecord::Base.transaction do hack.save! # 创建测试集与代码 hack.hack_sets.create!(hack_sets_params) # 新建知识点 - hack.tag_discipline_containers.create!(tag_params) if tag_params + hack.tag_discipline_containers.create!(tag_params) if tag_params.present? hack_codes = hack.hack_codes.new(hack_code_params) hack_codes.modify_time = Time.now hack_codes.save! - logger.info("#############hack_codes:#{hack_codes.id}") new_item_params = item_params.merge(container: hack, item_type: 'PROGRAM', difficulty: params[:hack][:difficult], user_id: current_user.id) ItemBank.create!(new_item_params) end @@ -77,10 +73,7 @@ class HacksController < ApplicationController # 知识点 tag_discipline_ids = @hack.tag_discipline_containers.pluck(:tag_discipline_id) new_tag_ids = params[:tags].to_a - tag_discipline_ids - tag_params = - new_tag_ids.each do |tag| - {tag_discipline_id: tag} - end + tag_params = params[:tags].map{|tag| {tag_discipline_id: tag}} ActiveRecord::Base.transaction do @hack.update_attributes!(hack_params) set_ids = @hack.hack_sets.pluck(:id) From a54da8604a4bbcab6eb7685dc7b12ae62f6f0d66 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 2 Jan 2020 16:02:16 +0800 Subject: [PATCH 3/4] 1 --- app/controllers/hacks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 235d8b8b7..fb4f497bd 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -73,7 +73,7 @@ class HacksController < ApplicationController # 知识点 tag_discipline_ids = @hack.tag_discipline_containers.pluck(:tag_discipline_id) new_tag_ids = params[:tags].to_a - tag_discipline_ids - tag_params = params[:tags].map{|tag| {tag_discipline_id: tag}} + tag_params = new_tag_ids.map{|tag| {tag_discipline_id: tag}} ActiveRecord::Base.transaction do @hack.update_attributes!(hack_params) set_ids = @hack.hack_sets.pluck(:id) From 15b77e667f1049016cd4ff4d91c5ef5094684389 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 16:37:07 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 1 + .../modules/question/component/Contentpart.js | 4 +- .../modules/question/component/Listjihe.js | 96 ++++++++++++------- .../question/questioncss/questioncom.css | 24 ++++- 4 files changed, 83 insertions(+), 42 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index c4d0d3bfe..a3ee4dc80 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -171,6 +171,7 @@ class Question extends Component { defaultActiveKey: key, selectallquestionsonthispages:false, difficulty:null, + page:1 }) var data = { discipline_id:this.state.discipline_id, diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 952c56f2f..bff3c4e6f 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -202,7 +202,9 @@ class Contentpart extends Component { : this.props.Contentdata.items.map((object, index) => { return ( - this.props.getitem_basketss(id)} getitem_baskets={(e)=>this.props.getitem_baskets(e)} diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index fb502fdbd..d31390e75 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -62,7 +62,7 @@ class Listjihe extends Component { render() { let {page,name,nd,chakanjiexibool}=this.state; - let {defaultActiveKey,items}=this.props; + let {defaultActiveKey,items,listjihe}=this.props; ////console.log("Listjihe"); ////console.log(this.props); @@ -70,44 +70,60 @@ class Listjihe extends Component {
{/*顶部*/}
-
+
+ { + this.props.listjihe+1 + }
-
-

难度:{items.difficulty===1?"简单":items.difficulty===2?"适中":items.difficulty===3?"困难":""}

-

题型:{items.item_type==="SINGLE"?"单选题":items.item_type==="MULTIPLE"?"多选题":items.item_type==="JUDGMENT"?"判断题":items.item_type==="PROGRAM"?"编程题":""}

+
+ . +
+
{/*内容*/} -
- +
+ {items.item_type==="JUDGMENT"?

{ - items.item_type==="JUDGMENT"? - items === undefined ||items === null? "" : items.choices.map((object, index) => { - return ( -

- - {object.choice_text} - -

- ) - }) - : - items === undefined ||items === null? "" : items.choices.map((object, index) => { - return ( -

- {tagArray[index]} -

-

- ) - }) + items === undefined ||items === null? "" : items.choices.map((object, index) => { + return ( +

+ + {object.choice_text} + +

+ ) + }) } - -

+

: + items.item_type==="PROGRAM"? +

+

+

+

+

+ : +

+ { + items === undefined ||items === null? "" : items.choices.map((object, index) => { + return ( +

+ {tagArray[index]} +

+

+ ) + }) + } +

+ } +
+
+

难度:{items.difficulty===1?"简单":items.difficulty===2?"适中":items.difficulty===3?"困难":""}

+

题型:{items.item_type==="SINGLE"?"单选题":items.item_type==="MULTIPLE"?"多选题":items.item_type==="JUDGMENT"?"判断题":items.item_type==="PROGRAM"?"编程题":""}

- {/*更新时间*/} -
+

更新时间:{items.update_time}

{ @@ -118,7 +134,7 @@ class Listjihe extends Component { } { items.item_type==="PROGRAM"? -

编程语言:null

+

编程语言:{items.program_attr.language}

:"" } @@ -172,12 +188,18 @@ class Listjihe extends Component {
-

解析:

-

-

- +
+

+

+
+
+

+

+
:"" } diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 6c5e54924..cb8b922a5 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -292,9 +292,10 @@ /*listjihe*/ .listjihetixing{ - color: #888888; - font-size: 12px; - line-height: 17px; + height:17px; + font-size:12px; + color:#888888; + line-height:17px; } .listjihetixings{ @@ -308,12 +309,24 @@ line-height: 17px; } + +.listjihetixingstitsy { + color: #333333; + font-size: 14px; + line-height: 25px; +} + .listjihetixingstits{ color: #333333; font-size: 14px; line-height:19px; margin-top: 19px; } +.listjihetixingstitssy{ + color: #333333; + font-size: 14px; + line-height:19px; +} .updatetimes{ color: #BBBBBB; @@ -655,7 +668,7 @@ } .yldxtit{ - color: #333333; + color: #333333 !important; font-size: 14px; } @@ -741,3 +754,6 @@ .lh35{ line-height: 35px; } +.mt7{ + margin-top: 7px; +}