<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script>
  (function () {
    try {
      var sid = parseInt(localStorage.getItem('qkcms_user_id') || sessionStorage.getItem('qkcms_user_id') || '0', 10) || 0;
      if (sid > 0) document.documentElement.classList.add('qk-prelogged');
    } catch (e) { }
  })();
</script>
<link rel="stylesheet" href="/assets/css/ts_index.css" />
<script>
  (function () {
    function buildFavicon(color) {
      const svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="12" fill="' + color + '"/><text x="32" y="45" text-anchor="middle" fill="#fff" font-size="46" font-family="Arial,Helvetica,sans-serif" font-weight="900">Q</text></svg>';
      return 'data:image/svg+xml,' + encodeURIComponent(svg);
    }
    function ensureFaviconLinks() {
      var head = document.head || document.getElementsByTagName('head')[0];
      if (!head) return null;
      var existing = head.querySelectorAll('link[rel="icon"], link[rel="shortcut icon"]');
      if (existing && existing.length) return existing;
      var icon = document.createElement('link');
      icon.rel = 'icon';
      icon.type = 'image/svg+xml';
      var shortcut = document.createElement('link');
      shortcut.rel = 'shortcut icon';
      shortcut.type = 'image/svg+xml';
      head.appendChild(icon);
      head.appendChild(shortcut);
      return head.querySelectorAll('link[rel="icon"], link[rel="shortcut icon"]');
    }
    function applyFavicon() {
      const cssColor = getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim();
      const faviconColor = cssColor || '#10b981';
      const href = buildFavicon(faviconColor);
      const links = ensureFaviconLinks() || document.querySelectorAll('link[rel="icon"], link[rel="shortcut icon"]');
      links.forEach(function (link) {
        link.href = href;
      });
    }
    if (document.readyState === 'loading') {
      document.addEventListener('DOMContentLoaded', applyFavicon);
    } else {
      applyFavicon();
    }
    const observer = new MutationObserver(applyFavicon);
    observer.observe(document.documentElement, { attributes: true, attributeFilter: ['style', 'class'] });
  })();
</script>
<script defer src="/assets/js/index.js"></script>
<script defer src="/assets/js/toast.js"></script>


<header class="header">
  <div class="container">
    <nav class="nav">
      <a href="/" class="logo qk-logo-link" data-text="{qkcms:site_name}" data-logo="{qkcms:logo}">
        <span class="site-logo-text">{qkcms:site_name}</span>
        <span class="site-logo-image-wrap"><img class="site-logo-image" alt="{qkcms:site_name}" src="{qkcms:logo}"
            onerror="this.removeAttribute('src');this.closest('.qk-logo-link').setAttribute('data-logo','');" /></span>
      </a>

      <ul class="nav-links">
        {qkcms:navigation row=11}
        <li class="nav-item">
          <a href="{url}" target="{target}">{title}</a>
          {sub_navigation}
          <li><a href="{sub.url}" target="{sub.target}">{sub.title}</a></li>
        {/sub_navigation}
        </li>
        {/qkcms:navigation}

        {qkcms:catgroup row=20 order=3 filter=2}
        <li class="nav-item nav-item-{item_type}">
          <a href="{url}">{group_name}</a>
          <ul class="sub-nav">
            <div class="sub-nav-top-line"></div>
            {qkcms:categories row=100 sa=2 sort=3}
            <li><a href="{url}">{name}</a></li>
            {/qkcms:categories}
          </ul>
        </li>
        {/qkcms:catgroup}
      </ul>


      
      <div class="nav-actions">
        
        <button class="mobile-menu-btn">
          <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
            fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <line x1="3" y1="12" x2="21" y2="12"></line>
            <line x1="3" y1="6" x2="21" y2="6"></line>
            <line x1="3" y1="18" x2="21" y2="18"></line>
          </svg>
        </button>
        <div class="user-actions-container">
          <div class="login-register-buttons">
            <a href="/admin/login.php" class="btn btn-outline login-btn">登录</a>
            <a href="/admin/login.php?register=1" class="btn btn-primary register-btn">注册</a>
          </div>
          <div class="nav-user-avatar" id="userAvatar"> <img src="/assets/images/avatar.png" alt="用户头像" id="nav-avatar-img" />
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="dropdown-arrow-mobile">
              <polyline points="6 9 12 15 18 9"></polyline>
            </svg>
            <div class="user-dropdown-menu" id="userDropdownMenu">
              <div class="user-profile-section">
                <div class="user-profile-header">
                  <div class="qk-dropdown-avatar"> <img src="/assets/images/avatar.png" alt="用户头像" id="dropdown-avatar-img"
                      class="qk-dropdown-avatar-img" /> </div>
                  <div class="user-profile-info">
                    <div class="user-profile-name">未登录</div>
                    <div class="user-badge-actions">
                      <div class="user-level-badge 游客"> <span>未登录</span> </div>

                      <a href="/admin/login.php" target="_blank" class="yhzxcss user-center-btn"> 用户中心
                      </a>
                      <a href="/recharge.php" class="points-recharge-btn">充值</a>
                    </div>


                    <script>
                      // 只有当adminBtnContainer元素存在时才执行相关操作
                      var adminBtnContainer = document.getElementById('adminBtnContainer');
                      if (adminBtnContainer) {
                        var userLevel = document.querySelector('.user-level-badge span').textContent;
                        if (userLevel.indexOf('管理员') === -1) {
                          adminBtnContainer.style.display = 'none';
                        }
                      }
                    </script>
                  </div>
                </div>
              </div>



              <div class="user-menu-item">
                <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
                  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path>
                  <polyline points="22,6 12,13 2,6"></polyline>
                </svg>
                <span class="menu-label">绑定邮箱：</span> <span class="menu-value" id="menu-user-email">未绑定</span>
              </div>
              <div class="user-menu-item">
                <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
                  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <circle cx="12" cy="12" r="10"></circle>
                  <circle cx="12" cy="12" r="2"></circle>
                </svg>
                <span class="menu-label">用户积分：</span> <span class="menu-value"
                  id="menu-user-points">0</span>
              </div>
              <div class="user-menu-item">
                <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
                  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
                  <polyline points="2 17 12 22 22 17"></polyline>
                  <polyline points="2 12 12 17 22 12"></polyline>
                </svg>
                <span class="menu-label">账号状态：</span> <span class="menu-value"
                  id="menu-user-status">
                  未登录 </span>
              </div>
              <div class="user-menu-item">
                <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
                  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
                  <line x1="16" y1="2" x2="16" y2="6"></line>
                  <line x1="8" y1="2" x2="8" y2="6"></line>
                  <line x1="3" y1="10" x2="21" y2="10"></line>
                </svg>
                <span class="menu-label">注册时间：</span> <span class="menu-value"
                  id="menu-user-created-at">未登录</span>
              </div>
              <div class="user-menu-item user-logout" onclick="handleLogout()">
                <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
                  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
                  <polyline points="16 17 21 12 16 7"></polyline>
                  <line x1="21" y1="12" x2="9" y2="12"></line>
                </svg>
                <span class="menu-label">退出登录</span>
              </div>
            </div>
          </div>
        </div>
      </div>
  </div>
  </nav>
  </div>
  <script>
    // 退出登录处理函数
    function handleLogout() {
      // 触发同步退出信号
      if (window.LoginSync && window.LoginSync.triggerLogout) {
        window.LoginSync.triggerLogout();
      } else {
        // 如果LoginSync未加载，直接操作localStorage
        localStorage.setItem('qkcms_logout_sync', JSON.stringify({
          action: 'logout',
          time: Date.now()
        }));
        localStorage.removeItem('qkcms_logged_in');
        localStorage.removeItem('qkcms_user_nickname');
        localStorage.removeItem('qkcms_user_id');
        localStorage.removeItem('qkcms_user_avatar');
        localStorage.setItem('qkcms_user_logged_out', 'true');
        document.documentElement.classList.remove('qk-prelogged');
        document.body.classList.remove('logged-in');
        if (window.updateNavbarLoginStatus) {
          window.updateNavbarLoginStatus(false);
        }
      }
      // 发送服务器端退出请求
      try {
        fetch('/login.php?action=logout', {
          method: 'POST',
          credentials: 'include',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'X-Requested-With': 'XMLHttpRequest'
          }
        }).then(() => { })
          .catch(error => { });
      } catch (e) {
      }
    }

    // 绑定登录注册弹窗
    document.addEventListener('DOMContentLoaded', function () {
      const loginLinks = document.querySelectorAll('a[href*="admin/login.php"]:not([href*="register=1"]):not([href*="action=logout"])');
      const registerLinks = document.querySelectorAll('a[href*="register=1"][href*="admin/login.php"]');

      loginLinks.forEach(link => {
        if (link.getAttribute('data-qk-login-bound') === '1') return;
        link.setAttribute('data-qk-login-bound', '1');
        link.addEventListener('click', function (e) {
          if (window.QKModal && typeof window.QKModal.show === 'function') {
            e.preventDefault();
            const redirectUrl = window.location.href;
            window.QKModal.show('login', '/admin/login.php?redirect=' + encodeURIComponent(redirectUrl), {
              title: '用户登录',
              width: '400px',
              height: '450px'
            });
          } else {
            // 模态不可用时，保持默认跳转行为
          }
        });
      });

      registerLinks.forEach(link => {
        if (link.getAttribute('data-qk-login-bound') === '1') return;
        link.setAttribute('data-qk-login-bound', '1');
        link.addEventListener('click', function (e) {
          if (window.QKModal && typeof window.QKModal.show === 'function') {
            e.preventDefault();
            const redirectUrl = window.location.href;
            window.QKModal.show('login', '/admin/login.php?register=1&redirect=' + encodeURIComponent(redirectUrl), {
              title: '用户注册',
              width: '400px',
              height: '450px'
            });
          } else {
            // 模态不可用时，保持默认跳转行为
          }
        });
      });

    });
  </script>
</header>
<script>
  document.addEventListener('DOMContentLoaded', function() {
    var navLinks = document.querySelectorAll('.nav-links a');
    var currentUrl = window.location.href;
    
    navLinks.forEach(function(link) {
      var linkUrl = link.href;
      
      if (linkUrl && linkUrl !== '#' && linkUrl !== '') {
        if (currentUrl === linkUrl || currentUrl.startsWith(linkUrl + '/') || currentUrl.startsWith(linkUrl + '?')) {
          link.classList.add('active');
        }
      }
    });
  });
</script>
<div class="search-container">
  <div class="container">
    <div class="search-wrapper">
      <input type="text" placeholder="" id="search-input" class="search-input">
      <button id="search-button" class="search-button"> <span class="icon search"></span> </button>
    </div>
  </div>
</div>
