trafficmobile.html 12.5 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商旅服务</title>
    <!--<meta name="viewport" content="width=device-width, initial-scale=1" />-->
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_1043230_hcei2fa3b4q.css">
    <link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/common.css">
    <link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/slfw_2.css">
    <link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/dropload.css">
    <link rel="stylesheet" type="text/css" href="https://api.map.baidu.com/res/13/bmap.css">

    <script src="__TMPL__/public/assets/js/base.js"></script>
    <script src="__TMPL__/public/assets/js/jquery.min.js"></script>
    <style>
        .iconfont{
            font-size: 0.38rem;
        }
        .icon-zuo{
            color: #959595;
            font-size: 0.38rem;
        }
        .icon-iconfont-edu12{
            color: #959595;
            font-size: 0.5rem;
        }
        table{
            margin-top: 0.1rem;
            border: 1px solid #ffffff;
        }
        th{
            width: 2rem;
            height: 1rem;
            font-size: 0.2rem;
            background-color: #4C79B2;
            list-style: none;
            color: #fff;
        }
        td{
            width: 1.6rem;
            height: 1rem;
            font-size: 0.2rem;
            background-color: #CED5D5;
            text-align: center;
        }
        .icon-fangdajing{
            color: #ffffff;
        }
        .addr{
            font-size: 0.2rem;
        }
        .phone{
            font-size: 0.2rem;
        }
        /*引入百度地图*/
        #allmap,.BMap_mask {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }
        .anchorBL{
            display:none;
        }

        .icon-iconfont-edu12{
            color: #959595;
            font-size: 0.5rem;
            position: relative;
        }
        .icon-shangsanjiao{
            height: 0.5rem;
            font-size: 0.6rem;
            margin-left: 1.2rem;
            position: absolute;
            top: -0.28rem;
            color: #F4F5F9;
        }
        .margin_lef{
            margin-left: 0.2rem;
        }
        .menu{
            /*display: flex;*/
            position: absolute;
            top: 0.69rem;
            left: -1.4rem;
            z-index: 999;
        }
        .menu_color{
            color: #EA474B;
        }
    </style>
</head>
<body>
<div class="container">
    <!--头部信息-->
    <div class="head">
        <!--左图标-->
        <div class="iconfont icon-zuo">

        </div>
        <!--内容详情-->
        <div class="head_new">
            商旅服务
        </div>
        <!--右菜单-->
        <div class="iconfont icon-iconfont-edu12">
            <!--菜单栏功能-->
            <div class="menu" style="display: none;">

                <!--菜单列表-->
                <div class="head_menu">
                    <!--箭头-->
                    <div class="iconfont icon-shangsanjiao"></div>
                    <!--菜单-->
                    <div class="head_menu_item menu_index">
                        <!--图标-->
                        <div class="iconfont icon-zhuye2 margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            首页
                        </div>
                    </div>
                    <div class="head_menu_item menu_gyzh">
                        <!--图标-->
                        <div class="iconfont icon-fangzi margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            关于展品
                        </div>
                    </div>
                    <div class="head_menu_item menu_zpfw">
                        <!--图标-->
                        <div class="iconfont icon-fangkuai margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            展品范围
                        </div>
                    </div>
                    <div class="head_menu_item menu_zsml">
                        <!--图标-->
                        <div class="iconfont icon-diqiu1 margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            展商名录
                        </div>
                    </div>
                    <div class="head_menu_item menu_czsq">
                        <!--图标-->
                        <div class="iconfont icon-zuanshi margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            参展申请
                        </div>
                    </div>
                    <div class="head_menu_item menu_gzml">
                        <!--图标-->
                        <div class="iconfont icon-lanzi margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            观众名录
                        </div>
                    </div>
                    <div class="head_menu_item menu_cgdj">
                        <!--图标-->
                        <div class="iconfont icon-gouwuche1 margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            参观登记
                        </div>
                    </div>
                    <div class="head_menu_item menu_lthd">
                        <!--图标-->
                        <div class="iconfont icon-luyin margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            论坛活动
                        </div>
                    </div>
                    <div class="head_menu_item menu_xwbd">
                        <!--图标-->
                        <div class="iconfont icon-ic_language_px margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            新闻报道
                        </div>
                    </div>
                    <div class="head_menu_item menu_slfw">
                        <!--图标-->
                        <div class="iconfont icon-shuben margin_lef"></div>
                        <!--文字-->
                        <div class="head_menu_item_text">
                            商旅服务
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>


    <!--顶部菜单-->
    <div class="top">
        <div class="top_item top_color">
            交通信息
        </div>
        <div class="top_item ">
            酒店住宿
        </div>
        <div class="top_item ">
            周边美食
        </div>
        <div class="top_item ">
            天津旅游
        </div>
    </div>

    <div class="box">
        <!------------ 交通信息 ------------->
        <div class="item_a traffic" style="display: block;">
            <!--限号查询-->
            <div class="traffic_limit">
                【限号查询】
            </div>
            <!--标题-->
            <div class="traffic_title">
                天津市本地车辆限号
            </div>
            <!--表单-->
            <table>
                <tr class="date">
                </tr>
                <tr class="number">
                </tr>
            </table>

            <!--百度地图-->
            <div class="traffic_limit">
                【百度地图】
            </div>
            <!--搜索框-->
            <div class="search_box">
                <div class="traffic_search">
                    <input type="text" placeholder="梅江会展中心" id="search">
                    <div class="traffic_search_bottom">
                        <div class="iconfont icon-fangdajing"></div>
                    </div>
                </div>
                <div class="traffic_map">
                    <div id="allmap"></div>
                </div>
            </div>

            <!--地图大小-->
        </div>
    </div>

    <!--底部菜单-->
    <include file="public@footer"/>

</div>

<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=trLEKMVBCc6MKGemHlUXdyy2&s=1"></script>
<script src="__TMPL__/public/assets/js/dropload.min.js"></script>
<script src="__TMPL__/public/assets/js/footer.js"></script>
<script>
    //左边菜单功能
    $(".icon-iconfont-edu12").click(function () {
        $(".menu").slideToggle();
    });

    //返回功能
    $('.icon-zuo').click(function () {
        window.history.back();
    });

    //调用百度地图
    // 在指定容器创建地图实例并设置最大最小缩放级别
    var map = new BMap.Map("allmap", {
        minZoom: 3,
        maxZoom: 25
    });

    // 创建地图实例定位于天津市梅江会展中心
    var point = new BMap.Point(117.220656,39.046226);
    // 创建点坐标
    map.centerAndZoom(point, 14);
    // 初始化地图, 设置中心点坐标和地图级别
    var marker = new BMap.Marker(point);
    map.addOverlay(marker);


    // 开启鼠标滚轮缩放功能,仅对PC上有效
    map.enableScrollWheelZoom(true);
    // 将控件(平移缩放控件)添加到地图上
    map.addControl(new BMap.NavigationControl());
    // 为地图增加点击事件,为input赋值
    map.addEventListener("click", function(e) {
        document.getElementById('lat').value = e.point.lat;
        document.getElementById('lng').value = e.point.lng;

    });

    // 创建位置检索、周边检索和范围检索
    var local = new BMap.LocalSearch(map, {
        renderOptions: {
            map: map
        }
    });
    //检索位置
    var myGeo = new BMap.Geocoder();
    $('.traffic_search_bottom').click(function(){
        var search = $('#search').val();
        if(search != ''){
            map.clearOverlays();//清除所有覆盖物
            myGeo.getPoint(search, function(point){
                if (point) {
                    map.centerAndZoom(point, 14);
                    map.addOverlay(new BMap.Marker(point));
                }else{
                    alert("没有解析到结果,请输入详细地址!");
                }
            });
        }
    });

    //苹果input自动下滑兼容
    $("input").blur(function(){
        setTimeout(function() {
            var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
            window.scrollTo(0, Math.max(scrollHeight - 1, 0));
        }, 300);
    })
    //聚焦监听
    $('input').focus(function() {
        if((/Android/gi).test(navigator.userAgent)) {
            window.addEventListener('resize', function() {
                if(document.activeElement.tagName == 'INPUT' ||
                    document.activeElement.tagName == 'TEXTAREA') {
                    window.setTimeout(function() {
                        document.activeElement.scrollIntoViewIfNeeded();
                    }, 0);
                }
            });
        }
    });
    $(function(){
        $.ajax({
            url:"{:url('travel/carWx')}",
            type: 'GET',
            dataType: 'json',
            data:{},
            success: function(data){
                console.log(data);
                var arrLen = data.length;
                var date = '';
                var number = '';
                date += '<th>日期</th>';
                number += '<td>限尾号</td>';
                if(arrLen > 0){
                    $.each(data,function(i,val) {
                        date += '<th>'+val['date']+'<br>('+val['week']+')</th>';
                        if(val['number'] == '不限行'){
                            number += '<td>'+val['number']+'</td>';
                        }else{
                            number += '<td>限号'+val['number']+'</td>';
                        }

                    });
                    $('.date').append(date);
                    $('.number').append(number);
                }
            }
        });
    });
</script>
</body>
</html>