From a0670114cc656b751335b34c23cb74cc924f845e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 16:43:53 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bankcardnumberverification.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index a9ae5a4b0..034b02882 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -30,7 +30,13 @@ class Bankcardnumberverification extends Component { window.document.title = '竞赛'; // console.log("3获取用户信息"); // console.log(this.props) - this.props.triggerRef(this); + try { + this.props.triggerRef(this); + }catch (e) { + + } + console.log(this.props.bank_account); + //初始化值 if (this.props.bank_account) { this.props.form.setFieldsValue({ @@ -65,11 +71,18 @@ class Bankcardnumberverification extends Component { .then((result) => { try { if (result.data.status == 0) { - // console.log(JSON.stringify(result)); + console.log(values.openingbank); + console.log(values.subbranch); + console.log(values.subbranchs); this.props.form.setFieldsValue({ openingbank: values.openingbank, subbranch: values.subbranch, subbranchs: values.subbranchs, + }); + this.setState({ + openingbank: values.openingbank, + subbranch: values.subbranch, + subbranchs: values.subbranchs, }) try { this.props.showNotification(`提交成功,等待审核!`); From aa6977b1732be2a68ed5017efd4d62b089447f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:00:02 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bankcardnumberverification.js | 98 +++++++++++++------ 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index 034b02882..80d376c33 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -44,6 +44,11 @@ class Bankcardnumberverification extends Component { subbranch: this.props.bank_account.second_bank, subbranchs: this.props.bank_account.card_no, }) + this.setState({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) } } @@ -56,6 +61,50 @@ class Bankcardnumberverification extends Component { }) } componentDidUpdate = (prevProps) => { + if (prevProps.bank_account != this.props.bank_account) { + // console.log("componentDidUpdate"); + // console.log(this.props); + // console.log(prevProps); + ////console.log("Registration"); + ////console.log("componentDidUpdate"); + ////console.log(this.props.user.admin); + try { + if(this.props.bank_account){ + this.props.form.setFieldsValue({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + } + this.setState({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + }catch (e) { + + } + + try { + if(prevProps.bank_account){ + this.props.form.setFieldsValue({ + openingbank:prevProps.bank_account.bank, + subbranch: prevProps.bank_account.second_bank, + subbranchs: prevProps.bank_account.card_no, + }) + + this.setState({ + openingbank: prevProps.bank_account.bank, + subbranch: prevProps.bank_account.second_bank, + subbranchs: prevProps.bank_account.card_no, + }) + } + }catch (e) { + + } + + + } } yhBankstrue = () => { @@ -71,19 +120,24 @@ class Bankcardnumberverification extends Component { .then((result) => { try { if (result.data.status == 0) { - console.log(values.openingbank); - console.log(values.subbranch); - console.log(values.subbranchs); - this.props.form.setFieldsValue({ - openingbank: values.openingbank, - subbranch: values.subbranch, - subbranchs: values.subbranchs, - }); - this.setState({ - openingbank: values.openingbank, - subbranch: values.subbranch, - subbranchs: values.subbranchs, - }) + try { + // console.log(values.openingbank); + // console.log(values.subbranch); + // console.log(values.subbranchs); + this.props.form.setFieldsValue({ + openingbank: values.openingbank, + subbranch: values.subbranch, + subbranchs: values.subbranchs, + }); + this.setState({ + openingbank: values.openingbank, + subbranch: values.subbranch, + subbranchs: values.subbranchs, + }) + }catch (e) { + + } + try { this.props.showNotification(`提交成功,等待审核!`); @@ -116,24 +170,6 @@ class Bankcardnumberverification extends Component { render() { const {getFieldDecorator} = this.props.form; const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state - var bank=""; - if(this.props.bank_account){ - if(this.props.bank_account.bank){ - bank=this.props.bank_account.bank; - } - } - var second_bank =""; - if(this.props.bank_account){ - if(this.props.bank_account.second_bank){ - second_bank=this.props.bank_account.second_bank; - } - } - var card_no=""; - if(this.props.bank_account){ - if(this.props.bank_account.card_no){ - card_no=this.props.bank_account.card_no; - } - } return (
From 9cc27dd394deff7effe9d942259fe9a39ea4fcaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:02:35 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionContentspdfChild/Bankcardnumberverification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index 80d376c33..0b73bd94c 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -119,7 +119,7 @@ class Bankcardnumberverification extends Component { }) .then((result) => { try { - if (result.data.status == 0) { + if (result.data.status === 0) { try { // console.log(values.openingbank); // console.log(values.subbranch); From 62f726b5a57d4383508f0df961b365548fca0308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:10:46 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bankcardnumberverification.js | 70 ++++++++----------- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index 0b73bd94c..d4e57dd7f 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -62,50 +62,38 @@ class Bankcardnumberverification extends Component { } componentDidUpdate = (prevProps) => { if (prevProps.bank_account != this.props.bank_account) { - // console.log("componentDidUpdate"); - // console.log(this.props); - // console.log(prevProps); - ////console.log("Registration"); - ////console.log("componentDidUpdate"); - ////console.log(this.props.user.admin); - try { - if(this.props.bank_account){ - this.props.form.setFieldsValue({ - openingbank: this.props.bank_account.bank, - subbranch: this.props.bank_account.second_bank, - subbranchs: this.props.bank_account.card_no, - }) - } - this.setState({ - openingbank: this.props.bank_account.bank, - subbranch: this.props.bank_account.second_bank, - subbranchs: this.props.bank_account.card_no, - }) - }catch (e) { - + let url = `/competitions/${this.props.match.params.identifier}/prize.json`; + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + let userid; + if(types[1]===undefined){ + userid=this.props.user&&this.props.user.user_id; + }else{ + userid=types[1]; } - - try { - if(prevProps.bank_account){ - this.props.form.setFieldsValue({ - openingbank:prevProps.bank_account.bank, - subbranch: prevProps.bank_account.second_bank, - subbranchs: prevProps.bank_account.card_no, - }) - - this.setState({ - openingbank: prevProps.bank_account.bank, - subbranch: prevProps.bank_account.second_bank, - subbranchs: prevProps.bank_account.card_no, - }) + axios.get(url,{params:{ + user_id:userid, } - }catch (e) { - - } - - + }).then((result) => { + if (result.data) { + try { + this.props.form.setFieldsValue({ + openingbank: result.data.bank_account.bank, + subbranch: result.data.bank_account.second_bank, + subbranchs: result.data.bank_account.card_no, + }); + this.setState({ + openingbank: result.data.bank_account.bank, + subbranch: result.data.bank_account.second_bank, + subbranchs: result.data.bank_account.card_no, + }) + }catch (e) { + } + } + }).catch((error) => { + console.log(error); + }) } - } yhBankstrue = () => { this.props.form.validateFieldsAndScroll((err, values) => { From feb1d4c0ebfc96bd79c7d79feb1f02f10b0e6371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 12 Nov 2019 17:12:01 +0800 Subject: [PATCH 05/12] =?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/courses/boards/index.js | 1 + .../react/src/modules/courses/coursesDetail/CoursesLeftNav.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index 28ba6d65b..3879bbd64 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -174,6 +174,7 @@ class Boards extends Component{ console.log('--- 删除成功') this.clearAllCheck() this.fetchAll(null, 1) + this.props.updataleftNavfun() } }) .catch(function (error) { diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 55f995d72..adb6518ff 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -453,7 +453,7 @@ class Coursesleftnav extends Component{ this.setState({ ModalsType:true, Modalstopval:"隐藏后将不再显示此模块,", - ModalsBottomval:"后续可通过添加模块恢复显示", + ModalsBottomval:"后续可在课堂设置中重新勾选模块恢复显示", ModalSave:()=>this.edithiddens(id), }) }else{ From 757052d7fd147837b6d6a45c355265553f1acf2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:21:07 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bankcardnumberverification.js | 52 ++++++++----------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index d4e57dd7f..061c268c5 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -62,38 +62,30 @@ class Bankcardnumberverification extends Component { } componentDidUpdate = (prevProps) => { if (prevProps.bank_account != this.props.bank_account) { - let url = `/competitions/${this.props.match.params.identifier}/prize.json`; - let query=this.props.location&&this.props.location.search; - const types = query.split('user_id=') - let userid; - if(types[1]===undefined){ - userid=this.props.user&&this.props.user.user_id; - }else{ - userid=types[1]; - } - axios.get(url,{params:{ - user_id:userid, - } - }).then((result) => { - if (result.data) { - try { - this.props.form.setFieldsValue({ - openingbank: result.data.bank_account.bank, - subbranch: result.data.bank_account.second_bank, - subbranchs: result.data.bank_account.card_no, - }); - this.setState({ - openingbank: result.data.bank_account.bank, - subbranch: result.data.bank_account.second_bank, - subbranchs: result.data.bank_account.card_no, - }) - }catch (e) { - } + console.log("componentDidUpdate"); + console.log(this.props); + console.log(prevProps); + ////console.log("Registration"); + ////console.log("componentDidUpdate"); + ////console.log(this.props.user.admin); + try { + if(this.props.bank_account){ + this.props.form.setFieldsValue({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) } - }).catch((error) => { - console.log(error); - }) + this.setState({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + }catch (e) { + + } } + } yhBankstrue = () => { this.props.form.validateFieldsAndScroll((err, values) => { From 88a24b13dbe8ff13921d51ee5fef3a4192ef679b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 12 Nov 2019 17:23:59 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/Competitioncommon/CompetitionCommon.css | 4 ++-- .../CompetitionCommonChild/CompetitionContentsChart.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css index d923c4a28..a21a02eba 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css @@ -424,7 +424,7 @@ .competimgabsolute{ position: absolute; - left: 100px; + left: 86px; bottom: -10px; } .competimgabsolute .ant-badge-count{ @@ -433,6 +433,6 @@ .competimgabsoluteijmg{ position: absolute; - left: 14px; + left: 0px; bottom: 0px; } \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js index 4f13bf213..18128036b 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js @@ -159,6 +159,9 @@ class CompetitionContents extends Component{ font-size: 20px; margin: 0 10px 0 0; } + .ant-badge{ + width:64px; + } ` } From ad5f9ad7b73b501593dedde86900337041ab9daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:26:00 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionContentspdfChild/Bankcardnumberverification.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index 061c268c5..d48ea8fe2 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -63,8 +63,8 @@ class Bankcardnumberverification extends Component { componentDidUpdate = (prevProps) => { if (prevProps.bank_account != this.props.bank_account) { console.log("componentDidUpdate"); - console.log(this.props); - console.log(prevProps); + console.log(this.props);//是新数据 + console.log(prevProps);//是老数据 ////console.log("Registration"); ////console.log("componentDidUpdate"); ////console.log(this.props.user.admin); From dd2ed570e62c804e78d8ba2ee022cb39d57e46ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:29:19 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/Listofworksstudentone.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 580ebc26e..a21bf2107 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1174,7 +1174,7 @@ class Listofworksstudentone extends Component {
{record.late_penalty === "--" ? 迟交扣分:0分 : 迟交扣分:{record.late_penalty}分}
- {record.view_answer_count===null?"":answer_open_evaluation===true?
查看参考答案:{record.view_answer_count}关
:""} + {record.view_answer_count===null?"":answer_open_evaluation===true?"":
查看参考答案:{record.view_answer_count}关
}
{record.finalscore === "--" ? 最终成绩:0分 : 最终成绩:{record.finalscore}分}
@@ -1511,7 +1511,7 @@ class Listofworksstudentone extends Component {
{record.late_penalty === "--" ? 迟交扣分:0分 : 迟交扣分:{record.late_penalty}分}
- {record.view_answer_count===null?"":answer_open_evaluation===true?
查看参考答案:{record.view_answer_count}关
:""} + {record.view_answer_count===null?"":answer_open_evaluation===true?"":
查看参考答案:{record.view_answer_count}关
}
{record.finalscore === "--" ? 最终成绩:0分 : 最终成绩:{record.finalscore}分}
From b2b5edd745c1d249b29ef05bce284599faf87bf5 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 12 Nov 2019 17:33:18 +0800 Subject: [PATCH 10/12] laboratory rep tag --- app/controllers/home_controller.rb | 15 +---------- app/controllers/shixuns_controller.rb | 17 +----------- app/controllers/subjects_controller.rb | 2 +- app/models/laboratory.rb | 36 ++++++++++++++++++++++++++ app/views/shixuns/menus.json.jbuilder | 16 +----------- 5 files changed, 40 insertions(+), 46 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index ba07d42c9..65a1d345a 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -11,20 +11,7 @@ class HomeController < ApplicationController end # 目录分级 - repertoires = Repertoire.includes(sub_repertoires: :tag_repertoires).order("updated_at asc") - @rep_list = [] - repertoires.each do |rep| - - sub_rep_list = [] - rep.sub_repertoires.each do |sub_rep| - tag_rep_list = [] - sub_rep.tag_repertoires.each do |tag_rep| - tag_rep_list << {tag_id: tag_rep.id, tag_name: tag_rep.name} - end - sub_rep_list << {sub_rep_id: sub_rep.id, sub_rep_name: sub_rep.name, tag_rep_list: tag_rep_list} - end - @rep_list << {rep_id: rep.id, rep_name: rep.name, sub_rep_list: sub_rep_list} - end + @rep_list = current_laboratory.shixun_repertoires shixuns = current_laboratory.shixuns subjects = current_laboratory.subjects diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index c1676fbe9..15ee2a712 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -154,22 +154,7 @@ class ShixunsController < ApplicationController ## 获取顶部菜单 def menus - where_sql = ShixunTagRepertoire.where("shixun_tag_repertoires.tag_repertoire_id = tag_repertoires.id") - - # 云上实验室过滤 - unless current_laboratory.main_site? - where_sql = where_sql.joins('JOIN laboratory_shixuns ls ON ls.shixun_id = shixun_tag_repertoires.shixun_id') - end - where_sql = where_sql.select('1').to_sql - tags = TagRepertoire.where("EXISTS(#{where_sql})").distinct.includes(sub_repertoire: :repertoire) - - @tags_map = tags.group_by(&:sub_repertoire) - @sub_reps_map = @tags_map.keys.group_by(&:repertoire) - - # @repertoires = Repertoire.includes(sub_repertoires: [:tag_repertoires]).order("updated_at asc") - # respond_with @repertoires - - render_json + @repertoires = current_laboratory.shixun_repertoires end ## 实训详情 diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index b76db8a20..c1a8b15cd 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -11,7 +11,7 @@ class SubjectsController < ApplicationController include SubjectsHelper def index - @tech_system = Repertoire.where(nil).order("updated_at desc") + @tech_system = current_laboratory.subject_repertoires select = params[:select] # 路径导航类型 reorder = params[:order] || "publish_time" search = params[:search] diff --git a/app/models/laboratory.rb b/app/models/laboratory.rb index 672294b63..0c32114b0 100644 --- a/app/models/laboratory.rb +++ b/app/models/laboratory.rb @@ -47,6 +47,42 @@ class Laboratory < ApplicationRecord main_site? ? Subject.all : Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id }) end + def shixun_repertoires + where_sql = ShixunTagRepertoire.where("shixun_tag_repertoires.tag_repertoire_id = tag_repertoires.id") + + # 云上实验室过滤 + unless main_site? + where_sql = where_sql.joins("JOIN laboratory_shixuns ls ON ls.shixun_id = shixun_tag_repertoires.shixun_id "\ + "AND ls.laboratory_id = #{id}") + end + where_sql = where_sql.select('1').to_sql + tags = TagRepertoire.where("EXISTS(#{where_sql})").distinct.includes(sub_repertoire: :repertoire) + + tags_map = tags.group_by(&:sub_repertoire) + sub_reps_map = tags_map.keys.group_by(&:repertoire) + + sub_reps_map.keys.sort_by(&:updated_at).reverse.map do |repertoire| + repertoire_hash = repertoire.as_json(only: %i[id name]) + repertoire_hash[:sub_repertoires] = + sub_reps_map[repertoire].sort_by(&:updated_at).reverse.map do |sub_repertoire| + sub_repertoire_hash = sub_repertoire.as_json(only: %i[id name]) + sub_repertoire_hash[:tags] = tags_map[sub_repertoire].sort_by(&:updated_at).reverse.map { |tag| tag.as_json(only: %i[id name]) } + sub_repertoire_hash + end + repertoire_hash + end + end + + def subject_repertoires + exist_sql = Subject.where('subjects.repertoire_id = repertoires.id') + + unless main_site? + exist_sql = exist_sql.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id }) + end + + Repertoire.where("EXISTS(#{exist_sql.select('1').to_sql})").order(updated_at: :desc).distinct + end + # 是否为主站 def main_site? id == 1 diff --git a/app/views/shixuns/menus.json.jbuilder b/app/views/shixuns/menus.json.jbuilder index 491ba5f05..5f107da3a 100644 --- a/app/views/shixuns/menus.json.jbuilder +++ b/app/views/shixuns/menus.json.jbuilder @@ -30,19 +30,5 @@ # end # end -json.array! @sub_reps_map.keys.sort_by(&:updated_at).reverse do |rep| - json.extract! rep, :id, :name - - json.sub_repertoires do - json.array! @sub_reps_map[rep].sort_by(&:updated_at).reverse do |sub_rep| - json.extract! sub_rep, :id, :name - - json.tags do - json.array! @tags_map[sub_rep].sort_by(&:updated_at).reverse do |tag| - json.extract! tag, :id, :name - end - end - end - end -end +json.array! @repertoires From 1fcfa538e4e687b18cf815b3a1d35877b5498993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:41:24 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionContentspdfpeopledata.js | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index f9830dbac..bffa4711a 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -537,32 +537,41 @@ class CompetitionContentspdfpeopledata extends Component { > : -
-
-

签/领/开户行及银行卡号

-

为保障奖金的及时发放,请队长如实填写你名下的银行卡信息

-
- { - bank_account && bank_account ? -
-
-

开户行:

-

{bank_account && bank_account.bank}

-
-
-

支行:

-

{bank_account && bank_account.second_bank}

-
-
-

账号:

-

{bank_account && bank_account.card_no}

-
+ admins===true? + this.hideUpdating(i)} + getdata={(id) => this.getdata(id)} + GetawardinformationAPI={() => this.GetawardinformationAPI()} + bank_account={this.state.bank_account} + > + : +
+
+

签/领/开户行及银行卡号

+

为保障奖金的及时发放,请队长如实填写你名下的银行卡信息

- : - "" - } + { + bank_account && bank_account ? +
+
+

开户行:

+

{bank_account && bank_account.bank}

+
+
+

支行:

+

{bank_account && bank_account.second_bank}

+
+
+

账号:

+

{bank_account && bank_account.card_no}

+
+
+ : + "" + } + +
-
}
From b9b61100f5fc9e28850e4698420dd83cb7129976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 12 Nov 2019 17:42:39 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionContentspdfpeopledata.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index bffa4711a..1afbf16a7 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -528,14 +528,12 @@ class CompetitionContentspdfpeopledata extends Component {
{ bank_account_editable === true ? - this.hideUpdating(i)} getdata={(id) => this.getdata(id)} GetawardinformationAPI={() => this.GetawardinformationAPI()} bank_account={this.state.bank_account} > - : admins===true? - } -
: