import './index.less'
import React, { useState,useEffect } from "react";
import utils from '~/utils/utils';
export const DownloadCaigong1: React.FC = (props: any) => {
    const [tip, setTip] = useState('none')
    
    const is_weixin = () => {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.search('micromessenger') !== -1) {
            return true;
        } else {
            return false;
        }
    }
    const openWxDownloadTip = () => {
        setTip('block')
      

    }
    const closeWxDownloadTip = () => {
        setTip('none')
    }
    useEffect(()=>{
        if (is_weixin()) {
            document.querySelectorAll<HTMLElement>('#app a')[0].style.display = 'none'
            document.querySelectorAll<HTMLElement>('#app a')[1].style.display = 'none'

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

        }

    })
    return (
        <div id="app">
            <div style={{ display: tip }} id="tip">
                <img onClick={() => {
                    closeWxDownloadTip()
                }} className="tip" src={utils.getAssetsFile('tip.png')} alt='' />

            </div>
            <div className="title">
                <img style={{ width: '72vw', margin: '0 auto' }} src={utils.getAssetsFile('财仝驾考APP1.png')} alt='' />
            </div>
            <div className="subtitle">
                <img style={{ width: '56.5vw', margin: '0 auto' }} src={utils.getAssetsFile('文字1.png')} alt='' />
            </div>
            <img className="bg" src={utils.getAssetsFile('bg1.png')} alt='' />
            <a href="https://ys.zzxcx.net/apk/sdjkAndroid1.2.2.apk">
                <div className="download1">
                    点击下载1
                </div>
            </a>
            <a href="https://ys.zzxcx.net/apk/sdjkAndroid1.2.2.apk">
                <div className="download2">
                    点击下载(备用)
                </div>
            </a>
            <a onClick={() => openWxDownloadTip()}>
                <div className="download1">
                    点击下载1
                </div>
            </a>
            <a onClick={() => openWxDownloadTip()}>
                <div className="download2">
                    点击下载(备用)
                </div>
            </a>

        </div>
    )

}