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

dev_ec
hjm 5 years ago
commit 8fd076eec5

@ -657,7 +657,8 @@ class GamesController < ApplicationController
# 高性能取上一关、下一关 # 高性能取上一关、下一关
prev_game = @game.prev_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) prev_game = @game.prev_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position)
next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) if had_passed next_game = @game.next_game(@shixun.id, @game.myshixun_id, game_challenge.position) if had_passed
next_game.update_column(:status, 0) if next_game.present? && next_game.status == 3
# 高性能取上一关、下一关 # 高性能取上一关、下一关
#prev_game = Game.prev_identifier(@shixun.id, @game.myshixun_id, game_challenge.position) #prev_game = Game.prev_identifier(@shixun.id, @game.myshixun_id, game_challenge.position)
@ -670,7 +671,7 @@ class GamesController < ApplicationController
choose_correct_num: choose_correct_num, choose_correct_num: choose_correct_num,
test_sets: test_sets, test_sets: test_sets,
prev_game: prev_game, prev_game: prev_game,
next_game: next_game} next_game: next_game&.identifier}
rescue Exception => e rescue Exception => e
uid_logger("choose build failed #{e.message}") uid_logger("choose build failed #{e.message}")
@result = [status: -1, contents: "#{e.message}"] @result = [status: -1, contents: "#{e.message}"]

@ -4,5 +4,12 @@ class Users::ApplyAuthenticationForm
attr_accessor :name, :id_number, :upload_image attr_accessor :name, :id_number, :upload_image
validates :name, presence: true validates :name, presence: true
validates :id_number, presence: true validate :validate_ID_number
def validate_ID_number
unless id_number =~ User::VALID_NUMBER_REGEX
raise("身份证格式不对")
end
end
end end

@ -20,6 +20,8 @@ class User < ApplicationRecord
VALID_EMAIL_REGEX = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/i VALID_EMAIL_REGEX = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/i
VALID_PHONE_REGEX = /^1\d{10}$/ VALID_PHONE_REGEX = /^1\d{10}$/
# 身份证
VALID_NUMBER_REGEX = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
LOGIN_LENGTH_LIMIT = 30 LOGIN_LENGTH_LIMIT = 30
MAIL_LENGTH_LMIT = 60 MAIL_LENGTH_LMIT = 60
@ -162,7 +164,8 @@ class User < ApplicationRecord
# validates_format_of :mail, with: VALID_EMAIL_REGEX, multiline: true # validates_format_of :mail, with: VALID_EMAIL_REGEX, multiline: true
# validates_format_of :phone, with: VALID_PHONE_REGEX, multiline: true # validates_format_of :phone, with: VALID_PHONE_REGEX, multiline: true
validate :validate_password_length validate :validate_password_length
#validate :validate_ID_number
#validates_format_of :ID_number, with: VALID_NUMBER_REGEX, multiline: true, message: "身份证号格式不对"
# validates :nickname, presence: true, length: { maximum: 10 } # validates :nickname, presence: true, length: { maximum: 10 }
# validates :lastname, presence: true # validates :lastname, presence: true

@ -25,10 +25,10 @@ class Users::ApplyAuthenticationService < ApplicationService
user.apply_user_authentication.create!(auth_type: 1, status: 0) user.apply_user_authentication.create!(auth_type: 1, status: 0)
move_image_file! unless params[:upload_image].to_s == 'false' move_image_file! unless params[:upload_image].to_s == 'false'
sms_notify_admin
end end
sms_notify_admin
user user
end end

@ -37,13 +37,9 @@ class Users::ApplyProfessionalAuthService < ApplicationService
user.apply_user_authentication.create!(auth_type: 2, status: 0) user.apply_user_authentication.create!(auth_type: 2, status: 0)
move_image_file! unless params[:upload_image].to_s == 'false' move_image_file! unless params[:upload_image].to_s == 'false'
sms_cache = Rails.cache.read("apply_pro_certification")
if sms_cache.nil?
sms_notify_admin
Rails.cache.write("apply_pro_certification", 1, expires_in: 5.minutes)
end
end end
sms_notify_admin
end end
private private
@ -61,7 +57,11 @@ class Users::ApplyProfessionalAuthService < ApplicationService
end end
def sms_notify_admin def sms_notify_admin
Educoder::Sms.notify_admin(send_type: 'apply_pro_certification') sms_cache = Rails.cache.read('apply_pro_certification')
if sms_cache.nil?
Educoder::Sms.notify_admin(send_type: 'apply_pro_certification')
Rails.cache.write('apply_pro_certification', 1, expires_in: 5.minutes)
end
rescue => ex rescue => ex
Util.logger_error(ex) Util.logger_error(ex)
end end

@ -6,15 +6,26 @@ class ChangeUserP02389416Exercise < ActiveRecord::Migration[5.2]
# 分数分别为2分2分5分2分2分2分2分2分 合计19分 # 分数分别为2分2分5分2分2分2分2分2分 合计19分
question_ids = [37411,37414,37417,37418,37419,37423,37424,37429] question_ids = [37411,37414,37417,37418,37419,37423,37424,37429]
choice_ids = [117788,117797,117806,117809,117811,117816,117818,117828] choice_ids = [117788,117797,117806,117809,117811,117816,117818,117828]
question_scores = [2,2,5,2,2,2,2,2]
question_ids.each_with_index do |q, index| question_ids.each_with_index do |q, index|
ExerciseAnswer.create(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index]) ex_exercise_user = ExerciseAnswer.where(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index])
if ex_exercise_user.exists?
ex_exercise_user.first.update_attribute(:score,question_scores[index])
else
ExerciseAnswer.create(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index], score: question_scores[index])
end
end end
ex_user = ExerciseUser.where(user_id: 45442, exercise_id: 2561)&.first ex_user = ExerciseUser.where(user_id: 45442, exercise_id: 2561)&.first
if ex_user.present? if ex_user.present?
obj_score = ex_user.objective_score.to_i + 19 if ex_user.score > 65 || ex_user.objective_score > 65
total_score = ex_user.score.to_i + 19 ex_user.update_attributes(score: 65, objective_score: 65)
else
obj_score = ex_user.objective_score.to_i + 19
total_score = ex_user.score.to_i + 19
ex_user.update_attributes(score: total_score, objective_score: obj_score)
end
ex_user.update_attributes(score: total_score, objective_score: obj_score)
end end
puts "====> end_to_create user exercise_answer" puts "====> end_to_create user exercise_answer"

@ -32,7 +32,7 @@ module.exports = {
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
// devtool: "cheap-module-eval-source-map", // devtool: "cheap-module-eval-source-map",
// 开启调试 // 开启调试
devtool: "source-map", // 开启调试 //devtool: "source-map", // 开启调试
// These are the "entry points" to our application. // These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle. // This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS. // The first two entry points enable "hot" CSS and auto-refreshes for JS.

@ -79,6 +79,7 @@
"react-url-query": "^1.4.0", "react-url-query": "^1.4.0",
"redux": "^4.0.0", "redux": "^4.0.0",
"redux-thunk": "2.3.0", "redux-thunk": "2.3.0",
"rsuite": "^4.0.1",
"store": "^2.0.12", "store": "^2.0.12",
"style-loader": "0.19.0", "style-loader": "0.19.0",
"styled-components": "^4.1.3", "styled-components": "^4.1.3",

@ -94,7 +94,19 @@ class ModulationModal extends Component{
<li style={{height:"20px",lineHeight:"20px"}}><span className={textareavaltype===true?"color-red":"none"}>原因不能为空</span></li> <li style={{height:"20px",lineHeight:"20px"}}><span className={textareavaltype===true?"color-red":"none"}>原因不能为空</span></li>
</div> </div>
<li>
<style>
{
`
.pdl10{
padding-left:10px;
}
`
}
</style>
<li className={"pdl10"}>
<Input style={{ <Input style={{
width: '20%', width: '20%',
}} }}

@ -116,6 +116,11 @@ class YslDetailCards extends Component{
} }
Pathlisteditundefined=()=>{
this.setState({
pathlistedit:undefined
})
};
hidestartshixunsreplace=(url)=>{ hidestartshixunsreplace=(url)=>{
this.setState({ this.setState({
isSpin:true, isSpin:true,
@ -521,6 +526,7 @@ class YslDetailCards extends Component{
ysldetailcards={"ysldetailcards"} ysldetailcards={"ysldetailcards"}
pathid={subject_id} pathid={subject_id}
coursesId={pathid} coursesId={pathid}
Pathlisteditundefined={this.Pathlisteditundefined}
></DetailCardsEditAndEdit> ></DetailCardsEditAndEdit>
:"" :""
} }

@ -96,7 +96,7 @@ class Exercisetablesmubus extends Component {
'0%': '#29BD8B', '0%': '#29BD8B',
'100%': '#29BD8B', '100%': '#29BD8B',
}} }}
percent={record.max_score*100} showInfo={false}/></div><div className={"fr"}>{record.max_score*100}%</div></span>} percent={(record.max_score*100).toFixed()} showInfo={false}/></div><div className={"fr"}>{(record.max_score*100).toFixed()}%</div></span>}
</span> </span>
), ),
}]; }];

@ -337,7 +337,7 @@ class GraduationAcross extends Component{
chooseCount, chooseCount,
chooseId, chooseId,
AcrossTeamIds, AcrossTeamIds,
searchValue,showflag searchValue,showflag,
} = this.state; } = this.state;
let { modalVisible } = this.props; let { modalVisible } = this.props;
let courseId = this.props.match.params.coursesId; let courseId = this.props.match.params.coursesId;
@ -372,7 +372,8 @@ class GraduationAcross extends Component{
// 筛选下拉列表 // 筛选下拉列表
const teacherList = searchValue ? teachers&&teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers; const teacherList = searchValue ? teachers&&teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers;
const course_groupsList = searchValue ? course_groups&&course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups; const course_groupsList = searchValue ? course_groups&&course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups;
return( const graduation_groupslist =searchValue ? graduation_groups&&graduation_groups.filter(e=>e.name.indexOf(searchValue)>-1) : graduation_groups;
return(
<Modal <Modal
className={"AcrossModal"} className={"AcrossModal"}
title={"交叉评阅设置"} title={"交叉评阅设置"}
@ -471,9 +472,9 @@ class GraduationAcross extends Component{
<span className={"fl mt5"}><span className={"color-orange"}>分配</span>{ comment_status && comment_status == 2 ? "":""}</span> <span className={"fl mt5"}><span className={"color-orange"}>分配</span>{ comment_status && comment_status == 2 ? "":""}</span>
<span className={"fl"} style={{height:"32px"}} id="selectTags"> <span className={"fl"} style={{height:"32px"}} id="selectTags">
<Select <Select
mode="tags" mode="multiple"
placeholder={ comment_status && comment_status == 2 ? "请选择老师":"请选择答辩组"} placeholder={ comment_status && comment_status == 2 ? "请选择老师":"请选择答辩组"}
value={AcrossTeamIds} // value={AcrossTeamIds}
style={{width:"300px",height:"30px"}} style={{width:"300px",height:"30px"}}
onChange={this.changeSelect} onChange={this.changeSelect}
open={showflag} open={showflag}
@ -501,7 +502,7 @@ class GraduationAcross extends Component{
></Input> ></Input>
</div>:""} </div>:""}
{comment_status == 2 &&teacherList&&teacherList.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,teacherList)}>全选</Checkbox>:""} {comment_status == 2 &&teacherList&&teacherList.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,teacherList)}>全选</Checkbox>:""}
{comment_status != 2 &&course_groupsList&&course_groupsList.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,course_groupsList)}>全选</Checkbox>:""} {comment_status != 2 &&graduation_groupslist&&graduation_groupslist.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,graduation_groupslist)}>全选</Checkbox>:""}
{menu} {menu}
<Divider style={{ margin: '4px 0 0' }} /> <Divider style={{ margin: '4px 0 0' }} />
<div style={{ padding: '8px 12px', cursor: 'pointer' }}> <div style={{ padding: '8px 12px', cursor: 'pointer' }}>
@ -515,7 +516,7 @@ class GraduationAcross extends Component{
teacherList && teacherList.map((i,key)=>{ teacherList && teacherList.map((i,key)=>{
return <Option key={i.user_id} value={String(i.user_id)}>{i.user_name}</Option> return <Option key={i.user_id} value={String(i.user_id)}>{i.user_name}</Option>
}): }):
course_groupsList && course_groupsList.map((i,key)=>{ graduation_groupslist && graduation_groupslist.map((i,key)=>{
return <Option key={i.id} value={String(i.id)}>{i.name}</Option> return <Option key={i.id} value={String(i.id)}>{i.name}</Option>
}) })
} }

@ -334,24 +334,22 @@ class GraduationTasksSubmitedit extends Component{
} }
delecttask_status=(id,student_id)=>{ delecttask_status=(id)=>{
let newid=id===undefined||id===null?student_id:id;
let{selectmemberslist,task_status}=this.state; let{selectmemberslist,task_status}=this.state;
let newlist=task_status; let newlist=task_status;
let selects=selectmemberslist; let selects=selectmemberslist;
for(var i=0; i<newlist.length; i++){ for(var i=0; i<newlist.length; i++){
if(newlist[i]===newid){ if(newlist[i]===id){
newlist.splice(i,1) newlist.splice(i,1)
} }
} }
for(var z=0; z<selects.length; z++){ for(var z=0; z<selects.length; z++){
if(selects[z].user_id===newid){ if(selects[z].user_id===id){
selects.splice(z,1) selects.splice(z,1)
}else if(selects[z].student_id===newid){ }
selects.splice(z,1)
}
} }
console.log(newlist) console.log(newlist)
console.log(selects) console.log(selects)
@ -384,10 +382,6 @@ class GraduationTasksSubmitedit extends Component{
let userids=[]; let userids=[];
for(var list of selectmemberslist){ for(var list of selectmemberslist){
if(list.student_id!=undefined&&list.student_id!=null){
userids.push(list.student_id)
}
if(list.user_id!=undefined&&list.user_id!=null){ if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id) userids.push(list.user_id)
} }
@ -812,7 +806,7 @@ class GraduationTasksSubmitedit extends Component{
{key > 0 ? {key > 0 ?
<div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"} <div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"}
style={{marginTop: '-4px'}} style={{marginTop: '-4px'}}
onClick={() => this.delecttask_status(item.user_id,item.student_id)}></i> onClick={() => this.delecttask_status(item.user_id)}></i>
</div> : ""} </div> : ""}
<div className={"both"}></div> <div className={"both"}></div>
</div> </div>

@ -535,10 +535,12 @@ class GraduationTaskssettinglist extends Component{
// console.log(result) // console.log(result)
if(result.data.status===0){ if(result.data.status===0){
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page);
this.props.showNotification(result.data.message);
this.cancelmodel();
this.setState({ this.setState({
Modalstype:true, Modalstype:false,
Allocationtype:false, Allocationtype:false,
Modalstopval:result.data.message, // Modalstopval:result.data.message,
ModalSave:this.cancelmodel, ModalSave:this.cancelmodel,
}) })
} }
@ -866,10 +868,10 @@ class GraduationTaskssettinglist extends Component{
{tag.name} {tag.name}
</a> </a>
: :
<p style={{color:tag.name==="调分"?"#000":'#4CACFF',padding:"0px 5px"}} <span style={{color:tag.name==="调分"?"#000":'#4CACFF',padding:"0px 5px"}}
onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}> onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}>
{tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":tag.name} {tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":tag.name}
</p> </span>
} }
</Tooltip> </Tooltip>
} }
@ -972,7 +974,7 @@ class GraduationTaskssettinglist extends Component{
white-space: nowrap; white-space: nowrap;
} }
.ant-table-tbody>tr>td, .ant-table-thead>tr>th{ .ant-table-tbody>tr>td, .ant-table-thead>tr>th{
padding:16px 8px; padding:16px 5px;
} }
` `
} }

@ -309,7 +309,13 @@ class DetailCards extends Component{
this.setState({ this.setState({
startshixunCombattype:false startshixunCombattype:false
}) })
} };
Pathlisteditundefined=()=>{
this.setState({
pathlistedit:undefined
})
};
render(){ render(){
@ -502,19 +508,16 @@ class DetailCards extends Component{
</div> </div>
</div> </div>
} }
<DetailCardsEditAndEdit
idsum={idsum}
<DetailCardsEditAndEdit keys={key}
idsum={idsum} pathCardsedittype={pathCardsedittype}
keys={key} updatapathCardsedits={this.updatapathCardsedit}
pathCardsedittype={pathCardsedittype} pathlisteditlist={pathlistedit}
updatapathCardsedits={this.updatapathCardsedit} stageid={item.stage_id}
pathlisteditlist={pathlistedit} pathid={pathid}
stageid={item.stage_id} Pathlisteditundefined={this.Pathlisteditundefined}
pathid={pathid} ></DetailCardsEditAndEdit>
></DetailCardsEditAndEdit>
</div> </div>
) )
}) })

@ -389,6 +389,7 @@ class DetailCardsEditAndAdd extends Component{
</style>:""} </style>:""}
{selectShixun===true?<NewShixunModel {selectShixun===true?<NewShixunModel
NewShixunModelType={selectShixun} NewShixunModelType={selectShixun}
type={'shixuns'}
hideNewShixunModelType={this.cloasShixunBox} hideNewShixunModelType={this.cloasShixunBox}
pathShixun={this.clickShixunchoose} pathShixun={this.clickShixunchoose}
{...this.props} {...this.props}

@ -93,22 +93,27 @@ class DetailCardsEditAndEdit extends Component{
}) })
} }
componentDidMount(){
}
componentWillReceiveProps(nextProps, nextState) { componentWillReceiveProps(nextProps, nextState) {
if(nextProps.pathlisteditlist!=undefined){ if(nextProps.pathlisteditlist!=undefined){
let list=[] let list=[]
for(var i=0; i<nextProps.pathlisteditlist.shixuns_list.length; i++){ for(var i=0; i<nextProps.pathlisteditlist.shixuns_list.length; i++){
list.push(nextProps.pathlisteditlist.shixuns_list[i].shixun_id) list.push(nextProps.pathlisteditlist.shixuns_list[i].shixun_id)
} }
this.setState({ // console.log("DetailCardsEditAndEdit");
// console.log("componentWillReceiveProps(nextProps, nextState)");
// console.log("nextProps.pathlisteditlist.stage_description");
this.setState({
shixuns_listedit:nextProps.pathlisteditlist.shixuns_list, shixuns_listedit:nextProps.pathlisteditlist.shixuns_list,
shixuns_listeditlist:list, shixuns_listeditlist:list,
stage_name:nextProps.pathlisteditlist.stage_name, stage_name:nextProps.pathlisteditlist.stage_name,
stage_description:nextProps.pathlisteditlist.stage_description, stage_description:nextProps.pathlisteditlist.stage_description,
stageid:nextProps.stageid stageid:nextProps.stageid
}) });
this.props.Pathlisteditundefined();
} }
} }
@ -123,7 +128,7 @@ class DetailCardsEditAndEdit extends Component{
} }
updatastage_description=(e)=>{ updatastage_description=(e)=>{
//输入数据绑定
this.setState({ this.setState({
stage_description:e.target.value stage_description:e.target.value
}) })
@ -395,6 +400,7 @@ class DetailCardsEditAndEdit extends Component{
{selectShixun===true?<NewShixunModel {selectShixun===true?<NewShixunModel
NewShixunModelType={selectShixun} NewShixunModelType={selectShixun}
type={'shixuns'}
hideNewShixunModelType={this.cloasShixunBox} hideNewShixunModelType={this.cloasShixunBox}
pathShixun={this.clickShixunchoose} pathShixun={this.clickShixunchoose}
{...this.props} {...this.props}

Loading…
Cancel
Save