
import React, { Component } from 'react';
import { connect } from "react-redux";
import './downloadCaigong2.css'
const mapStateToProps = (state) => ({

});

const mapDispatchToProps = (dispatch) => ({

});

class LoginViews extends Component {
    /*
    * 构造函数
    *
    * */
    constructor() {
        super();
        this.state = {
            tip:'none'


        };
    }

    is_weixin=()=> {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.search('micromessenger') !==-1) {
            return true;
        } else {
            return false;
        }
    }
    openWxDownloadTip=()=> {
        this.setState({
            tip:'block'
        })
        // document.getElementById('tip').style.display = 'block'

    }
    closeWxDownloadTip=()=>{
        this.setState({
            tip:'none'
        })
    }





    /*
    *
    * 生命周期一
    *
    * */
    componentWillMount() {
   
        /*
        *
        * 如果是ios设备默认第一次不是播放状态，android没事
        *
        * */


        /*
        *
        *  请求数据
        *
        *
        * */

    }



    /*
    *
    * 生命周期二
    *
    * */
    componentDidMount() {

        if (this.is_weixin()) {
            document.querySelectorAll('#app a')[0].style.display = 'none'
            document.querySelectorAll('#app a')[1].style.display = 'none'

        }
        else {
            document.querySelectorAll('#app a')[2].style.display = 'none'
            document.querySelectorAll('#app a')[3].style.display = 'none'

        }
    }

    /*
    * 渲染
    * */
    render() {
        return (
            <div id="app">
                <div style={{display:this.state.tip}} id="tip">
                    <img onClick={()=>{
                        this.closeWxDownloadTip()
                    }} class="tip" src={require('./../../assets/images/tip.png')} alt='' />

                </div>
                <div class="title">
                    <img style={{ width: '72vw',margin:'0 auto' }} src={require('./../../assets/images/财仝驾考APP2.png')} alt='' />
                </div>
                <div class="subtitle">
                    <span style={{ color: '#656565' }}>一款为驾考学员打造的专业软件</span>
                </div>
                <img class="bg" src={require('./../../assets/images/bg2.png')} alt='' />
                <a href="https://ys.zzxcx.net/apk/sdjkAndroid1.2.2.apk">
                    <div class="download1">
                        点击下载1
                    </div>
                </a>
                <a href="https://ys.zzxcx.net/apk/sdjkAndroid1.2.2.apk">
                    <div class="download2">
                        点击下载(备用)
                    </div>
                </a>
                <a onClick={()=>this.openWxDownloadTip()}>
                    <div class="download1">
                        点击下载1
                    </div>
                </a>
                <a onClick={()=>this.openWxDownloadTip()}>
                    <div class="download2">
                        点击下载(备用)
                    </div>
                </a>

            </div>

        )
    }

    componentWillUnmount() {

    }
}

export default connect(mapStateToProps, mapDispatchToProps)(LoginViews);