dev_forum
hjm 5 years ago
parent a1f106e9f3
commit b1b38e776c

@ -34,7 +34,7 @@ class AccountPage extends Component {
constructor (props) {
super(props)
this.state = {
basicInfo:undefined
basicInfo: {}
}
}
@ -57,8 +57,12 @@ class AccountPage extends Component {
if(result.data && result.data.base_info_completed == false){
this.props.history.push(`/account/profile/edit`);
}
// "authentication": "uncertified", // "uncertified" | "applying" | "certified"
this.setState({
basicInfo: Object.assign({}, {...result.data}, { avatar_url: `${result.data.avatar_url}?t=${new Date().getTime()}`})
basicInfo: Object.assign({}, {...result.data}, {
avatar_url: `${result.data.avatar_url}?t=${new Date().getTime()}`,
gender: result.data.gender == null || result.data.gender == undefined ? 0 : result.data.gender
})
})
}
}).catch((error)=>{

@ -109,7 +109,8 @@ class AccountBasic extends Component {
let url=`/users/accounts/${basicInfo.id}.json`
axios.put((url),{
nickname:values.nickname,
name:values.name,
// 认证中的不能修改
name: basicInfo.authentication == 'uncertified' ? values.name : basicInfo.name,
show_realname:this.state.showRealName,
gender:parseInt(values.sex),
location:values.city[0],
@ -146,16 +147,21 @@ class AccountBasic extends Component {
}
}
// 将名字隐藏起来
hideRealName=(name)=>{
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
}
name = name.substr(0,1)+str;
// 将名字隐藏起来
hideRealName=(name)=>{
const newName = this.getHiddenName(name)
this.props.form.setFieldsValue({
name
name: newName
})
}
@ -365,19 +371,28 @@ class AccountBasic extends Component {
label="姓名"
className="formItemInline"
>
{getFieldDecorator('name', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请输入您的姓名',
}],
})(
<Input placeholder="请输入您的姓名" suffix={
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"} onClick={()=>this.showOrHide(showRealName,basicInfo.name)}></i>
}></Input>
)}
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</Form.Item>
{ basicInfo.authentication == 'uncertified' ? <React.Fragment>{getFieldDecorator('name', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请输入您的姓名',
}],
})(
<Input placeholder="请输入您的姓名" suffix={
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName,basicInfo.name)}></i>
}></Input>
)}
<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>
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName,basicInfo.name)}></i>
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</div>
}
</Form.Item>
<Form.Item
label="性别"

@ -37,13 +37,10 @@ class AccountNav extends Component {
<i className="iconfont icon-jibenxinxi color-grey-9 font-16"></i>
基本信息
{
(basicInfo.authentication == 'uncertified' || basicInfo.authentication == 'applying') &&
basicInfo.base_info_completed == true ?
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i> :
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
{
basicInfo.authentication == 'certified' &&
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>
}
</li>
<li className={`navItem ${isCertification ? 'active' : ''}`} onClick={this.toCertification}>
<i className="iconfont icon-renzhengxinxi color-grey-9 font-16"></i>

Loading…
Cancel
Save