Commit 96fc3efd by zhangleyuan

feat:处理冲突

parents d05a8b2a 652a5ce4
......@@ -10,7 +10,8 @@ class Authorize extends React.Component {
this.state = {
code:'',
ticket:'',
hasBindWechat:false
hasBindWechat:false,
headImgUrl:''
}
}
componentDidMount() {
......@@ -26,7 +27,6 @@ class Authorize extends React.Component {
},()=>this.changeCodeState())
}else{
this.getWechatUserInfo();
}
}
changeCodeState = ()=>{
......@@ -45,6 +45,7 @@ class Authorize extends React.Component {
'&response_type=code&scope=snsapi_userinfo&state=state#wechat_redirect';
window.location.href = htmlUrl;
}
getWechatUserInfo = ()=>{
const code = window.getParameterByName('code');
const ticket = window.getParameterByName('ticket');
......@@ -57,24 +58,38 @@ class Authorize extends React.Component {
Service.hades('/anon/hades/bindWeChat',params).then((res)=>{
if(res.success){
this.setState({
hasBindWechat:true
})
hasBindWechat:true,
headImgUrl:res.result.headImgUrl,
ticketState:"AUTH_SUCCESS"
},()=>{this.changeCodeState()})
}
})
}
render() {
const { hasBindWechat } = this.state
const { hasBindWechat , headImgUrl} = this.state
return (
<div className="authorize-page">
<div>
{ !hasBindWechat &&
<div>
<div>
<img src="https://image.xiaomaiketang.com/xm/HsCjyKTbWw.png" className="avatar-img"></img>
</div>
<div>
{ !hasBindWechat &&
<button className="login-btn" onClick={this.wechatAuthorize}>微信登录</button>
</div>
}
{ hasBindWechat &&
<button className="login-btn" onClick={this.wechatAuthorize}>已登录</button>
<div>
<div>
<img src={headImgUrl} className="avatar-img"></img>
</div>
<div className="login-success-text">微信登录成功</div>
<div className="login-success-instro">已完成微信登录操作,去网页端继续学习吧</div>
</div>
}
</div>
</div>
......
......@@ -19,4 +19,14 @@
margin-top:10.6vw;
font-size:4vw;
}
.login-success-text{
margin-top:10.6vw;
font-size:4vw;
color:#333333;
}
.login-success-instro{
font-size:13px;
color:#999;
margin-top:5px;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment