index.js 1.79 KB
Newer Older
xuzhenghua committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
import React, {Component} from 'react'
import './index.scss'
import {http} from '@/utils'
import { Link } from "react-router-dom"
import {Toast} from "antd-mobile";


class ExpandActiveToast extends Component {
    constructor(props) {
        super(props);
        this.state = {
            expandLength: 0,
            isShowExpand:true
        }
    }

    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
                })
            } 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>
                        </div>
                        <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>
        );
    }

}


export default ExpandActiveToast