diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 0db36556b..fb4f497bd 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -48,20 +48,17 @@ 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! - new_item_params = item_params.merge({container: hack, item_type: 'PROGRAM', difficulty: params[:hack][:difficult], user_id: current_user.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}) @@ -76,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 = 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) 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; +}