|
|
|
@ -38,6 +38,7 @@ class AccountSecure extends Component {
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
|
let {list}=this.state;
|
|
|
|
@ -47,7 +48,7 @@ class AccountSecure extends Component {
|
|
|
|
|
}else{
|
|
|
|
|
basicInfo&&basicInfo.open_users.map((item,key)=>{
|
|
|
|
|
newlist.map((items,keys)=>{
|
|
|
|
|
if(item.en_type===items.en_type){
|
|
|
|
|
if(items.en_type===item.en_type){
|
|
|
|
|
items.id=item.id;
|
|
|
|
|
items.nickname=item.nickname;
|
|
|
|
|
}
|
|
|
|
@ -60,6 +61,30 @@ class AccountSecure extends Component {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate=(prevProps)=>{
|
|
|
|
|
if(prevProps!=this.props){
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
|
let {list}=this.state;
|
|
|
|
|
let newlist=list;
|
|
|
|
|
if(basicInfo===undefined||JSON.stringify(basicInfo) == "{}"||basicInfo&&basicInfo.open_users.length===0){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
basicInfo&&basicInfo.open_users.map((item,key)=>{
|
|
|
|
|
newlist.map((items,keys)=>{
|
|
|
|
|
if(items.en_type===item.en_type){
|
|
|
|
|
items.id=item.id;
|
|
|
|
|
items.nickname=item.nickname;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
list:newlist
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
showModal=()=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
visible: true,
|
|
|
|
@ -86,11 +111,21 @@ class AccountSecure extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Saveundologin=(id)=>{
|
|
|
|
|
Saveundologin=(type,id)=>{
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
|
let {list}=this.state;
|
|
|
|
|
let newlist=list;
|
|
|
|
|
let url=`/users/accounts/${basicInfo.id}/open_users/${id}.json`;
|
|
|
|
|
axios.delete(url).then((result)=>{
|
|
|
|
|
if(result.data.status===0){
|
|
|
|
|
newlist.map((item,key)=>{
|
|
|
|
|
if(item.en_type===type){
|
|
|
|
|
item.id=null
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
list:newlist
|
|
|
|
|
})
|
|
|
|
|
this.props.showNotification('解绑成功');
|
|
|
|
|
this.Cancelundologins()
|
|
|
|
|
this.props.getBasicInfo()
|
|
|
|
@ -105,7 +140,7 @@ class AccountSecure extends Component {
|
|
|
|
|
Modalstype:true,
|
|
|
|
|
Modalstopval:type==="wechat"?"是否确定解绑微信账号?":"是否确定解绑QQ账号?",
|
|
|
|
|
ModalCancel:this.Cancelundologins,
|
|
|
|
|
ModalSave:()=>this.Saveundologin(id),
|
|
|
|
|
ModalSave:()=>this.Saveundologin(type,id),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
openqqlogin=()=>{
|
|
|
|
@ -120,6 +155,7 @@ class AccountSecure extends Component {
|
|
|
|
|
render() {
|
|
|
|
|
let flag = this.IsPC(); //true为PC端,false为手机端
|
|
|
|
|
let {list}=this.state;
|
|
|
|
|
console.log(window.location.host)
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="basicForm settingForm">
|
|
|
|
@ -217,7 +253,7 @@ class AccountSecure extends Component {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="description lineheight60">
|
|
|
|
|
<span className={"color-grey-9 ml80"}>{item.nickname}</span>
|
|
|
|
|
<span className={"color-grey-9 ml80"}>{item.id===null?"":item.nickname}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="status pt19">
|
|
|
|
@ -227,7 +263,7 @@ class AccountSecure extends Component {
|
|
|
|
|
}
|
|
|
|
|
>{item.id===null?"绑定":"解绑"}</WordsBtn>:<WordsBtn style={ item.id===null?"blue":"colorgrey9"} className={item.id===null?"borderBottom":""}
|
|
|
|
|
onClick={
|
|
|
|
|
item.id===null?flag===true?() => this.openphoneqqlogin():() => this.openqqlogin():() => this.undologin("qq",item.id)
|
|
|
|
|
item.id===null?flag===true?() => this.openqqlogin():() => this.openphoneqqlogin():() => this.undologin("qq",item.id)
|
|
|
|
|
}
|
|
|
|
|
>{item.id===null?"绑定":"解绑"}</WordsBtn>}
|
|
|
|
|
</div>
|
|
|
|
|