index.html 4.7 KB
{extend name="layout/default"}
{block name="title"}人才服务{/block}

{block name="content"}
    <div class="main">
        <div class="talentBox">
            <a href="/api/talent/initiate_2?style=1">
                <div class="talent_hair">
                    <div class="tender_hairImg"><img src="/static/image/icon21.png" alt=""></div>
                    <p class="tender_hairTxt">发起求职</p>
                </div>
            </a>
            <a href="/api/talent/initiate_1?style=0">
                <div class="talent_hair">
                    <div class="tender_hairImg"><img src="/static/image/icon22.png" alt=""></div>
                    <p class="tender_hairTxt">发起招聘</p>
                </div>
            </a>
        </div>
        <div class="list_nav">
            {foreach $left as $le}
            <div class="list_navLi">
                <a href="/api/talent/index?pid={$le.id}">
                    <p class="{$pid==$le['id']?'list_active':''} list_navTxt">{$le.title}</p>
                </a>
            </div>
            {/foreach}
        </div>
        <!-- 列表 -->
        <div class="list_item">
            <ul id="talent_List2">
                {foreach($list as $l) }
                <li>
                    <div class="list_Img"><img src="{$l.image}" alt=""></div>
                    <div class="list_Box">
                        <div class="list_Txt txt-cut">{$l.title}</div>
                        <div class="list_Box2">
                            <p class="list_Txt2 ">{$l.createtime}</p>
                            <a class="list_Txt3" href="/api/talent/detail?id={$l.id}">[详情]</a>
                        </div>
                    </div>
                </li>
                {/foreach}
            </ul>
        </div>
    </div>
    <script>
        $('.list_navLi').click(function() {
            $(".list_navdown").show();
            $(this).find('.list_navTxt').addClass('list_active').parents('.list_navLi').siblings().find('.list_navTxt').removeClass('list_active');
        });
        //上拉加载
        var page = 2;
        var data_status = true;
        var pid="{$pid}";
        $('.list_navLi').click(function() {
            $(".list_navdown").show();
            $(this).find('.list_navTxt').addClass('list_active').parents('.list_navLi').siblings().find('.list_navTxt').removeClass('list_active');
        });
        function ajax2(data) {
            ajax("/api/talent/index",data,"post",function (res) {
                var html="";
                if(page==res.msg.last_page){
                    data_status=false;
                }else{
                    data_status=true;
                }
                var msg=res.msg.data;
                var num=msg.length;
                for(var i=0;i<num;i++) {
                    var res = msg[i];
                    var image="";
                    if(res['image']!=""){
                        image=res['image'];
                    }
                    var title="";
                    if(res['title']!=""){
                        title=res['title'];
                    }
                    var createtime="";
                    if(res['createtime']!=""){
                        createtime=res['createtime'];
                    }
                    html+='<li>'+
                        '                    <div class="list_Img"><img src='+image+' alt=""></div>'+
                        '                    <div class="list_Box">'+
                        '<div class="list_Txt txt-cut">'+title+'</div>'+
                        '                        <div class="list_Box2">'+
                        '                            <p class="list_Txt2 ">'+createtime+'</p>'+
                        '                            <a class="list_Txt3" href="/api/talent/detail?id='+res['id']+'">[详情]</a>'+
                        '                        </div>'+
                        '                    </div>'+
                        '                </li>';
                }
                $("#talent_List2").append(html);
            },"false");
        }

        function get_data(page) {
            var data = {
                page: page,
                pid:pid
            };
            ajax2(data);
        };
        get_data(page)
        //滚动事件触发
        window.onscroll = function(ev) {
            if (getScrollTop() + getClientHeight() >= getScrollHeight() && data_status) {
                // 后台数据调用
                if (data_status === true) {
                    ++page;
                    get_data(page);
                }
            } else if (getScrollTop() + getClientHeight() >= getScrollHeight() && !data_status) {
                w("无更多数据")
            }
        };
    </script>
{/block}