index.js 1.59 KB
Newer Older
zhanghaozhe committed
1 2 3
import React, { Component } from "react"
import "./index.scss"
import { http } from "src/utils"
xuzhenghua committed
4
import { Link } from "react-router-dom"
zhanghaozhe committed
5
import { Toast } from "antd-mobile"
xuzhenghua committed
6 7

class ExpandActiveToast extends Component {
zhanghaozhe committed
8 9 10 11 12
  constructor(props) {
    super(props)
    this.state = {
      expandLength: 0,
      isShowExpand: true,
xuzhenghua committed
13
    }
zhanghaozhe committed
14 15 16 17 18 19 20 21
  }

  componentDidMount() {
    http.get(`${API["base-api"]}/sys/deposit/notice`).then((res) => {
      if (res.data.errno == 200) {
        const { data } = res.data
        this.setState({
          expandLength: data.num,
xuzhenghua committed
22
        })
zhanghaozhe committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
      } else {
        Toast.info(res.data.msg, 2)
      }
    })
  }
  cleseExpand = () => {
    this.setState({ isShowExpand: false })
  }

  render() {
    return (
      <div>
        {this.state.expandLength > 0 && this.state.isShowExpand && (
          <div className="expand-active-toast">
            <img
              src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_717/m/guanggao.png"
              alt=""
            />
            <div className="expand-toast-swiper">
              <p>
                您有<span className="red">{this.state.expandLength}</span>
                待支付尾款的课程 再不支付就要过期了!
              </p>
xuzhenghua committed
46
            </div>
zhanghaozhe committed
47 48 49 50 51 52 53 54 55 56 57 58
            <Link to="/final-deposit-order?source=1">查看</Link>

            <img
              onClick={(e) => this.cleseExpand()}
              src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_717/m/guanbi.png"
              alt=""
            />
          </div>
        )}
      </div>
    )
  }
xuzhenghua committed
59 60 61
}

export default ExpandActiveToast