|
|
|
@ -10,6 +10,14 @@ const RadioGroup = Radio.Group;
|
|
|
|
|
const Option = Select.Option;
|
|
|
|
|
|
|
|
|
|
const map = identityMap // {"teacher":"教师", "student":"学生", "professional":"专业人士"}
|
|
|
|
|
export function getHiddenName(name) {
|
|
|
|
|
if (!name) return ''
|
|
|
|
|
let len=parseInt(name.length)-1;
|
|
|
|
|
let str="";
|
|
|
|
|
for(var i = 0; i < len; i++){ str += "*"; }
|
|
|
|
|
const newName = name.substr(0,1)+str;
|
|
|
|
|
return newName
|
|
|
|
|
}
|
|
|
|
|
class AccountBasic extends Component {
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props);
|
|
|
|
@ -110,11 +118,7 @@ class AccountBasic extends Component {
|
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
|
console.log(values);
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
|
// TODO 为什么modal里的form影响到这里的了
|
|
|
|
|
if (err) {
|
|
|
|
|
delete err.depart
|
|
|
|
|
}
|
|
|
|
|
if(!err || Object.keys(err).length == 0){
|
|
|
|
|
if(!err ){
|
|
|
|
|
let url=`/users/accounts/${basicInfo.id}.json`
|
|
|
|
|
axios.put((url),{
|
|
|
|
|
nickname:values.nickname,
|
|
|
|
@ -158,19 +162,10 @@ class AccountBasic extends Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getHiddenName(name) {
|
|
|
|
|
if (!name) return ''
|
|
|
|
|
let len=parseInt(name.length)-1;
|
|
|
|
|
let str="";
|
|
|
|
|
for(var i = 0; i < len; i++){ str += "*"; }
|
|
|
|
|
const newName = name.substr(0,1)+str;
|
|
|
|
|
return newName
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 将名字隐藏起来
|
|
|
|
|
hideRealName=(name)=>{
|
|
|
|
|
this.setState({ realName: name })
|
|
|
|
|
const newName = this.getHiddenName(name)
|
|
|
|
|
const newName = getHiddenName(name)
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
name: newName
|
|
|
|
@ -202,16 +197,18 @@ class AccountBasic extends Component {
|
|
|
|
|
}
|
|
|
|
|
//搜索部门
|
|
|
|
|
searchDepartment=(e)=>{
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org2:e
|
|
|
|
|
})
|
|
|
|
|
let arr = this.state.departments.filter(function(item){
|
|
|
|
|
return item.name.indexOf(e) > -1
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
filterDepartments:arr,
|
|
|
|
|
departmentsName:e
|
|
|
|
|
})
|
|
|
|
|
if (e) {
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org2:e
|
|
|
|
|
})
|
|
|
|
|
let arr = this.state.departments.filter(function(item){
|
|
|
|
|
return item.name.indexOf(e) > -1
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
filterDepartments:arr,
|
|
|
|
|
departmentsName:e
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 选择部门、学院
|
|
|
|
@ -251,6 +248,9 @@ class AccountBasic extends Component {
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org2:result.data.departments[0].name
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
department_id: result.data.departments[0].id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
@ -303,12 +303,15 @@ class AccountBasic extends Component {
|
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
|
let{basicInfo}=this.props
|
|
|
|
|
|
|
|
|
|
// form合并了
|
|
|
|
|
const propsWithoutForm = Object.assign({}, this.props)
|
|
|
|
|
delete propsWithoutForm.form
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
|
|
|
|
|
{...this.props}></ApplyForAddOrgModal>
|
|
|
|
|
{...propsWithoutForm}></ApplyForAddOrgModal>
|
|
|
|
|
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
|
|
|
|
|
{...this.props} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
|
|
|
|
|
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
|
|
|
|
|
|
|
|
|
|
<div className="basicForm">
|
|
|
|
|
<style>{`
|
|
|
|
@ -360,7 +363,7 @@ class AccountBasic extends Component {
|
|
|
|
|
font-size:14px;
|
|
|
|
|
}
|
|
|
|
|
.resetCityStyle .ant-form-item-control{
|
|
|
|
|
width:190px;
|
|
|
|
|
width:220px;
|
|
|
|
|
}
|
|
|
|
|
`}</style>
|
|
|
|
|
<div className="title">基本信息</div>
|
|
|
|
@ -402,7 +405,7 @@ class AccountBasic extends Component {
|
|
|
|
|
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
|
|
|
|
|
</React.Fragment> :
|
|
|
|
|
<div className="df" style={{ 'justify-content': 'center' }}>
|
|
|
|
|
<span className="mr8" >{showRealName ? this.props.basicInfo.name : this.getHiddenName(this.props.basicInfo.name)}</span>
|
|
|
|
|
<span className="mr8" >{showRealName ? this.props.basicInfo.name : getHiddenName(this.props.basicInfo.name)}</span>
|
|
|
|
|
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
|
|
|
|
|
onClick={()=>this.showOrHide(showRealName)}></i>
|
|
|
|
|
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
|
|
|
|
|