<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link rel="stylesheet" href="/static/weixin/css/public.css">
    <link rel="stylesheet" href="/static/weixin/css/wechat_add_new.css">
    <link rel="stylesheet" href="/static/weixin/css/basic.css">
    <script src="/static/weixin/js/flexible.js"></script>
    <title>项目/活动</title>
    <style>
        .administer-head{
            top: 1.06rem !important;
        }
    </style>
</head>
<body id="contain">
<div class="contain">
    <div class="bai-head">
        <span>项目/活动</span>
        <a href="/weixin/bill/bill-condition?product_type=${p.product_type}" class="left">
            <img src="/static/weixin/images/head-left.png"/>
        </a>
    </div>
    <div class="administer-head">
        <input id="keyword" type="text" placeholder="请输入关键字搜索">
        <span class="head-remove"></span>
        <a id="searchBtn" class="head-serach">搜索</a>
    </div>
    <div class="sd_project_activity">
        <ul>
            <%--<li>--%>
                <%--<a href="javascript:;">--%>
                    <%--<h2>厦门旅游博览会</h2>--%>
                    <%--<p>日期：2017-12-12至2018-12-11</p>--%>
                    <%--<span>地址：厦门市集美区诚毅学院</span>--%>
                <%--</a>--%>
            <%--</li>--%>

        </ul>
    </div>
</div>
</body>
<script src="/static/weixin/js/jquery-1.8.3.min.js"></script>
<script src="/static/weixin/common/layer_mobile/layer.js"></script>
<link rel="stylesheet" href="/static/weixin/common/layer_mobile/need/right.css">
<script src="/static/weixin/common/jquery.formHelper.js"></script>
<script type="text/javascript" src="/static/weixin/js/g.js"></script>
<script>
    function initEvent(){
        // 搜索框的变化
        $(".administer-head input").focus(function(){
            $('.administer-head input').css({"transition":"all ease-in .5s","width":"84.85%"});
            $(this).siblings('.head-serach').css({"right":'3.2%'});
            re_length = $(this).val().length;
            if(re_length >=1 ){
                $(".administer-head").find('.head-remove').css({"opacity":'1'});
            }
        }).blur(function(){
            sd_width = Math.ceil($('.administer-head .head-serach').width())+10;
            $('.administer-head input').css({"transition":"all ease-in .5s","width":"100%"});
            $(this).siblings('.head-serach').css({"right":-sd_width+'px'});
            $(".administer-head").find('.head-remove').css({"opacity":'0'});
        });
        $(".administer-head").find('input').on('input propertychange',function(){
            re_length = $(this).val().length;
            if(re_length >=1 ){
                $(".administer-head").find('.head-remove').css({"opacity":'1'});
            }else{
                $(".administer-head").find('.head-remove').css({"opacity":'0'});
            }
        });
        $(".administer-head .head-remove").unbind("click").click(function () {
            $(this).siblings('input').val('').focus();
        });

        $(".sd_project_activity ul li").unbind("click").click(function () {
            var sel_project = $(this).find("H2").html();
            sessionStorage.setItem("sel_project",JSON.stringify(sel_project));
            window.location.href="/weixin/bill/bill-condition?product_type=${p.product_type}";
        });

        $("#searchBtn").unbind("click").click(function(){
            refresh();
        });
    }(initEvent());
   

    /**
     * 刷新页面
     */
    function refresh(){
        g_ajax("/weixin/bill/get-project-from-bill",{keyword:$("#keyword").val()},function(json){
            console.log(json)
            var str  = "";
            for(var i in json){
                var row  = json[i];
                //目前只显示项目名称即可
                //var address = g_getRegion(row.province).province+" "+ g_getRegion(row.city).citytype +" "+g_getRegion(row.district).city+" " +json[i].address ;
                str+= '<li>'
                + '	<a href="javascript:;">'
                + '		<h2>'+row.activity_name+'</h2>'
                //+ '		<p>日期：'+row.start_time+' 至 '+row.end_time+'</p>'
                //+ '		<span>地址：'+address+'</span>'
                + '	</a>'
                + '</li>';
            }
            //g_getRegion(code)
            $(".sd_project_activity ul").html(str);
            initEvent();
        });
    }(refresh())


</script>
</html>