<?php
/**
 * Author：晴天 QQ：1186258278
 * Creation：2020/3/6 15:55
 * Filename：index.php
 * 简约app模板
 */
if (!defined('IN_CRONLITE')) die();
$ar_data = [];
$re = $DB->query("SELECT * FROM `sky_class` WHERE `state` = 1 ORDER BY `sort` DESC ");
while ($res = $DB->fetch($re)) {
    $ar_data[] = $res;
}
?>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
    <title><?= $conf['sitename'] ?></title>
    <meta name="keywords" content="<?= $conf['keywords'] ?>">
    <meta name="description" content="<?= $conf['description'] ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo $cdnserver; ?>assets/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="<?php echo $cdnserver; ?>assets/AppStore/css/style.css"/>
    <link href="<?= $cdnpublic ?>Swiper/4.5.1/css/swiper.min.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="<?php echo $cdnpublic ?>html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="<?php echo $cdnpublic ?>respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body>

<section class="jq22-flexView">
    <header class="jq22-navBar jq22-navBar-fixed">
        <a href="user/" class="jq22-navBar-item" title="进入后台">
            <?= ($USERDATA == false ? '游客' : '<img src="' . $USERDATA['image'] . '" />'); ?>
        </a>
        <div class="jq22-center">
            <div class="jq22-search-box">
                <input type="text" id="so" style="text-indent: 0em;padding-left:1em" placeholder="搜寻商品">
            </div>
        </div>
        <a href="javascript:location.href='./?name='+$('#so').val()" class="jq22-navBar-item">
            <i class="layui-icon layui-icon-search" style="color: #ff5a7c;font-size: 2em"></i>
        </a>
    </header>
    <section class="jq22-scrollView">
        <div class="m-slider" data-ydui-slider>
            <div class="swiper-container" style="width: 100%;max-height: 18em">
                <div class="swiper-wrapper" id="picture">
                    <?php
                    $banner = explode('|', $conf['banner']);
                    foreach ($banner as $v) {
                        $image_url = explode('*', $v);
                        echo '<div class="swiper-slide"><a target="_blank" href="' . $image_url['1'] . '">
                                <img src="' . $image_url['0'] . '"  />
                            </a></div>';
                    }
                    ?>
                </div>
                <!-- Add Pagination -->
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <div class="swiper-container-class" style="width: 100%;max-height: 148px">
            <div class="swiper-wrapper" style="max-height: 148px">
                <?php
                $arry = 0;
                $au = 1;
                foreach ($ar_data as $v) {
                    if (($arry / 10) == ($au - 1)) { //循环首
                        echo '<div class="swiper-slide">
                                   <div class="jq22-palace">';
                    }
                    echo '<a href="?cid=' . $v['cid'] . '" class="jq22-palace-grid">
                                <div class="jq22-palace-grid-icon">
                                    <img style="width: 35px;height: 35px" src="' . $v['image'] . '"  onerror="this.src=\'/assets/cloud/image/error_img.png\'">
                                </div>
                                <div class="jq22-palace-grid-text">
                                    <h2 style="height: 1.5em;line-height: 1.5em" class="layui-elip">' . $v['name'] . '</h2>
                                </div>
                           </a>';
                    if ((($arry + 1) / 10) == ($au)) { //循环尾
                        echo '</div></div>';
                        $au++;
                        $_SESSION['au'] = $au;
                    }
                    $arry++;
                    $_SESSION['arry'] = $arry;
                }
                if (floor((($_SESSION['arry']) / 10)) != (($_SESSION['arry']) / 10)) {
                    echo '</div></div>';
                }
                ?>
            </div>
        </div>

        <div class="divHeight"></div>
        <div class="jq22-good-list" id="gid"></div>
        <div style="height:55px"></div>
    </section>
    <footer class="jq22-footer jq22-footer-fixed">
        <a href="/" class="jq22-tabBar-item jq22-tabBar-item-active">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-home"></i>
                </span>
            <span class="jq22-tabBar-item-text">首页</span>
        </a>
        <a href="/?mod=query" class="jq22-tabBar-item ">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-news"></i>
                </span>
            <span class="jq22-tabBar-item-text">查单</span>
        </a>
        <a href="?mod=article" class="jq22-tabBar-item ">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-pic"></i>
                </span>
            <span class="jq22-tabBar-item-text">文章</span>
        </a>
        <a href="user" class="jq22-tabBar-item ">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-mine"></i>
                </span>
            <span class="jq22-tabBar-item-text">我的</span>
        </a>
    </footer>

</section>
<script src="<?php echo $cdnpublic ?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnserver; ?>assets/layui/layui.all.js"></script>
<script src="<?= $cdnpublic ?>Swiper/4.5.1/js/swiper.min.js"></script>
<script src="<?php echo $cdnserver; ?>assets/js/main.js?var=<?= $accredit['versions'] ?>"></script>
<script src="/template/AppStore/template.js?var=<?= $accredit['versions'] ?>"></script>
<script>
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 1,
        spaceBetween: 30,
        loop: true,
        pagination: {
            el: '.swiper-pagination',
            dynamicBullets: true,
        }
    });
    var swiper = new Swiper('.swiper-container-class', {
        slidesPerView: 1,
        spaceBetween: 30,
        loop: true,
    });
</script>
</body>
</html>
