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

dev_home
caishi 6 years ago
commit 310862d62e

@ -11,20 +11,7 @@ class HomeController < ApplicationController
end end
# 目录分级 # 目录分级
repertoires = Repertoire.includes(sub_repertoires: :tag_repertoires).order("updated_at asc") @rep_list = current_laboratory.shixun_repertoires
@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
shixuns = current_laboratory.shixuns shixuns = current_laboratory.shixuns
subjects = current_laboratory.subjects subjects = current_laboratory.subjects

@ -154,22 +154,7 @@ class ShixunsController < ApplicationController
## 获取顶部菜单 ## 获取顶部菜单
def menus def menus
where_sql = ShixunTagRepertoire.where("shixun_tag_repertoires.tag_repertoire_id = tag_repertoires.id") @repertoires = current_laboratory.shixun_repertoires
# 云上实验室过滤
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
end end
## 实训详情 ## 实训详情

@ -11,7 +11,7 @@ class SubjectsController < ApplicationController
include SubjectsHelper include SubjectsHelper
def index def index
@tech_system = Repertoire.where(nil).order("updated_at desc") @tech_system = current_laboratory.subject_repertoires
select = params[:select] # 路径导航类型 select = params[:select] # 路径导航类型
reorder = params[:order] || "publish_time" reorder = params[:order] || "publish_time"
search = params[:search] search = params[:search]

@ -47,6 +47,42 @@ class Laboratory < ApplicationRecord
main_site? ? Subject.all : Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id }) main_site? ? Subject.all : Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id })
end 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? def main_site?
id == 1 id == 1

@ -30,19 +30,5 @@
# end # end
# end # end
json.array! @sub_reps_map.keys.sort_by(&:updated_at).reverse do |rep| json.array! @repertoires
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

@ -424,7 +424,7 @@
.competimgabsolute{ .competimgabsolute{
position: absolute; position: absolute;
left: 100px; left: 86px;
bottom: -10px; bottom: -10px;
} }
.competimgabsolute .ant-badge-count{ .competimgabsolute .ant-badge-count{
@ -433,6 +433,6 @@
.competimgabsoluteijmg{ .competimgabsoluteijmg{
position: absolute; position: absolute;
left: 14px; left: 0px;
bottom: 0px; bottom: 0px;
} }

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

@ -30,7 +30,13 @@ class Bankcardnumberverification extends Component {
window.document.title = '竞赛'; window.document.title = '竞赛';
// console.log("3获取用户信息"); // console.log("3获取用户信息");
// console.log(this.props) // 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) { if (this.props.bank_account) {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
@ -38,6 +44,11 @@ class Bankcardnumberverification extends Component {
subbranch: this.props.bank_account.second_bank, subbranch: this.props.bank_account.second_bank,
subbranchs: this.props.bank_account.card_no, 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) => { 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 = () => { yhBankstrue = () => {
@ -64,13 +99,25 @@ class Bankcardnumberverification extends Component {
}) })
.then((result) => { .then((result) => {
try { try {
if (result.data.status == 0) { if (result.data.status === 0) {
// console.log(JSON.stringify(result)); try {
this.props.form.setFieldsValue({ // console.log(values.openingbank);
openingbank: values.openingbank, // console.log(values.subbranch);
subbranch: values.subbranch, // console.log(values.subbranchs);
subbranchs: 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 { try {
this.props.showNotification(`提交成功,等待审核!`); this.props.showNotification(`提交成功,等待审核!`);
@ -103,24 +150,6 @@ class Bankcardnumberverification extends Component {
render() { render() {
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state 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 ( return (
<div> <div>
<div className="flexdirections mt36"> <div className="flexdirections mt36">

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

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

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

@ -1174,7 +1174,7 @@ class Listofworksstudentone extends Component {
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> : <div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div> <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> : <div>{record.finalscore === "--" ? <span>最终成绩0</span> :
<span>最终成绩{record.finalscore}</span>}</div> <span>最终成绩{record.finalscore}</span>}</div>
@ -1511,7 +1511,7 @@ class Listofworksstudentone extends Component {
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> : <div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div> <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> : <div>{record.finalscore === "--" ? <span>最终成绩0</span> :
<span>最终成绩{record.finalscore}</span>}</div> <span>最终成绩{record.finalscore}</span>}</div>

Loading…
Cancel
Save