import React, { Component } from 'react'
import RulePopup from './rulePopup/index'
import CoursePopup from './coursePopup/index'
import './index.scss'
import { Popup } from '@/common'

class BlessingPreheat extends Component {
  constructor(props) {
    super(props)
    this.state = {
      isRule: false,
      isCourse: false,
      inviteVisible: true
    }
  }

  handleToHide = (key) => {
    let obj = {}
    obj[key] = false
    this.setState({
      ...obj
    })
  }

  render() {
    const {isRule, isCourse, inviteVisible} = this.state
    return (
      <div id={'blessing-preheat'}>
        22222
        {
          isRule &&
          <RulePopup handleToHide={() => this.handleToHide('isRule')}/>
        }
        {
          isCourse &&
          <CoursePopup handleToHide={() => this.handleToHide('isCourse')}/>
        }
        <Popup visible={inviteVisible}
               title={'扫码邀请好友注册+10点福气值'}
               className={'invite-popup'}
        >
          <img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/tinypng-common/right_weixin.png" alt="" className="qr-code"/>
          <button>一键复制网址</button>
        </Popup>
      </div>
    )
  }
}

export default BlessingPreheat
