import React from 'react';
import './index.less';
import Page from '@src/containers/Page';
import { User } from '../../../stores/user';

export default class extends Page {
  init() {
    const { code } = this.props.core.query;
    if (code) {
      User.loginWechat(code).then(() => {
        replaceLink('/');
      });
    }
  }

  showWx() {
    setTimeout(() => {
      const wx = new WxLogin({
        id: 'qrCode',
        appid: '',
        scope: 'snsapi_login',
        redirect_uri: encodeURIComponent('/login'),
      });
      return wx;
    }, 100);
  }

  renderView() {
    return <div />;
  }
}
