434 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			434 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<div style="display: flex;flex-direction: column;">
 | 
						|
    <div class="topbar-one">
 | 
						|
        <div class="container">
 | 
						|
            <div style="width: 70%;">
 | 
						|
                <ul class="list-unstyled topbar-one__info">
 | 
						|
                    <li class="topbar-one__info__item">
 | 
						|
                        <span class="topbar-one__info__icon fas fa-phone-alt" style="margin-right: 10px;"></span>
 | 
						|
                        <a href="{$config['admin_phone']}">{$config['admin_phone']}</a>
 | 
						|
                    </li>
 | 
						|
                    <li class="topbar-one__info__item">
 | 
						|
                        <span class="topbar-one__info__icon fas fa-envelope" style="margin-right: 10px;"></span>
 | 
						|
                        <a href="mailto:{$config['admin_email']}">{$config['admin_email']}</a>
 | 
						|
                    </li>
 | 
						|
                </ul>
 | 
						|
            </div>
 | 
						|
            <div class="topbar-one__social" style="width: 30%;">
 | 
						|
                <a href="/index/user/login" class="mr-10"><i class="layui-icon layui-icon-username"></i> 登录</a>
 | 
						|
                <a href="/index/user/register" class="mr-10"><i class="layui-icon layui-icon-user"></i> 注册</a>
 | 
						|
                <a href="javascript:;" class="qrcode-trigger"><i class="layui-icon layui-icon-qrcode"></i> 公众号</a>
 | 
						|
                <div class="qrcode-popup"
 | 
						|
                    style="display:none;position:absolute;right:54px;top:32px;background:#fff;padding:10px;box-shadow:0 0 10px rgba(0,0,0,0.1); z-index: 1000;">
 | 
						|
                    <img src="{$config['admin_wechat']}" alt="公众号二维码" style="width:180px;height:180px;">
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </div>
 | 
						|
    <!-- 导航栏 -->
 | 
						|
    <div class="main-menu">
 | 
						|
        <div class="container">
 | 
						|
            <div class="main-menu__logo">
 | 
						|
                <a href="index.html"><img src="{$config['logo1']}" width="186" alt="Logo"></a>
 | 
						|
            </div>
 | 
						|
            <div class="main-menu__nav">
 | 
						|
                <ul class="main-menu__list">
 | 
						|
                    <li><a href="/index.html">首页</a></li>
 | 
						|
                    <li><a href="/about.html">关于我们</a></li>
 | 
						|
                    <li><a href="/products.html">产品服务</a></li>
 | 
						|
                    <li><a href="/contact.html">联系我们</a></li>
 | 
						|
                </ul>
 | 
						|
            </div>
 | 
						|
            <div class="main-menu__right">
 | 
						|
                <div class="layui-inline">
 | 
						|
                    <div class="layui-inline" style="position: relative;">
 | 
						|
                        <img src="__IMAGES__/avatar.webp" class="layui-circle"
 | 
						|
                            style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarMain">
 | 
						|
                        <div class="user-dropdown" id="userDropdownMain">
 | 
						|
                            <ul>
 | 
						|
                                <li>
 | 
						|
                                    <a href="/index/user/profile"><i
 | 
						|
                                            class="layui-icon layui-icon-user"></i><span>个人中心</span></a>
 | 
						|
                                </li>
 | 
						|
                                <li>
 | 
						|
                                    <a href="/index/user/settings"><i
 | 
						|
                                            class="layui-icon layui-icon-set"></i><span>账号管理</span></a>
 | 
						|
                                </li>
 | 
						|
                                <li>
 | 
						|
                                    <a href="javascript:;" class="logout-btn"><i
 | 
						|
                                            class="layui-icon layui-icon-logout"></i><span>退出登录</span></a>
 | 
						|
                                </li>
 | 
						|
                            </ul>
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </div>
 | 
						|
    <div class="main-header">
 | 
						|
        <!-- Banner轮播 -->
 | 
						|
        <div class="layui-carousel" id="test10" lay-filter="test10">
 | 
						|
            <div carousel-item="">
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </div>
 | 
						|
</div>
 | 
						|
 | 
						|
<!-- 固定导航 -->
 | 
						|
<div class="sticky-nav" style="display: none;">
 | 
						|
    <div class="container">
 | 
						|
        <div class="sticky-nav__logo">
 | 
						|
            <a href="index.html"><img src="{$config['logo1']}" width="150" alt="Logo"></a>
 | 
						|
        </div>
 | 
						|
        <div class="sticky-nav__menu">
 | 
						|
            <ul>
 | 
						|
                <li><a href="/index.html">首页</a></li>
 | 
						|
                <li><a href="/about.html">关于我们</a></li>
 | 
						|
                <li><a href="/products.html">产品服务</a></li>
 | 
						|
                <li><a href="/contact.html">联系我们</a></li>
 | 
						|
            </ul>
 | 
						|
        </div>
 | 
						|
        <div class="sticky-nav__right">
 | 
						|
            <div class="main-menu__right">
 | 
						|
                <div class="layui-inline">
 | 
						|
                    <div class="layui-inline" style="position: relative;">
 | 
						|
                        <img src="__IMAGES__/avatar.webp" class="layui-circle"
 | 
						|
                            style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarSticky">
 | 
						|
                        <div class="user-dropdown" id="userDropdownSticky">
 | 
						|
                            <ul>
 | 
						|
                                <li>
 | 
						|
                                    <a href="/index/user/profile"><i
 | 
						|
                                            class="layui-icon layui-icon-user"></i><span>个人中心</span></a>
 | 
						|
                                </li>
 | 
						|
                                <li>
 | 
						|
                                    <a href="/index/user/settings"><i
 | 
						|
                                            class="layui-icon layui-icon-set"></i><span>账号管理</span></a>
 | 
						|
                                </li>
 | 
						|
                                <li>
 | 
						|
                                    <a href="javascript:;" class="logout-btn"><i
 | 
						|
                                            class="layui-icon layui-icon-logout"></i><span>退出登录</span></a>
 | 
						|
                                </li>
 | 
						|
                            </ul>
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </div>
 | 
						|
</div>
 | 
						|
 | 
						|
<style>
 | 
						|
    /* 用户头像样式 */
 | 
						|
    #userAvatar {
 | 
						|
        width: 40px;
 | 
						|
        height: 40px;
 | 
						|
        cursor: pointer;
 | 
						|
        transition: all 0.3s ease;
 | 
						|
    }
 | 
						|
 | 
						|
    #userAvatar:hover {
 | 
						|
        transform: scale(1.05);
 | 
						|
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单容器 */
 | 
						|
    .user-dropdown {
 | 
						|
        position: absolute;
 | 
						|
        top: 50px;
 | 
						|
        right: 0;
 | 
						|
        width: 160px;
 | 
						|
        background: #fff;
 | 
						|
        border-radius: 4px;
 | 
						|
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
 | 
						|
        opacity: 0;
 | 
						|
        visibility: hidden;
 | 
						|
        transform: translateY(-10px);
 | 
						|
        transition: all 0.3s ease;
 | 
						|
        z-index: 9999;
 | 
						|
    }
 | 
						|
 | 
						|
    .user-dropdown.show {
 | 
						|
        opacity: 1;
 | 
						|
        visibility: visible;
 | 
						|
        transform: translateY(0);
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单列表 */
 | 
						|
    .user-dropdown ul {
 | 
						|
        margin: 0;
 | 
						|
        padding: 5px 0;
 | 
						|
        list-style: none;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单项 */
 | 
						|
    .user-dropdown li {
 | 
						|
        margin: 0;
 | 
						|
        padding: 0;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单链接 */
 | 
						|
    .user-dropdown li a {
 | 
						|
        display: flex;
 | 
						|
        align-items: center;
 | 
						|
        padding: 10px 15px;
 | 
						|
        color: #333;
 | 
						|
        text-decoration: none;
 | 
						|
        transition: all 0.3s ease;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单图标 */
 | 
						|
    .user-dropdown li a i {
 | 
						|
        margin-right: 10px;
 | 
						|
        font-size: 16px;
 | 
						|
        color: #666;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单文字 */
 | 
						|
    .user-dropdown li a span {
 | 
						|
        font-size: 14px;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 下拉菜单悬停效果 */
 | 
						|
    .user-dropdown li a:hover {
 | 
						|
        background: #f5f5f5;
 | 
						|
        color: #1E9FFF;
 | 
						|
    }
 | 
						|
 | 
						|
    .user-dropdown li a:hover i {
 | 
						|
        color: #1E9FFF;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 分隔线 */
 | 
						|
    .user-dropdown li:not(:last-child) {
 | 
						|
        border-bottom: 1px solid #f0f0f0;
 | 
						|
    }
 | 
						|
 | 
						|
    #userDropdownSticky a {
 | 
						|
        color: #0d6efd !important;
 | 
						|
    }
 | 
						|
 | 
						|
    /* Banner样式 */
 | 
						|
    .banner-content {
 | 
						|
        position: relative;
 | 
						|
        width: 100%;
 | 
						|
        height: 100%;
 | 
						|
        overflow: hidden;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-image {
 | 
						|
        position: absolute;
 | 
						|
        top: 0;
 | 
						|
        left: 0;
 | 
						|
        width: 100%;
 | 
						|
        height: 100%;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-image img {
 | 
						|
        width: 100%;
 | 
						|
        height: 100%;
 | 
						|
        object-fit: cover;
 | 
						|
        object-position: center;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-text {
 | 
						|
        position: absolute;
 | 
						|
        top: 40%;
 | 
						|
        left: 10%;
 | 
						|
        z-index: 1;
 | 
						|
        display: flex;
 | 
						|
        flex-direction: column;
 | 
						|
        align-items: flex-start;
 | 
						|
        color: #fff;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-text a {
 | 
						|
        text-decoration: none;
 | 
						|
        margin-top: 30px;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-title {
 | 
						|
        font-size: 4em;
 | 
						|
        font-weight: 600;
 | 
						|
        margin-bottom: 10px;
 | 
						|
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-desc {
 | 
						|
        font-size: 2em;
 | 
						|
        font-weight: 400;
 | 
						|
        max-width: 800px;
 | 
						|
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-btn {
 | 
						|
        background: #fff;
 | 
						|
        color: #000;
 | 
						|
        padding: 10px 20px;
 | 
						|
        border-radius: 5px;
 | 
						|
        cursor: pointer;
 | 
						|
        transition: all 0.3s ease;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-btn:hover {
 | 
						|
        background: #000;
 | 
						|
        color: #fff;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-slider {
 | 
						|
        width: 100%;
 | 
						|
        height: 86vh;
 | 
						|
        overflow: hidden;
 | 
						|
        position: relative;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-container {
 | 
						|
        width: 100%;
 | 
						|
        height: 100%;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-slide {
 | 
						|
        display: block;
 | 
						|
        width: 100%;
 | 
						|
        height: 100%;
 | 
						|
    }
 | 
						|
 | 
						|
    .banner-slide img {
 | 
						|
        width: 100%;
 | 
						|
        height: 100%;
 | 
						|
        object-fit: cover;
 | 
						|
        /* 关键:等比缩放并铺满 */
 | 
						|
        display: block;
 | 
						|
    }
 | 
						|
 | 
						|
    .layui-carousel {
 | 
						|
        background: #f8f8f8;
 | 
						|
        margin: 0;
 | 
						|
        padding: 0;
 | 
						|
    }
 | 
						|
 | 
						|
    /* 确保轮播容器和项目的高度正确 */
 | 
						|
    #test10,
 | 
						|
    #test10 [carousel-item],
 | 
						|
    #test10 [carousel-item]>* {
 | 
						|
        height: 86vh !important;
 | 
						|
    }
 | 
						|
 | 
						|
    #test10 [carousel-item]>* {
 | 
						|
        background: none !important;
 | 
						|
    }
 | 
						|
</style>
 | 
						|
 | 
						|
<script>
 | 
						|
    layui.use(['carousel', 'form', 'layer'], function () {
 | 
						|
        var carousel = layui.carousel, form = layui.form, layer = layui.layer, $ = layui.$;
 | 
						|
 | 
						|
        // 加载banner数据
 | 
						|
        $.ajax({
 | 
						|
            url: '/index/index/bannerlist',
 | 
						|
            type: 'GET',
 | 
						|
            success: function (res) {
 | 
						|
                if (res.code === 1) {
 | 
						|
                    var bannerHtml = '';
 | 
						|
                    res.banner.forEach(function (banner) {
 | 
						|
                        bannerHtml += '<div>' +
 | 
						|
                            '<div class="banner-content">' +
 | 
						|
                            '<div class="banner-image">' +
 | 
						|
                            '<img src="' + banner.image + '" alt="' + (banner.title || '') + '">' +
 | 
						|
                            '</div>' +
 | 
						|
                            '<div class="banner-text">' +
 | 
						|
                            '<span class="banner-title">' + (banner.title || '') + '</span>' +
 | 
						|
                            '<span class="banner-desc">' + (banner.desc || '') + '</span>' +
 | 
						|
                            '<a href="' + (banner.url || 'javascript:;') + '" class="banner-slide">' +
 | 
						|
                            '<span class="banner-btn">查看详情</span>' +
 | 
						|
                            '</a>' +
 | 
						|
                            '</div>' +
 | 
						|
                            '</div>' +
 | 
						|
                            '</div>';
 | 
						|
                    });
 | 
						|
                    $('#test10 div[carousel-item]').html(bannerHtml);
 | 
						|
 | 
						|
                    // 图片轮播
 | 
						|
                    carousel.render({
 | 
						|
                        elem: '#test10',
 | 
						|
                        width: '100%',
 | 
						|
                        height: '100vh',
 | 
						|
                        interval: 4000,
 | 
						|
                        anim: 'fade',
 | 
						|
                        autoplay: true,
 | 
						|
                        full: false,
 | 
						|
                        arrow: 'hover'
 | 
						|
                    });
 | 
						|
                }
 | 
						|
            }
 | 
						|
        });
 | 
						|
 | 
						|
        $(document).ready(function () {
 | 
						|
            // 主导航头像
 | 
						|
            $("#userAvatarMain").click(function (e) {
 | 
						|
                e.stopPropagation();
 | 
						|
                $("#userDropdownMain").toggleClass("show");
 | 
						|
                $("#userDropdownSticky").removeClass("show"); // 保证只显示一个
 | 
						|
            });
 | 
						|
            // 固定导航头像
 | 
						|
            $("#userAvatarSticky").click(function (e) {
 | 
						|
                e.stopPropagation();
 | 
						|
                $("#userDropdownSticky").toggleClass("show");
 | 
						|
                $("#userDropdownMain").removeClass("show"); // 保证只显示一个
 | 
						|
            });
 | 
						|
 | 
						|
            // 点击页面其他地方隐藏所有菜单
 | 
						|
            $(document).click(function (e) {
 | 
						|
                if (!$(e.target).closest('.user-dropdown, #userAvatarMain, #userAvatarSticky').length) {
 | 
						|
                    $("#userDropdownMain, #userDropdownSticky").removeClass("show");
 | 
						|
                }
 | 
						|
            });
 | 
						|
 | 
						|
            // 点击菜单项时隐藏菜单
 | 
						|
            $("#userDropdownMain li a, #userDropdownSticky li a").click(function () {
 | 
						|
                $("#userDropdownMain, #userDropdownSticky").removeClass("show");
 | 
						|
            });
 | 
						|
        });
 | 
						|
 | 
						|
        // 退出登录
 | 
						|
        $('.logout-btn').on('click', function () {
 | 
						|
            layer.confirm('确定要退出登录吗?', {
 | 
						|
                btn: ['确定', '取消']
 | 
						|
            }, function () {
 | 
						|
                window.location.href = '/index/user/logout';
 | 
						|
            });
 | 
						|
        });
 | 
						|
 | 
						|
        // 监听滚动事件
 | 
						|
        $(window).scroll(function () {
 | 
						|
            var scrollTop = $(window).scrollTop();
 | 
						|
            if (scrollTop > 150) { // 当滚动超过150px时显示固定导航
 | 
						|
                $('.sticky-nav').fadeIn();
 | 
						|
            } else {
 | 
						|
                $('.sticky-nav').fadeOut();
 | 
						|
            }
 | 
						|
        });
 | 
						|
 | 
						|
        // 公众号二维码
 | 
						|
        const trigger = document.querySelector('.qrcode-trigger');
 | 
						|
        const popup = document.querySelector('.qrcode-popup');
 | 
						|
 | 
						|
        // 鼠标移入显示二维码
 | 
						|
        trigger.addEventListener('mouseenter', function () {
 | 
						|
            popup.style.display = 'block';
 | 
						|
        });
 | 
						|
 | 
						|
        // 鼠标移出隐藏二维码
 | 
						|
        trigger.addEventListener('mouseleave', function () {
 | 
						|
            popup.style.display = 'none';
 | 
						|
        });
 | 
						|
 | 
						|
        // 鼠标移入二维码区域时保持显示
 | 
						|
        popup.addEventListener('mouseenter', function () {
 | 
						|
            popup.style.display = 'block';
 | 
						|
        });
 | 
						|
 | 
						|
        // 鼠标移出二维码区域时隐藏
 | 
						|
        popup.addEventListener('mouseleave', function () {
 | 
						|
            popup.style.display = 'none';
 | 
						|
        });
 | 
						|
    });
 | 
						|
</script> |