Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_home
杨树明 5 years ago
commit e31e2fa55f

@ -1539,7 +1539,7 @@ class CoursesController < ApplicationController
end end
def course_statistics course, max_exp, limit def course_statistics course, max_exp, limit
max_rate = 20.0 / max_exp max_rate = max_exp.nil? ? 0 : 20.0 / max_exp
sql_select = %Q{ SELECT a.*, (message_num*0.2 + message_reply_num*0.1 + resource_num*0.5 + homework_journal_num*0.1 + graduation_num + sql_select = %Q{ SELECT a.*, (message_num*0.2 + message_reply_num*0.1 + resource_num*0.5 + homework_journal_num*0.1 + graduation_num +
homework_num + exercise_num + poll_num*0.7 + exercise_score * 0.7 + graduation_score * 0.7 + homework_score * 0.7 + exp*#{max_rate}) homework_num + exercise_num + poll_num*0.7 + exercise_score * 0.7 + graduation_score * 0.7 + homework_score * 0.7 + exp*#{max_rate})

@ -28,6 +28,7 @@ class AccountBasicEditItem extends Component {
label="职业" label="职业"
className="formItemInline fl" className="formItemInline fl"
> >
<ConditionToolTip title={() => (<div><p>已提交职业认证</p><p><a href="/account/certification" className="color-blue"></a></p></div>)} condition= { professionalFlag }>
{getFieldDecorator('job', { {getFieldDecorator('job', {
rules: [{ rules: [{
initialValue:"teacher", initialValue:"teacher",
@ -41,6 +42,7 @@ class AccountBasicEditItem extends Component {
<Option value="professional">专业人士</Option> <Option value="professional">专业人士</Option>
</Select> </Select>
)} )}
</ConditionToolTip>
</Form.Item> </Form.Item>
{ {
identity && identity=="student" && identity && identity=="student" &&
@ -50,6 +52,7 @@ class AccountBasicEditItem extends Component {
style={{ 'margin-top': '3px'}} style={{ 'margin-top': '3px'}}
// style={{display:identity && identity=="student" ? "block":"none"}} // style={{display:identity && identity=="student" ? "block":"none"}}
> >
<ConditionToolTip title={() => (<div><p>已提交职业认证</p><p><a href="/account/certification" className="color-blue"></a></p></div>)} condition= { professionalFlag }>
{getFieldDecorator('student_No', { {getFieldDecorator('student_No', {
rules: [{ rules: [{
required: true, required: true,
@ -58,6 +61,7 @@ class AccountBasicEditItem extends Component {
})( })(
<Input type="text" placeholder="请输入学号" style={{width:"190px"}} disabled={professionalFlag}></Input> <Input type="text" placeholder="请输入学号" style={{width:"190px"}} disabled={professionalFlag}></Input>
)} )}
</ConditionToolTip>
</Form.Item> </Form.Item>
} }
{ {
@ -67,6 +71,7 @@ class AccountBasicEditItem extends Component {
className="formItemInline fl" className="formItemInline fl"
// style={{display:identity && identity=="teacher" ? "block":"none"}} // style={{display:identity && identity=="teacher" ? "block":"none"}}
> >
<ConditionToolTip title={() => (<div><p>已提交职业认证</p><p><a href="/account/certification" className="color-blue"></a></p></div>)} condition= { professionalFlag }>
{getFieldDecorator('job1', { {getFieldDecorator('job1', {
rules: [{ rules: [{
initialValue:"教授", initialValue:"教授",
@ -81,6 +86,7 @@ class AccountBasicEditItem extends Component {
<Option value="助教">助教</Option> <Option value="助教">助教</Option>
</Select> </Select>
)} )}
</ConditionToolTip>
</Form.Item> </Form.Item>
} }
{ {
@ -90,6 +96,7 @@ class AccountBasicEditItem extends Component {
className="formItemInline fl mb0" className="formItemInline fl mb0"
// style={{display:identity && identity=="professional" ? "block":"none"}} // style={{display:identity && identity=="professional" ? "block":"none"}}
> >
<ConditionToolTip title={() => (<div><p>已提交职业认证</p><p><a href="/account/certification" className="color-blue"></a></p></div>)} condition= { professionalFlag }>
{getFieldDecorator('job2', { {getFieldDecorator('job2', {
rules: [{ rules: [{
initialValue:"企业管理者", initialValue:"企业管理者",
@ -105,6 +112,7 @@ class AccountBasicEditItem extends Component {
<Option value="助理工程师">助理工程师</Option> <Option value="助理工程师">助理工程师</Option>
</Select> </Select>
)} )}
</ConditionToolTip>
</Form.Item> </Form.Item>
} }
</div> </div>
@ -112,6 +120,7 @@ class AccountBasicEditItem extends Component {
label="学校/单位" label="学校/单位"
className="formItemInline mb0" className="formItemInline mb0"
> >
<ConditionToolTip title={() => (<div><p>已提交职业认证</p><p><a href="/account/certification" className="color-blue"></a></p></div>)} condition= { professionalFlag }>
{getFieldDecorator('org', { {getFieldDecorator('org', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
@ -138,6 +147,7 @@ class AccountBasicEditItem extends Component {
} }
</AutoComplete> </AutoComplete>
)} )}
</ConditionToolTip>
</Form.Item> </Form.Item>
{!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&& school && {!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&& school &&
@ -149,38 +159,39 @@ class AccountBasicEditItem extends Component {
</div> </div>
} }
<Form.Item <Form.Item
label="院系/部门" label="院系/部门"
className="formItemInline mb0" className="formItemInline mb0"
style={{ 'margin-top': '10px'}} style={{ 'margin-top': '10px'}}
> >
{getFieldDecorator('org2', { <ConditionToolTip title={() => (<div><p>已提交职业认证</p><p><a href="/account/certification" className="color-blue"></a></p></div>)} condition= { professionalFlag }>
rules: [{ {getFieldDecorator('org2', {
// initialValue: this.state.cityDefaultValue, rules: [{
// type: 'array', // initialValue: this.state.cityDefaultValue,
required: true, // type: 'array',
message: '请先选择院系/部门', required: true,
// validator: (rule, value, callback) => { message: '请先选择院系/部门',
// if (this.this_department_id) { // validator: (rule, value, callback) => {
// callback(); // if (this.this_department_id) {
// return; // callback();
// } // return;
// callback('请先选择院系/部门'); // }
// } // callback('请先选择院系/部门');
}], // }
})( }],
<AutoComplete width={400} showSearch onSearch={this.props.searchDepartment} onChange={this.props.changeDepartment} disabled={professionalFlag}> })(
{ <AutoComplete width={400} showSearch onSearch={this.props.searchDepartment} onChange={this.props.changeDepartment} disabled={professionalFlag}>
filterDepartments && filterDepartments.map((item,key)=>{ {
return( filterDepartments && filterDepartments.map((item,key)=>{
<Option value={item.name} key={item.name}>{item.name}</Option> return(
) <Option value={item.name} key={item.name}>{item.name}</Option>
}) )
} })
</AutoComplete> }
)} </AutoComplete>
</Form.Item> )}
</ConditionToolTip>
</Form.Item>
{ {
filterDepartments != undefined && ( (filterDepartments && filterDepartments.length==0 ) filterDepartments != undefined && ( (filterDepartments && filterDepartments.length==0 )
|| (departmentsName == '' && ! department_id || (departmentsName == '' && ! department_id

@ -53,6 +53,7 @@ class RealNameCertificationModal extends Component{
schoolList:undefined, schoolList:undefined,
departments:undefined, departments:undefined,
showRealName:true, showRealName:true,
realName:undefined
} }
} }
@ -137,16 +138,7 @@ class RealNameCertificationModal extends Component{
}) })
} }
// 将名字隐藏起来
hideRealName=(name)=>{
this.setState({ realName: name })
const newName = getHiddenName(name)
this.props.form.setFieldsValue({
name: newName
})
return newName
}
getDepartments=(e,flag)=>{ getDepartments=(e,flag)=>{
let arr=this.state.schoolList.filter(function(item){ let arr=this.state.schoolList.filter(function(item){
@ -257,11 +249,12 @@ class RealNameCertificationModal extends Component{
onSendOk = () => { onSendOk = () => {
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
// console.log(values); console.log(values);
// console.log(this.state.realName); console.log(this.state.showRealName ? values.name : this.state.realName);
// return;
if(!err){ if(!err){
let{imageUrl2,showRealName}=this.state; let{ imageUrl2 , showRealName , realName }=this.state;
let{current_user,basicInfo}=this.props; let{ current_user , basicInfo }=this.props;
if(imageUrl2){ if(imageUrl2){
let { certification } = this.props; let { certification } = this.props;
if(certification == 1){ if(certification == 1){
@ -275,7 +268,7 @@ class RealNameCertificationModal extends Component{
} }
axios.post((url),{ axios.post((url),{
name:this.state.realName || basicInfo.name, name:this.state.showRealName ? values.name : realName,
gender:parseInt(values.sex), gender:parseInt(values.sex),
id_number:values.credentials, id_number:values.credentials,
show_realname:showRealName, show_realname:showRealName,
@ -422,6 +415,16 @@ class RealNameCertificationModal extends Component{
name: this.state.realName name: this.state.realName
}) })
} }
}
// 将名字隐藏起来
hideRealName=(name)=>{
this.setState({ realName: name })
const newName = getHiddenName(name)
this.props.form.setFieldsValue({
name: newName
})
return newName
} }
// 选择部门、学院 // 选择部门、学院
changeDepartment=(e)=>{ changeDepartment=(e)=>{
@ -463,7 +466,7 @@ class RealNameCertificationModal extends Component{
// /api/users/accounts/${this.props.current_user.login}/auth_attachment.json // /api/users/accounts/${this.props.current_user.login}/auth_attachment.json
// 已职业认证的账户不能修改职业,学校/单位,院系/部门true为disable // 已职业认证的账户不能修改职业,学校/单位,院系/部门true为disable
const professionalFlag = basicInfo && basicInfo.professional_certification == "certified" ; // const professionalFlag = basicInfo && basicInfo.professional_certification == "certified" ;
let{ basicInfo }=this.props let{ basicInfo }=this.props
let common={ let common={
@ -645,7 +648,7 @@ class RealNameCertificationModal extends Component{
label="姓名" label="姓名"
className="formItemInline" className="formItemInline"
> >
{basicInfo && basicInfo.authentication == 'uncertified' ? <React.Fragment>{getFieldDecorator('name', { <React.Fragment>{getFieldDecorator('name', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
@ -659,16 +662,16 @@ class RealNameCertificationModal extends Component{
}></Input> }></Input>
)} )}
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span> <span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</React.Fragment> : </React.Fragment>
<div className="df" style={{}}> {/* // <div className="df" style={{}}>
<Tooltip title="已完成实名认证,不能修改"> // <Tooltip title="已完成实名认证,不能修改">
<span className="mr8" >{showRealName ? this.props.basicInfo.name : getHiddenName(this.props.basicInfo.name)}</span> // <span className="mr8" >{showRealName ? this.props.basicInfo.name : getHiddenName(this.props.basicInfo.name)}</span>
</Tooltip> // </Tooltip>
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"} // <i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName)}></i> // onClick={()=>this.showOrHide(showRealName)}></i>
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span> // <span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</div> // </div> */}
}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -682,10 +685,8 @@ class RealNameCertificationModal extends Component{
}], }],
})( })(
<RadioGroup> <RadioGroup>
<ConditionToolTip title="已完成实名认证,不能修改" condition={basicInfo.authentication != 'uncertified'} > <Radio value="0"></Radio>
<Radio value="0" disabled={basicInfo.authentication != 'uncertified'}></Radio> <Radio value="1"></Radio>
<Radio value="1" disabled={basicInfo.authentication != 'uncertified'}></Radio>
</ConditionToolTip>
</RadioGroup> </RadioGroup>
)} )}
</Form.Item> </Form.Item>
@ -708,7 +709,7 @@ class RealNameCertificationModal extends Component{
<AccountBasicEditItem <AccountBasicEditItem
identity={identity} identity={identity}
getFieldDecorator={getFieldDecorator} getFieldDecorator={getFieldDecorator}
professionalFlag={professionalFlag} professionalFlag={false}
basicInfo={basicInfo} basicInfo={basicInfo}
{...this.props} {...this.props}
{...this.state} {...this.state}

@ -165,7 +165,7 @@ class InfosBank extends Component{
<li className={type=="publicly" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("publicly")}>{is_current ? "我":"TA"}的题库</a></li> <li className={type=="publicly" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("publicly")}>{is_current ? "我":"TA"}的题库</a></li>
<li className={type=="personal" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("personal")}>公共题库</a></li> <li className={type=="personal" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("personal")}>公共题库</a></li>
</div> </div>
<div className="edu-back-white padding20-30 bor-top-greyE"> <div className="edu-back-white padding10-30 bor-top-greyE">
<ul className="clearfix secondNav"> <ul className="clearfix secondNav">
<li className={category=="common" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("common")}>普通作业</a></li> <li className={category=="common" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("common")}>普通作业</a></li>
<li className={category=="group" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("group")}>分组作业</a></li> <li className={category=="group" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("group")}>分组作业</a></li>

@ -238,7 +238,7 @@ class InfosCourse extends Component{
</style> </style>
{ {
is_current && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()} onClick={() => this.changeStatus()}
className="w32">全部</a></li> className="w32">全部</a></li>

@ -227,7 +227,7 @@ class InfosPackage extends Component{
</style> </style>
{ {
category=="manage"? category=="manage"?
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a
onClick={() => this.changeStatus()} className="w32">全部</a></li> onClick={() => this.changeStatus()} className="w32">全部</a></li>
<li className={status == "unpublished " ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "unpublished " ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
@ -237,7 +237,7 @@ class InfosPackage extends Component{
<li className={status == "finished" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "finished" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("finished")} className="w60">已完成</a></li> onClick={() => this.changeStatus("finished")} className="w60">已完成</a></li>
</div>: category=="bidden"? </div>: category=="bidden"?
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a
onClick={() => this.changeStatus()} className="w32">全部</a></li> onClick={() => this.changeStatus()} className="w32">全部</a></li>
<li className={status == "bidding_lost" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "bidding_lost" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a

@ -240,7 +240,7 @@ class InfosPath extends Component{
</style> </style>
{ {
category && category == "manage" && is_current && category && category == "manage" && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()} onClick={() => this.changeStatus()}
className="w32">全部</a></li> className="w32">全部</a></li>
@ -254,7 +254,7 @@ class InfosPath extends Component{
} }
{ {
category && category == "study" && is_current && category && category == "study" && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()} onClick={() => this.changeStatus()}
className="w32">全部</a></li> className="w32">全部</a></li>

@ -240,7 +240,7 @@ class InfosProject extends Component{
</style> </style>
{ {
is_current && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()} onClick={() => this.changeStatus()}
className=" w32">全部</a></li> className=" w32">全部</a></li>

@ -241,7 +241,7 @@ class InfosShixun extends Component{
{ {
category && category == "manage" && is_current && category && category == "manage" && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()} onClick={() => this.changeStatus()}
className="w32">全部</a></li> className="w32">全部</a></li>
@ -257,7 +257,7 @@ class InfosShixun extends Component{
} }
{ {
category && category == "study" && is_current && category && category == "study" && is_current &&
<div className="edu-back-white padding20-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()} onClick={() => this.changeStatus()}
className="w32">全部</a></li> className="w32">全部</a></li>

Loading…
Cancel
Save