Commit 357a8af5 by zhangleyuan

feat:处理绑定微信失败

parent 9976fabc
...@@ -14,9 +14,6 @@ class Authorize extends React.Component { ...@@ -14,9 +14,6 @@ class Authorize extends React.Component {
} }
} }
componentDidMount() { componentDidMount() {
// console.log("ticket",window.getParameterByName('ticket'))
// const searchParams = this.props.location.search;
// const {code,ticket} = queryString.parse(searchParams);
const code = window.getParameterByName('code'); const code = window.getParameterByName('code');
const ticket = window.getParameterByName('ticket'); const ticket = window.getParameterByName('ticket');
this.setState({ this.setState({
...@@ -29,6 +26,7 @@ class Authorize extends React.Component { ...@@ -29,6 +26,7 @@ class Authorize extends React.Component {
},()=>this.changeCodeState()) },()=>this.changeCodeState())
}else{ }else{
this.getWechatUserInfo(); this.getWechatUserInfo();
} }
} }
changeCodeState = ()=>{ changeCodeState = ()=>{
...@@ -48,18 +46,21 @@ class Authorize extends React.Component { ...@@ -48,18 +46,21 @@ class Authorize extends React.Component {
window.location.href = htmlUrl; window.location.href = htmlUrl;
} }
getWechatUserInfo = ()=>{ getWechatUserInfo = ()=>{
let {ticket,code} = this.state; const code = window.getParameterByName('code');
const ticket = window.getParameterByName('ticket');
const params = { const params = {
appTermEnum: "XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN", appTermEnum: "XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN",
code, code,
storeId:"1192022572770412395", storeId:"1192022572770412395",
ticket ticket
} }
Service.hades('/anon/hades/bindWeChat',params).then( Service.hades('/anon/hades/bindWeChat',params).then((res)=>{
if(res.success){
this.setState({ this.setState({
hasBindWechat:true hasBindWechat:true
}) })
) }
})
} }
render() { render() {
const { hasBindWechat } = this.state const { hasBindWechat } = this.state
......
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