import React from 'react'; import './index.less'; import Page from '@src/containers/Page'; import { WechatH5AppId, H5Url } from '../../../../Constant'; import { User } from '../../../stores/user'; export default class extends Page { init() { const { code } = this.props.core.query; if (code) { User.loginWechat(code).then((info) => { if (info.bindMobile) { replaceLink('/'); } else { replaceLink('/bind'); } }); } else { const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${WechatH5AppId}&redirect_uri=${encodeURIComponent( `${H5Url}/login`, )}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; window.location.href = url; } } renderView() { return
; } }