审查视图

application/home/view/index/index.html 5.6 KB
王晓刚 authored
1 2 3 4 5
<!DOCTYPE html>
<html lang="en">

{include file="public/head"/}
<link rel="stylesheet" href="__CDN__/assets/advertising/css/index.css">
王晓刚 authored
6
<link rel="stylesheet" href="__CDN__/assets/advertising/css/swiper.min.css">
王晓刚 authored
7 8 9 10 11 12 13 14 15 16
<style>
    .empty_data{
        color: #8C9198;
        text-align: center;
        margin: 0 auto;
    }
</style>
<body>
<div class="index clearfix">
    <div class="banner">
王晓刚 authored
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
        <div class="swiper-container swiper-container-horizontal banner_img">
            <div class="swiper-wrapper">
                <foreach>

                </foreach>
                <div class="swiper-slide swiper-slide-active">
                    <img src="__CDN__/assets/advertising/img/sun_01@2x.png" alt="">
                </div>
                <div class="swiper-slide swiper-slide-next">
                    <img src="__CDN__/assets/advertising/img/sun_01@2x.png" alt="">
                </div>
                <div class="swiper-slide">
                    <img src="__CDN__/assets/advertising/img/sun_01@2x.png" alt="">
                </div>
                <div class="swiper-slide">
                    <img src="__CDN__/assets/advertising/img/sun_01@2x.png" alt="">
                </div>
                <div class="swiper-slide">
                    <img src="__CDN__/assets/advertising/img/sun_01@2x.png" alt="">
                </div>
            </div>
            <div class="swiper-pagination swiper-pagination-white swiper-pagination-clickable swiper-pagination-bullets"></div>
王晓刚 authored
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
        </div>
    </div>
    <!-- 列表 -->
    <div class="content_list">
        <div id="dom">
            {foreach name="$data" item="vo"}
            <div class="content_single" onclick="detail('{$vo.id}')">
                <div class="single_title">{$vo.goods_name}</div>
                <div class="single_coupon">{$vo.exp}红包券</div>
                <div class="layout justify flex_row align_center">
                    <div class="single_date">截止日期: {$vo.end_time}</div>
                    <div class="single_btn">可参与</div>
                </div>
            </div>
            {/foreach}
        </div>
        {empty name="$data"}
            <div class="empty_data">
王晓刚 authored
57
                暂无数据
王晓刚 authored
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
            </div>
        {/empty}
        {notempty name="$data"}
            <div class="load_more layout align_center justify_center">
                <div>加载更多</div>
                <div class="layout align_center justify_center">
                    <img src="__CDN__/assets/advertising/img/right.png" alt="">
                </div>
            </div>
            <!--当前页-->
            <input type="hidden" id="page" value="1"/>
        {/notempty}
    </div>

    {include file="public/nav"/}
</div>
{include file="public/js" /}
王晓刚 authored
75
<script src="__CDN__/assets/advertising/js/swiper.min.js"></script>
王晓刚 authored
76
<script>
王晓刚 authored
77 78 79 80 81 82 83 84 85
    //幻灯片
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        loop: true,
        autoplay: true,
        spaceBetween: 0,
        autoplay: 3000,
    });
王晓刚 authored
86 87 88 89
    //进入详情页
    function detail(goods_id){
        window.location.href = "{:url('home/goods/detail',array('goods_id'=>'GOODS_ID'),false,true)}".replace('GOODS_ID',goods_id);
    }
王晓刚 authored
90
    //加载更多
王晓刚 authored
91 92 93 94 95 96 97 98 99 100
    $(".load_more").click(function () {
        var page = $('#page').val();
        page++;
        $.ajax({
            url:"{:url('home/index/more')}",
            type:"POST",
            data:{'page':page},
            success:function(res){
                if(res.code == 1){
                    if(res.data == ''){
王晓刚 authored
101 102
                        $('.justify_center').html("<div>没有更多了~</div>");
                        toast('没有更多了~');
王晓刚 authored
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
                        return;
                    }
                    var html = "";
                    $(res.data).each(function (key, vo) {
                        html += "<div class=\"content_single\" onclick=\"detail('"+vo.id+"')\">\n" +
                            "                <div class=\"single_title\">"+vo.goods_name+"</div>\n" +
                            "                <div class=\"single_coupon\">"+vo.exp+"红包券</div>\n" +
                            "                <div class=\"layout justify flex_row align_center\">\n" +
                            "                    <div class=\"single_date\">截止日期: "+vo.end_time+"</div>\n" +
                            "                    <div class=\"single_btn\">可参与</div>\n" +
                            "                </div>\n" +
                            "            </div>";
                    });
                    $('#dom').append(html);
                    $('#page').val(page);
                }else{
                    toast('与服务器断开连接');
                }
            },
            error:function(){
                toast('与服务器断开连接');
            }
        })
    })

    // 地图定位
    // var geolocation = new qq.maps.Geolocation("LQNBZ-F3L34-EQMUR-DILMD-LBR4Q-GDFOH", "myapp");
    // var positionNum = 0;
    // var options = {
    //     timeout: 5000
    // };

    // function showPosition(position) {
    //     var city = position.city; //城市
    //     var addr = position.addr; //详细地址
    //     var lat = position.lat; //
    //     var lng = position.lng; //经纬度
    // }

    // function showErr() {
    //     Toast.init();
    //     Toast.show('定位失败', 'success', null);
    //     setTimeout(function() {
    //         Toast.hide();
    //     }, 20000);
    // };
    // $(function() { //定位
    //     geolocation.getLocation(showPosition, showErr, options);
    // })
</script>
</body>


</html>