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

dev_home
caishi 5 years ago
commit 310862d62e

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

@ -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
## 实训详情

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

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

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

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

@ -159,6 +159,9 @@ class CompetitionContents extends Component{
font-size: 20px;
margin: 0 10px 0 0;
}
.ant-badge{
width:64px;
}
`
}
</style>

@ -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({
@ -38,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,
})
}
}
@ -50,6 +61,30 @@ 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) {
}
}
}
yhBankstrue = () => {
@ -64,13 +99,25 @@ class Bankcardnumberverification extends Component {
})
.then((result) => {
try {
if (result.data.status == 0) {
// console.log(JSON.stringify(result));
this.props.form.setFieldsValue({
openingbank: values.openingbank,
subbranch: values.subbranch,
subbranchs: values.subbranchs,
})
if (result.data.status === 0) {
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(`提交成功,等待审核!`);
@ -103,24 +150,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 (
<div>
<div className="flexdirections mt36">

@ -528,43 +528,48 @@ class CompetitionContentspdfpeopledata extends Component {
<div>
{
bank_account_editable === true ?
<Bankcardnumberverifications triggerRef={this.bindRef} {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}
GetawardinformationAPI={() => this.GetawardinformationAPI()}
bank_account={this.state.bank_account}
></Bankcardnumberverifications>
:
<div>
<div className="flexdirections mt36">
<p className="fontcolorsyslhei font-16">//开户行及银行卡号</p>
<p className="fontcolorsyslhui font-14 ml11">为保障奖金的及时发放请队长如实填写你名下的银行卡信息</p>
</div>
{
bank_account && bank_account ?
<div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56">开户行</p>
<p className="fontcolorsyslhei">{bank_account && bank_account.bank}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56" style={{textAlign: "right"}}>支行</p>
<p className="fontcolorsyslhei">{bank_account && bank_account.second_bank}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56" style={{textAlign: "right"}}>账号</p>
<p className="fontcolorsyslhei"> {bank_account && bank_account.card_no}</p>
</div>
admins===true?
<Bankcardnumberverifications triggerRef={this.bindRef} {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}
GetawardinformationAPI={() => this.GetawardinformationAPI()}
bank_account={this.state.bank_account}
></Bankcardnumberverifications>
:
<div>
<div className="flexdirections mt36">
<p className="fontcolorsyslhei font-16">//开户行及银行卡号</p>
<p className="fontcolorsyslhui font-14 ml11">为保障奖金的及时发放请队长如实填写你名下的银行卡信息</p>
</div>
:
""
}
</div>
{
bank_account && bank_account ?
<div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56">开户行</p>
<p className="fontcolorsyslhei">{bank_account && bank_account.bank}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56" style={{textAlign: "right"}}>支行</p>
<p className="fontcolorsyslhei">{bank_account && bank_account.second_bank}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56" style={{textAlign: "right"}}>账号</p>
<p className="fontcolorsyslhei"> {bank_account && bank_account.card_no}</p>
</div>
</div>
:
""
}
</div>
}
</div>
:
<div>

@ -174,6 +174,7 @@ class Boards extends Component{
console.log('--- 删除成功')
this.clearAllCheck()
this.fetchAll(null, 1)
this.props.updataleftNavfun()
}
})
.catch(function (error) {

@ -453,7 +453,7 @@ class Coursesleftnav extends Component{
this.setState({
ModalsType:true,
Modalstopval:"隐藏后将不再显示此模块,",
ModalsBottomval:"后续可通过添加模块恢复显示",
ModalsBottomval:"后续可在课堂设置中重新勾选模块恢复显示",
ModalSave:()=>this.edithiddens(id),
})
}else{

@ -1174,7 +1174,7 @@ class Listofworksstudentone extends Component {
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div>
{record.view_answer_count===null?"":answer_open_evaluation===true?<div>查看参考答案{record.view_answer_count}</div>:""}
{record.view_answer_count===null?"":answer_open_evaluation===true?"":<div>查看参考答案{record.view_answer_count}</div>}
<div>{record.finalscore === "--" ? <span>最终成绩0</span> :
<span>最终成绩{record.finalscore}</span>}</div>
@ -1511,7 +1511,7 @@ class Listofworksstudentone extends Component {
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div>
{record.view_answer_count===null?"":answer_open_evaluation===true?<div>查看参考答案{record.view_answer_count}</div>:""}
{record.view_answer_count===null?"":answer_open_evaluation===true?"":<div>查看参考答案{record.view_answer_count}</div>}
<div>{record.finalscore === "--" ? <span>最终成绩0</span> :
<span>最终成绩{record.finalscore}</span>}</div>

Loading…
Cancel
Save