<?php 
/* @var $this \yii\web\View */

use yii\helpers\Url;

$this->title = 'HANDZ INVESTMENT官网';
?>
<?php $this->beginBlock('header_script'); ?>
<?php $this->endBlock(); ?>
<div class="content index-content">
    <!-- banner -->
    <div class="index-banner">
        <div id="indexBanner" class="owl-carousel owl-theme">
            <div class="item">
                <img id="bannerSmall" src="<?= STATIC_URL ?>/static/fxm/images/banner1.png" alt="HANDZ INVESTMENT">
            </div>
            <div class="item">
                <img id="bannerSmall" src="<?= STATIC_URL ?>/static/fxm/images/banner1.png" alt="HANDZ INVESTMENT">
            </div>
            <div class="item">
                <img id="bannerSmall" src="<?= STATIC_URL ?>/static/fxm/images/banner1.png" alt="HANDZ INVESTMENT">
            </div>
            <div class="item">
                <img id="bannerSmall" src="<?= STATIC_URL ?>/static/fxm/images/banner1.png" alt="HANDZ INVESTMENT">
            </div>
        </div>
        <div class="index-notice">
        	<div class="noticeLeft">
        		<div class="noticeBox">
        			<div class="notice-list">
        				<div class="tit" id="notice"></div>
        				
        			</div>
	                <div class="index-arrow"></div>
        		</div>
        	</div>
        	<div class="noticeRight">
        		<!--<div class="model-icon kai-incon"><a href="javasrcipt:;">开立模拟账户</a></div>-->
        		<div class="real-icon kai-incon"><a href="http://crm.handz-fx.com/account/open">开立真实账户</a></div>
        	</div>
            <div class="container inner">
                
                
            </div>

        </div>
    </div>

   

    <div class="container">
    	<div class="deal-case">
    		<div class="deal-case-name">TRADING PRODUCTS</div>
    		<div class="deal-case-cname">交易产品</div>
    		<div class="deal-case-img">
    			<img src="<?= STATIC_URL ?>/static/fxm/images/deal-name-blue.png" alt="HANDZ INVESTMENT">
    		</div>
    	</div>

        <div class="index-product">
            <div class="list clearfix">
                <a href="<?= Url::to(['/product/oil']) ?>">
                    <div class="img">
                        <img src="<?= STATIC_URL ?>/static/fxm/images/index-1-3.jpg" width="283" height="130px" alt="原油">
                    </div>
                    <!--<div class="redLine"></div>-->
                    <div class="txt">
                    	<p class="title">原油交易</p>
                        <p>对冲交易，减少交易风险<span class="arrow"></span></p>
                        <p>交易成本低，约2块人民币/吨 <span class="arrow"></span></p>
                        <p>只需一次止损，隔天仍然有效<span class="arrow"></span></p>
                    </div>
                </a>
                <a href="<?= Url::to(['/product/mark']) ?>">
                    <div class="img">
                        <img src="<?= STATIC_URL ?>/static/fxm/images/index-1-4.jpg" width="283" height="130px" alt="指数">
                    </div>
                    <!--<div class="redLine"></div>-->
                    <div class="txt">
                    	<p class="title">指数交易</p>
                        <p>门槛较低，报价透明<span class="arrow"></span></p>
                        <p>包含三大美指、日经、欧洲优选 <span class="arrow"></span></p>
                        <p>提供低至2%的保证金水平<span class="arrow"></span></p>
                    </div>
                </a>
            </div>
        </div>
    </div>
    
	<div class="index-data slide-left">
		<div class="deal-case font-white">
    		<div class="deal-case-name">TRANSACTION SERVICES</div>
    		<div class="deal-case-cname">交易服务</div>
    		<div class="deal-case-img">
    			<img src="<?= STATIC_URL ?>/static/fxm/images/deal-name-white.png" alt="HANDZ INVESTMENT">
    		</div>
    	</div>
        <ul class="container clearfix">
            <li>
                <em>30</em><span>多种交易产品</span</li>
            <li>
                <em>0</em><span>点差起步</span</li>
            <li>
                <em>1:100</em><span>杠杆</span</li>
            <li>
                <em>$0</em><span>免费开户</span</li>
            <li>
                <em>24</em><span>小时客服</span</li>
        </ul>
    </div>

    <div class="index-info clearfix">
        <div class="container">
            <!-- 市场行情 -->
            <div class="deal-case">
	    		<div class="deal-case-name">TRANSACTION INFORMATION</div>
	    		<div class="deal-case-cname">交易资讯</div>
	    		<div class="deal-case-img">
	    			<img src="<?= STATIC_URL ?>/static/fxm/images/deal-name-blue.png" alt="HANDZ INVESTMENT">
	    		</div>
	    	</div>
            <!--<div class="index-info-price">
                <div class="tit">
                	
                	<div class="index-analysis-text">
                		<h4>市场行情</h4>
                		<p>超灵活理财  门槛低  收益可观</p>
                	</div>
                    <h3>
                    	<img src="<?= STATIC_URL ?>/static/fxm/images/hang-qing.jpg" alt="HANDZ INVESTMENT">
                    </h3>
                </div>
				<div class="index-info-case">
					<table>
	                    <thead>
	                    <tr class="tb-title">
	                        <th width="40%">交易产品</th>
	                        <th width="30%"> 买入价</th>
	                        <th width="30%">卖出价</th>
	                    </tr>
	                    </thead>
	                    <tbody></tbody>
	                </table>
	                <div class="more-btn">
	                	<a href="<?= Url::to(['/product/mark'])?>">查看更多</a>
	                </div>
				</div>
                
            </div>-->
            <div class="index-info-price">
                <div class="tit">
                	
                	<div class="index-analysis-text">
                		<h4>公告通知</h4>
                		<p>各种活动公告通知 第一时间掌握</p>
                	</div>
                    <h3>
                    	<img src="<?= STATIC_URL ?>/static/fxm/images/hang-qing.jpg" alt="HANDZ INVESTMENT">
                    </h3>
                </div>
				<div class="index-info-case">
					<div class="tit" id="notice1"></div>
				</div>
                
            </div>

            <!-- 汇评分析 -->
            <div class="index-analysis">
                <div class="tit">
                	<div class="index-analysis-text">
                		<h4>汇评分析</h4>
                		<p>最新的走势讲解   资深讲师分析</p>
                	</div>
                    <h3>
                        <img src="<?= STATIC_URL ?>/static/fxm/images/fen-xi.jpg" alt="HANDZ INVESTMENT">
                    </h3>
                </div>
                <div class="index-info-case">
	                <div class="list"></div>
	                <div class="more-btn">
	                	<a href="<?= Url::to(['/product/mark'])?>">查看更多</a>
	                </div>
	            </div>    
            </div>
        </div>

    </div>
    <div class="deal-platform">
    	<div class="deal-case font-white">
    		<div class="deal-case-name">TRADING PLATFORM</div>
    		<div class="deal-case-cname">交易平台</div>
    		<div class="deal-case-img">
    			<img src="<?= STATIC_URL ?>/static/fxm/images/deal-name-white.png" alt="HANDZ INVESTMENT">
    		</div>
    	</div>
    	<div class="platform-case clearfix">
    		<div class="plat-left">
    			<h3>MetaTrader 4</h3>
    			<ul class="plat-list">
    				<li>丰富的交易种类，涵盖原油和股指等产品</li>
					<li>多达50个指标技术分析工具和图表功能</li>
					<li>历史数据管理历史数据导出/导入</li>
					<li>创建各种自定义指标和不同时段</li>
					<li>完整EA (Expert Advisor)功能</li>
					<li>一键交易</li>
    			</ul>
    			<div class="plat-server">
    				支持的操作系统：
    				<img src="<?= STATIC_URL ?>/static/fxm/images/plat-iocn.png" alt="HANDZ INVESTMENT">
    			</div>
    			<div class="plat-btn">
    				<a href="/download/index">平台下载</a>
    			</div>
    		</div>
    		<div class="plat-right">
    			<img src="<?= STATIC_URL ?>/static/fxm/images/plat-img.jpg" alt="HANDZ INVESTMENT">
    		</div>
    	</div>
    </div>

    <!--<div class="index-why">
        <div class="container">
            <h2 class="index-tit">为什么选择HANDZ INVESTMENT？</h2>
            <p class="index-tips">开设一个交易账户，轻松参与多个国际金融产品投资</p>
            <ul class="clearfix">
                <li>
                    <span class="img img1"></span>
                    <dl>
                        <dt>低门槛</dt>
                        <dd>投资低至100美元起 <br/>提供低门槛理财机会</dd>
                    </dl>
                </li>
                <li>
                    <span class="img img2"></span>
                    <dl>
                        <dt>高杠杆</dt>
                        <dd>1-100倍杠杠，小投入<br/>风险低，高收益</dd>
                    </dl>
                </li>
                <li>
                    <span class="img img3"></span>
                    <dl>
                        <dt>双向交易</dt>
                        <dd>不管货币价格上涨还是下跌<br/>选对方向，就可盈利</dd>
                    </dl>
                </li>

                <li>
                    <span class="img img4"></span>
                    <dl>
                        <dt>交易公平透明</dt>
                        <dd>通过银行、交易所入市交易<br/>向客户公开 真正可成交点差水平</dd>
                    </dl>
                </li>
                <li>
                    <span class="img img5"></span>
                    <dl>
                        <dt>投资便捷</dt>
                        <dd>微信+掌上移动APP在线交易<br/>网上开户10分钟完成</dd>
                    </dl>
                </li>
                <li>
                    <span class="img img6"></span>
                    <dl>
                        <dt>24小时交易</dt>
                        <dd>使用ECN国际对冲通道交易<br/>极速下单，毫秒交易</dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>-->

    <div class="index-start">
        <div class="container">
        	<div class="deal-case">
	    		<div class="deal-case-name">START TRADING WITH  US</div>
	    		<div class="deal-case-cname">开始与我们交易</div>
	    		<div class="deal-case-img">
	    			<img src="<?= STATIC_URL ?>/static/fxm/images/deal-name-blue.png" alt="HANDZ INVESTMENT">
	    		</div>
	    	</div>
            <ul class="list clearfix">
                <li class="item">
                	<img src="<?= STATIC_URL ?>/static/fxm/images/index-start1.jpg" alt="HANDZ INVESTMENT">
                    <p>我们已获得英国、澳洲、塞浦路斯
                        <br/>全球顶级监管机构授权</p>
                </li>
                <li class="item">
                    <img src="<?= STATIC_URL ?>/static/fxm/images/index-start1.jpg" alt="HANDZ INVESTMENT">
                    <p>我们尊重并保护您的隐私</p>
                </li>
                <li class="item">
                    <img src="<?= STATIC_URL ?>/static/fxm/images/index-start1.jpg" alt="HANDZ INVESTMENT">
                    <p>您的资金存放在信誉良好的银行以
                        <br/>保障安全</p>
                </li>
            </ul>
            <a class="btn-reg" href="##">立即注册</a>
        </div>
    </div>

    <!-- 客服联系 -->
    <div class="index-service">
    	<div class="deal-case font-white">
    		<div class="deal-case-name">CUSTOMER SERVICE CONTACT</div>
    		<div class="deal-case-cname">客服联系</div>
    		<div class="deal-case-img">
    			<img src="<?= STATIC_URL ?>/static/fxm/images/deal-name-white.png" alt="HANDZ INVESTMENT">
    		</div>
    	</div>
        <form id="contactForm" class="container clearfix">
            <div class="inpt-wrap">
                <input class="inpt" type="text" placeholder="姓名" name="username" autocomplete="off" maxlength="4">
            </div>
            <div class="inpt-wrap">
                <input class="inpt" type="text" placeholder="电话" name="phone" autocomplete="off" maxlength="11">
            </div>
            <div class="inpt-wrap">
                <input class="inpt" type="text" placeholder="电子邮箱" name="email" autocomplete="off">
            </div>
            <div class="inpt-wrap">
                <button class="submit" id="contactFormSubmit" type="button">报名</button>
            </div>
        </form>
    </div>
</div>

<?php $this->beginBlock('footer_script'); ?>
<script>
    $(function () {
    	$(".header").addClass('positionHeader');
    	
        // ajax加载公告
        $.get('/index/get-announcement-list', function (data) {
            var html = ''
            for (key in data) {
                var articleList = data[key].data
                var articleStr = '<ul>'
                for (var i = 0, len = articleList.length; i < len; i++) {
                    var article = articleList[i]
                    articleStr += '<li><a href="/article/detail?id=' + article.id + '">' + article.title + '</a></li>'
                }
                articleStr += '</ul>'
//              articleStr += '<a href="/about/public" class="more">More+</a>'
                html += articleStr
            }
            $('#notice').after(html);
            $('#notice1').after(html);
            setTimeout(function () {
                gundong();
            }, 100)
        }, 'json')
    })

    // 轮播
    $('.owl-carousel').owlCarousel({
        items: 1,
        loop: true,
        nav: true,
        navigation: true,
        margin: 10,
        animateOut: 'fadeOut',
        autoplay: true,
        autoplayTimeout: 5000,
        autoplaySpeed: 1000,
        autoplayHoverPause: false
    });

    // 滚动公告
    var gundong = function () {
        var ul_Obj = $('.index-notice ul');
        var liHeight = ul_Obj.find("li").outerHeight();
        var len = ul_Obj.find("li").length;
        var ulHeight = len * liHeight;
        var dis = 0;
        var timer;
        ul_Obj.find('li:first').clone().appendTo(ul_Obj);
        var scrollNotice = function () {
            dis += liHeight;
            if (dis > ulHeight - liHeight) {
                // console.log(dis);
                ul_Obj.animate({
                    marginTop: -dis
                }, '1000', function () {
                    ul_Obj.css('marginTop', '0px');
                });
                dis = 0;
            } else {
                ul_Obj.animate({
                    marginTop: -dis
                }, '1000');
            }
        }
        timer = setInterval(scrollNotice, '3000');
    };

    // 页面滚动动画
    window.sr = ScrollReveal({
        duration: 1000
    });
    sr.reveal('.index-data li', {
        origin: 'bottom',
        distance: '20px',
    }, 50);
    sr.reveal('.deal-platform .deal-case', {
        origin: 'top',
        distance: '20px',
    }, 50);
    sr.reveal('.deal-platform .plat-left', {
        origin: 'left',
        distance: '20px',
    }, 50);
     sr.reveal('.deal-platform .plat-right', {
        origin: 'right',
        distance: '20px',
    }, 50);
    sr.reveal('.deal-platform .deal-case', {
        origin: 'top',
        distance: '20px',
    }, 50);
    sr.reveal('.index-product .list a', {
        origin: 'left',
        distance: '100px',
    }, 50);
    sr.reveal('.index-open a,.index-tit,.index-tips', {
        origin: 'bottom',
        distance: '20px',
    }, 50);
    sr.reveal('.index-open a,.index-tit,.index-tips', {
        origin: 'bottom',
        distance: '20px',
    }, 50);
    sr.reveal('.index-info-price', {
        origin: 'left',
        distance: '100px',
    }, 50);
    sr.reveal('.index-analysis', {
        origin: 'bottom',
        distance: '20px',
    }, 50);
//  sr.reveal('.index-why li', {
//      scale: 0.5,
//  }, 0);
    sr.reveal('.index-start li,.btn-reg', 200);
    sr.reveal('.index-service .inpt-wrap', {
        origin: 'bottom',
        distance: '20px',
    }, 50);

    // 客服联系
    $("#contactForm").validate({
        errorElement: 'i',
        rules: {
            username: 'required',
            phone: {
                required: true,
                isPhone: true
            },
            email: {
                required: true,
                email: true
            }
        },
        messages: {
            username: '请输入您的姓名',
            phone: {
                required: "请输入手机号码"
            },
            email: {
                required: "请输入邮箱",
                email: "邮箱格式不正确"
            }
        }
    });
    $('#contactFormSubmit').click(function () {
        var name_02_ = 'username',
            phone_02_ = 'phone',
            email_02_ = "email";

        var form = $("#contactForm");
        var name_02 = form.find("input[name =" + name_02_ + "]");
        var phone_02 = form.find("input[name =" + phone_02_ + "]");
        var email_02 = form.find("input[name =" + email_02_ + "]");
        if (form.valid()) {
            var posturl = "/api/save-register";//提交表单的网址
            var postparam = {
                "name": name_02.val(),
                "mobile": phone_02.val(),
                "email": email_02.val()
            };
            $.ajax({
                type: "POST",
                data: postparam,
                url: posturl,
                async: false,
                dataType: "json",
                success: function (data) {
                    if (data) {
                        //清空表单
                        if (name_02.val() != undefined) {
                            name_02.val("");
                        }

                        if (phone_02.val() != undefined) {
                            phone_02.val("");
                        }

                        if (email_02.val() != undefined) {
                            email_02.val("");
                        }

                        layer.msg(
                            '恭喜您！您的申请已成功提交' + "<br>" + '请保持电话畅通，稍后我们会有客服为您提供服务。',
                            {time: 4000},
                            function () {
                                window.location.href = "" + window.location.pathname + "";
                            }
                        );
                    } else {
                    }
                }
            });
        }
    });
</script>
<script>
    // 汇评分析
    $.get('/index/review-analysis', function (data) {
        var $analysisList = $('.index-analysis .list');
        $analysisList.css("padding","0 15px");
        var htmlStr = '';
        var listData = data.articleList.data;
        for (key in listData) {
            var item = listData[key];
            if (item.image_path.length == 0) {
                item.image_path = '../images/index-analysis.jpg';
            }
            var str = '<a class="list-item" href="/article/detail?id=' + item.id + '">' +
                '<img src="' + item.image_path + '" width = "156" height = "100">' +
                '<div class="desc">' +
                '<h4>' + item.title + '</h4>' +
                '<div class="date" >' + item.create_date + '</div>' +
                '<p>' + item.min_content + '</p>' +
                '</div></a>';
            htmlStr += str;
        }
        $analysisList.html(htmlStr);
    }, 'json');

    // 市场行情

    priceTable();

    function priceTable() {
        $.get('<?= Url::to(['/index/get-market-list']) ?>', function (data) {
            var $analysisList = $('.index-info-price tbody');
            var htmlStr = '';
            var listData = data;
            // 本地存储:上一次的数据和本次的数据比较
            var first = localStorage.getItem('preResult');
            if (first === null) {
                localStorage.setItem('preResult', JSON.stringify(data));
            }
            var preResult = JSON.parse(localStorage.getItem('preResult'));

            for (key in listData) {
                var item = listData[key];
                var preItem = preResult[key];
                for (i in item) {
                    // 涨绿，跌红
                    var str = '<tr><td>' + i + '</td>';
                    if (preItem[i][0] > item[i][0]) {
                        localStorage.setItem('color_' + i + '_buy', 'bg-red');
                        str += '<td><span class="bg-red">' + item[i][0] + '</span></td>';
                    } else if (preItem[i][0] == item[i][0]) {
                        var buy_color = localStorage.getItem('color_' + i + '_buy');
                        if (buy_color == null) {
                            localStorage.setItem('color_' + i + '_buy', 'bg-green');
                        }
                        var color1 = localStorage.getItem('color_' + i + '_buy');
                        str += '<td><span class="'+ color1 +'">' + item[i][0] + '</span></td>';
                    } else {
                        localStorage.setItem('color_' + i + '_buy', 'bg-green');
                        str += '<td><span class="bg-green">' + item[i][0] + '</span></td>';
                    }

                    if (preItem[i][1] > item[i][1]) {
                        localStorage.setItem('color_' + i + '_sell', 'bg-red');
                        str += '<td><span class="bg-red">' + item[i][1] + '</span></td></tr >';
                    } else if(preItem[i][1] == item[i][1]) {
                        var sell_color = localStorage.getItem('color_' + i + '_sell');
                        if (sell_color == null) {
                            localStorage.setItem('color_' + i + '_sell', 'bg-green');
                        }
                        var color2 = localStorage.getItem('color_' + i + '_sell');
                        str += '<td><span class="'+ color2 +'">' + item[i][1] + '</span></td></tr >';
                    } else {
                        localStorage.setItem('color_' + i + '_sell', 'bg-green');
                        str += '<td><span class="bg-green">' + item[i][1] + '</span></td></tr >';
                    }
                }
                htmlStr += str;
            }
            $analysisList.html(htmlStr);
            localStorage.setItem('preResult', JSON.stringify(data));
            setTimeout(function () {
                priceTable()
            }, 1000)
        }, 'json')
    }
</script>
<?php $this->endBlock(); ?>