All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 4s
1407 lines
39 KiB
HTML
1407 lines
39 KiB
HTML
<style>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
font-family: '微软雅黑', sans-serif;
|
||
}
|
||
|
||
body {
|
||
overflow-x: hidden;
|
||
|
||
}
|
||
|
||
a {
|
||
text-decoration: none;
|
||
}
|
||
.header {
|
||
position: fixed;
|
||
top:0;
|
||
z-index: 999;
|
||
width:100%;
|
||
background: #fff;
|
||
font-size: 16px;
|
||
}
|
||
/* 导航外容器:1920px宽,居中 */
|
||
.header-nav-outer {
|
||
max-width: 1920px;
|
||
position: relative;
|
||
padding: 0 12.5em;
|
||
overflow: visible;
|
||
height: 64px;
|
||
background: #fff;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
/* 顶部导航栏:内容区带左右边距,外框1920px */
|
||
.header-nav-bar {
|
||
width: 100%;
|
||
max-width: 1520px;
|
||
height: 4em;
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: nowrap;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.header-log {
|
||
width: 6.9375em;
|
||
height: 1.75em;
|
||
margin-right: 9.125em;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.header-nav-items {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
height: 100%;
|
||
flex-wrap: nowrap;
|
||
flex: 1;
|
||
min-width: 0;
|
||
margin-right: 5.125em;
|
||
}
|
||
|
||
.header-nav-item {
|
||
height: 100%;
|
||
display: flex;
|
||
align-items: center;
|
||
cursor: pointer;
|
||
color: #1d1d1f;
|
||
flex-shrink: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.header-nav-title {
|
||
position: relative;
|
||
height: 100%;
|
||
font-size: 1em;
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: nowrap;
|
||
white-space: nowrap;
|
||
padding: 0 0.3em;
|
||
}
|
||
|
||
/* 导航项下划线 */
|
||
.header-nav-title::after {
|
||
content: '';
|
||
position: absolute;
|
||
bottom: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 0.125em;
|
||
background-color: #004bfa;
|
||
transform: scaleX(0);
|
||
transition: transform 0.2s ease;
|
||
}
|
||
|
||
.header-nav-title:hover::after,
|
||
.header-nav-title.active::after {
|
||
transform: scaleX(1);
|
||
}
|
||
|
||
.header-nav-title.active {
|
||
color: #004bfa;
|
||
}
|
||
|
||
/* 右侧功能按钮 */
|
||
.header-nav-actions {
|
||
margin-left: auto;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 2em;
|
||
position: relative;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
/* 搜索按钮容器 */
|
||
.header-search-wrapper {
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
|
||
/* 语言按钮容器 */
|
||
.header-lang-wrapper {
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
|
||
/* 购买按钮容器 */
|
||
.header-buy-wrapper {
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
|
||
.header-nav-btn {
|
||
cursor: pointer;
|
||
display: flex;
|
||
align-items: center;
|
||
transition: color 0.2s;
|
||
}
|
||
|
||
.header-nav-btn img {
|
||
width: 1.5em;
|
||
max-width: 24px;
|
||
max-height: 24px;
|
||
height: 1.5em;
|
||
}
|
||
|
||
.header-nav-btn:hover {
|
||
color: #004bfa;
|
||
}
|
||
|
||
.header-buy-btn {
|
||
background-color: #004bfa;
|
||
color: #fff;
|
||
padding: 0.375em 1.125em;
|
||
border-radius: 0.25em;
|
||
border: none;
|
||
cursor: pointer;
|
||
font-size: 1em;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
/* ========== 响应式设计 - 整体缩放,保持比例 ========== */
|
||
|
||
/* 1920px 及以上 - 100% */
|
||
@media screen and (min-width: 1920px) {
|
||
.header {
|
||
font-size: 16px;
|
||
}
|
||
}
|
||
|
||
/* 1680px - 1919px - 缩放至 93.75% */
|
||
@media screen and (max-width: 1919px) and (min-width: 1680px) {
|
||
.header {
|
||
font-size: 15px;
|
||
}
|
||
}
|
||
|
||
/* 1600px - 1679px - 缩放至 90.625% */
|
||
@media screen and (max-width: 1679px) and (min-width: 1600px) {
|
||
.header {
|
||
font-size: 14.5px;
|
||
}
|
||
}
|
||
|
||
/* 1520px - 1599px - 缩放至 87.5% */
|
||
@media screen and (max-width: 1599px) and (min-width: 1520px) {
|
||
.header {
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
|
||
/* 1440px - 1519px - 缩放至 84.375% */
|
||
@media screen and (max-width: 1519px) and (min-width: 1440px) {
|
||
.header {
|
||
font-size: 13.5px;
|
||
}
|
||
}
|
||
|
||
/* 1360px - 1439px - 缩放至 81.25% */
|
||
@media screen and (max-width: 1439px) and (min-width: 1360px) {
|
||
.header {
|
||
font-size: 13px;
|
||
}
|
||
}
|
||
|
||
/* 1280px - 1359px - 缩放至 78.125% */
|
||
@media screen and (max-width: 1359px) and (min-width: 1280px) {
|
||
.header {
|
||
font-size: 12.5px;
|
||
}
|
||
}
|
||
|
||
/* 1200px - 1279px - 缩放至 75% */
|
||
@media screen and (max-width: 1279px) and (min-width: 1200px) {
|
||
.header {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
/* 1140px - 1199px - 缩放至 75% (保持最小12px) */
|
||
@media screen and (max-width: 1199px) and (min-width: 1140px) {
|
||
.header {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
/* 1080px - 1139px - 缩放至 75% (保持最小12px) */
|
||
@media screen and (max-width: 1139px) and (min-width: 1080px) {
|
||
.header {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
/* 992px - 1079px - 缩放至 75% (保持最小12px) */
|
||
@media screen and (max-width: 1079px) and (min-width: 992px) {
|
||
.header {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
/* 小于992px - 保持最小12px */
|
||
@media screen and (max-width: 991px) {
|
||
.header {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
/* ========== 以下为原有样式,保持不变 ========== */
|
||
|
||
/* 原有的下拉框样式 */
|
||
.header-dropdown {
|
||
box-sizing: border-box;
|
||
max-width: 1920px;
|
||
width: 100%;
|
||
position: absolute;
|
||
top: 4em;
|
||
left: 0;
|
||
right: 0;
|
||
background-color: #fafafb;
|
||
z-index: 999;
|
||
border-top: none;
|
||
overflow: hidden;
|
||
padding-bottom: 2.375em;
|
||
display: none;
|
||
}
|
||
|
||
.header-nav-item:hover .header-dropdown {
|
||
display: block;
|
||
}
|
||
|
||
/* Tabs切换栏:居中,宽度100%(基于下拉框内容区) */
|
||
.header-dropdown-tabs {
|
||
display: flex;
|
||
justify-content: center;
|
||
margin: 0 auto;
|
||
padding-bottom: 1.75em;
|
||
padding-top: 1.75em;
|
||
width: calc(100% - 2.5em);
|
||
}
|
||
|
||
.header-tab-item:last-child {
|
||
margin-right: 0;
|
||
}
|
||
|
||
.header-tab-item {
|
||
font-size: 1em;
|
||
color: #1d1d1f;
|
||
cursor: pointer;
|
||
position: relative;
|
||
margin-right: 9.375em;
|
||
}
|
||
|
||
.header-tab-item.active::after {
|
||
content: '';
|
||
position: absolute;
|
||
bottom: -0.6875em;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 0.125em;
|
||
background-color: #004bfa;
|
||
}
|
||
|
||
/* 下拉框内容容器:宽度100%,左右留20px边距 */
|
||
.header-dropdown-content {
|
||
width: 100%;
|
||
min-width: 1080px;
|
||
padding: 0 12.5em;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
box-sizing: border-box;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
/* 左侧6个分类区块 */
|
||
.header-dropdown-category {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
flex-direction: column;
|
||
flex: 1;
|
||
}
|
||
|
||
.header-category-box {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
/* 单个分类区块 */
|
||
.header-category-block {
|
||
flex: 1;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.header-category-block:nth-child(5) {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.header-category-block:nth-child(6) {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.header-category-title {
|
||
font-size: 1em;
|
||
color: #1d1d1f;
|
||
margin-bottom: 0.75em;
|
||
font-weight: 900;
|
||
}
|
||
|
||
.header-category-list {
|
||
list-style: none;
|
||
}
|
||
|
||
.header-category-item {
|
||
font-size: 0.875em;
|
||
color: #686a70;
|
||
margin-bottom: 0.71em;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.header-category-item a {
|
||
color: #686a70;
|
||
}
|
||
|
||
.header-category-item:last-child {
|
||
margin: 0;
|
||
}
|
||
|
||
.header-category-item a:hover {
|
||
color: #0066ff;
|
||
}
|
||
|
||
/* 右侧产品展示区:自适应剩余宽度,无溢出 */
|
||
.header-dropdown-products {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: flex-end;
|
||
max-width: 46.75em;
|
||
}
|
||
|
||
|
||
.header-dropdown-products {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: flex-end;
|
||
flex: 1;
|
||
min-width: 0;
|
||
gap: 1.5em 0;
|
||
}
|
||
|
||
|
||
|
||
.header-product-card {
|
||
text-align: center;
|
||
width: calc(50% - 0.75em);
|
||
max-width: 22.625em;
|
||
flex-shrink: 1;
|
||
min-width: 260px;
|
||
transition: transform 0.2s ease;
|
||
}
|
||
|
||
|
||
.header-product-card-1 {
|
||
text-align: center;
|
||
width: 100%;
|
||
max-width: 22.625em;
|
||
|
||
}
|
||
|
||
.header-product-card:hover {
|
||
transform: translateY(-2px)
|
||
}
|
||
|
||
.header-product-card-1:hover {
|
||
transform: translateY(-2px)
|
||
}
|
||
|
||
.header-product-card:nth-child(1) {
|
||
margin-right: 1.5em;
|
||
}
|
||
|
||
.header-product-card:nth-child(3) {
|
||
margin-right: 1.5em;
|
||
margin-top: 1.4375em;
|
||
}
|
||
|
||
.header-product-card:nth-child(4) {
|
||
margin-top: 1.4375em;
|
||
}
|
||
|
||
/*.header-product-img {*/
|
||
/* width: 22.625em;*/
|
||
/* height: 12.25em;*/
|
||
/* background-color: #f5f5f5;*/
|
||
/* display: flex;*/
|
||
/* align-items: center;*/
|
||
/* justify-content: center;*/
|
||
/* color: #999;*/
|
||
/*}*/
|
||
|
||
/*.header-product-img img {*/
|
||
/* width: 22.625em;*/
|
||
/* height: 12.25em;*/
|
||
/*}*/
|
||
.header-product-img {
|
||
width: 100%;
|
||
aspect-ratio: 22.625 / 12.25;
|
||
background-color: #f5f5f5;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: #999;
|
||
overflow: hidden;
|
||
border-radius: 0.5em;
|
||
}
|
||
|
||
.header-product-img img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
display: block;
|
||
}
|
||
.header-product-name {
|
||
font-size: 1em;
|
||
color: #1d1d1f;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
/* 修改 .dropdown-content1 的样式 - 卡片居中对齐 */
|
||
.header-dropdown-content1 {
|
||
width: 100%;
|
||
min-width: 1080px;
|
||
padding: 3.4em 12.5em;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: center;
|
||
gap: 3.4em 1.875em;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
/* 修改 .product-card-1 的样式 - 设置宽度,确保一行最多4个 */
|
||
.header-product-card-1 {
|
||
width: calc(25% - 1.40625em);
|
||
background: #fff;
|
||
border-radius: 0.5em;
|
||
max-width: 362px;
|
||
flex-shrink: 0;
|
||
|
||
}
|
||
|
||
/* 如果需要更好的兼容性,用 padding 技巧替代 aspect-ratio */
|
||
.header-product-img-1 {
|
||
background-color: #f5f5f5;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: #999;
|
||
width: 100%;
|
||
position: relative;
|
||
padding-bottom: 53%;
|
||
height: 0;
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* 图片样式 - 确保图片正确显示 */
|
||
.header-product-img-1 img {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
display: block;
|
||
}
|
||
|
||
/* 内容区域自适应 */
|
||
.header-product-title-1 {
|
||
font-weight: 900;
|
||
font-size: 1em;
|
||
color: #1d1d1f;
|
||
text-align: left;
|
||
margin-top: 1.125em;
|
||
padding: 0 0.5em;
|
||
word-break: break-word;
|
||
}
|
||
|
||
.header-product-name-1 {
|
||
font-size: 1em;
|
||
color: #686a70;
|
||
text-align: left;
|
||
margin-top: 0.25em;
|
||
margin-bottom: 1.0625em;
|
||
padding: 0 0.5em;
|
||
word-break: break-word;
|
||
}
|
||
|
||
/* 隐藏非当前选中的Tabs内容 */
|
||
.header-tab-content {
|
||
display: none;
|
||
}
|
||
|
||
.header-tab-content.active {
|
||
display: flex;
|
||
}
|
||
|
||
/* ========== 搜索下拉框样式 ========== */
|
||
.header-search-dropdown {
|
||
position: absolute;
|
||
top: 100%;
|
||
right: 0;
|
||
margin-top: 0.75em;
|
||
background: #ffffff;
|
||
border-radius: 0.75em;
|
||
box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.12);
|
||
width: 26em;
|
||
padding: 1.5em;
|
||
z-index: 1000;
|
||
display: none;
|
||
animation: fadeIn 0.2s ease;
|
||
}
|
||
|
||
.header-search-dropdown.show {
|
||
display: block;
|
||
}
|
||
|
||
.header-search-input-wrapper {
|
||
display: flex;
|
||
gap: 0.625em;
|
||
border: 1px solid #e5e7eb;
|
||
border-radius: 2em;
|
||
padding: 0.5em 1em;
|
||
background: #f9fafb;
|
||
margin-bottom: 1em;
|
||
}
|
||
|
||
.header-search-input {
|
||
flex: 1;
|
||
border: none;
|
||
outline: none;
|
||
background: transparent;
|
||
font-size: 0.875em;
|
||
color: #1d1d1f;
|
||
}
|
||
|
||
.header-search-input::placeholder {
|
||
color: #9ca3af;
|
||
}
|
||
|
||
.header-search-submit {
|
||
background: #004bfa;
|
||
color: white;
|
||
border: none;
|
||
padding: 0.375em 1em;
|
||
border-radius: 1.5em;
|
||
cursor: pointer;
|
||
font-size: 0.8125em;
|
||
transition: background 0.2s;
|
||
}
|
||
|
||
.header-search-submit:hover {
|
||
background: #0039cc;
|
||
}
|
||
|
||
/* 搜索记录区域 */
|
||
.header-search-history {
|
||
margin-bottom: 1.25em;
|
||
}
|
||
|
||
.header-history-title {
|
||
font-size: 1em;
|
||
color: #9ca3af;
|
||
margin-bottom: 0.625em;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.header-clear-history {
|
||
color: #004bfa;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
padding: 0.2em 0.5em;
|
||
border-radius: 0.25em;
|
||
transition: background 0.2s;
|
||
}
|
||
|
||
.header-clear-history:hover {
|
||
background: #f0f7ff;
|
||
}
|
||
|
||
.header-history-list {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 0.5em;
|
||
}
|
||
|
||
.header-history-item {
|
||
font-size: 0.8125em;
|
||
color: #1d1d1f;
|
||
cursor: pointer;
|
||
padding: 0.25em 0.625em;
|
||
background: #f3f4f6;
|
||
border-radius: 1em;
|
||
transition: all 0.2s;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 0.25em;
|
||
}
|
||
|
||
.header-history-item:hover {
|
||
background: #004bfa;
|
||
color: white;
|
||
}
|
||
|
||
.header-history-item .header-delete-icon {
|
||
font-size: 0.875em;
|
||
opacity: 0;
|
||
transition: opacity 0.2s;
|
||
}
|
||
|
||
.header-history-item:hover .header-delete-icon {
|
||
opacity: 1;
|
||
}
|
||
|
||
/* 热销产品区域 - 使用flex-wrap,一行最多3个,超过自动换行 */
|
||
.header-hot-products {
|
||
border-top: 1px solid #f0f0f0;
|
||
padding-top: 0.75em;
|
||
}
|
||
|
||
.header-hot-title {
|
||
font-size: 1em;
|
||
color: #9ca3af;
|
||
margin-bottom: 0.75em;
|
||
}
|
||
|
||
.header-hot-product-list {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 1.5em;
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
.header-hot-product-item {
|
||
flex: 0 0 calc(33.333% - 1em);
|
||
min-width: 0;
|
||
cursor: pointer;
|
||
text-align: center;
|
||
transition: transform 0.2s;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.header-hot-product-item:hover {
|
||
transform: translateY(-2px);
|
||
}
|
||
|
||
.header-hot-product-img {
|
||
width: 7.1875em;
|
||
height: 7.1875em;
|
||
max-width: 115px;
|
||
max-height: 115px;
|
||
background: linear-gradient(135deg, #f5f7fc 0%, #eef2f8 100%);
|
||
border-radius: 0.5em;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin: 0 auto 0.5em auto;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.header-hot-product-img img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
display: block;
|
||
}
|
||
|
||
.header-hot-product-img .emoji {
|
||
font-size: 2.5em;
|
||
}
|
||
|
||
.header-hot-product-name {
|
||
font-size: 0.8125em;
|
||
color: #1d1d1f;
|
||
font-weight: 500;
|
||
line-height: 1.4;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
/* 语言下拉框样式 */
|
||
.header-lang-dropdown {
|
||
position: absolute;
|
||
top: 100%;
|
||
right: 0;
|
||
margin-top: 0.75em;
|
||
background: #ffffff;
|
||
border-radius: 0.75em;
|
||
box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.12);
|
||
min-width: 12em;
|
||
padding: 1.5em 0;
|
||
z-index: 1000;
|
||
display: none;
|
||
animation: fadeIn 0.2s ease;
|
||
}
|
||
|
||
.header-lang-dropdown.show {
|
||
display: block;
|
||
}
|
||
|
||
.header-lang-item {
|
||
display: block;
|
||
padding: 0.75em 1.25em;
|
||
cursor: pointer;
|
||
transition: background 0.2s;
|
||
width: 100%;
|
||
font-size: 0.875em;
|
||
color: #1d1d1f;
|
||
text-decoration: none;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 0.625em;
|
||
}
|
||
|
||
.header-lang-item:hover {
|
||
background: #f3f4f6;
|
||
color: #004bfa;
|
||
}
|
||
|
||
.header-lang-item.active {
|
||
color: #004bfa;
|
||
background: #f0f7ff;
|
||
}
|
||
|
||
.header-lang-code {
|
||
font-weight: 500;
|
||
min-width: 2.5em;
|
||
white-space:nowrap;
|
||
}
|
||
|
||
.header-lang-name {
|
||
flex: 1;
|
||
}
|
||
.header-lang-name-en {
|
||
flex: 1;
|
||
min-width: 126px;
|
||
}
|
||
.header-lang-dropdown-delete-icon,
|
||
.header-search-dropdown-delete-icon {
|
||
font-size: 12px;
|
||
position: absolute;
|
||
top: 10px;
|
||
right: 14px;
|
||
cursor: pointer;
|
||
|
||
}
|
||
|
||
/* ========== 购买下拉框样式 ========== */
|
||
.header-buy-dropdown {
|
||
box-sizing: border-box;
|
||
max-width: 1920px;
|
||
width: 100%;
|
||
position: absolute;
|
||
top: 3.75em;
|
||
left: 0;
|
||
right: 0;
|
||
background-color: #fafafb;
|
||
z-index: 999;
|
||
border-top: none;
|
||
overflow: visible;
|
||
display: none;
|
||
padding: 3.5em 12.5em;
|
||
}
|
||
|
||
.header-buy-dropdown.show {
|
||
display: block;
|
||
}
|
||
|
||
/* 购买下拉框内容容器 - 居中显示,固定一行7个卡片 */
|
||
.header-buy-dropdown-content {
|
||
width: 100%;
|
||
max-width: 1520px;
|
||
margin: 0 auto;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: center;
|
||
box-sizing: border-box;
|
||
row-gap: 121px;
|
||
}
|
||
|
||
/* 购买产品卡片:宽度96px,右边距动态计算 */
|
||
.header-buy-product-card {
|
||
width: 96px;
|
||
text-align: center;
|
||
cursor: pointer;
|
||
margin-right: calc((100% - (96px * 7)) / 6);
|
||
|
||
}
|
||
|
||
.header-buy-product-card:hover {
|
||
transform: translateY(-2px)
|
||
}
|
||
|
||
/* 每行第7个卡片(一行最后一个)清除右边距 */
|
||
.header-buy-product-card:nth-child(7n) {
|
||
margin-right: 0;
|
||
}
|
||
|
||
.header-buy-product-card a {
|
||
text-decoration: none;
|
||
display: block;
|
||
}
|
||
|
||
/* 图片容器:宽度100%,高度自适应,保持正方形比例 */
|
||
.header-buy-product-img {
|
||
width: 100%;
|
||
aspect-ratio: 1 / 1;
|
||
background-color: #f5f5f5;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
overflow: hidden;
|
||
border-radius: 0.5em;
|
||
position: relative;
|
||
}
|
||
|
||
/* 图片样式:实现悬浮切换效果,完全填充容器 */
|
||
.header-buy-product-img img {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
display: block;
|
||
transition: opacity 0.2s ease;
|
||
}
|
||
|
||
/* 默认显示普通图,隐藏悬浮图 */
|
||
.header-buy-product-img .header-default-img {
|
||
opacity: 1;
|
||
}
|
||
|
||
.header-buy-product-img .header-hover-img {
|
||
opacity: 0;
|
||
}
|
||
|
||
/* 鼠标悬停时:显示悬浮图,隐藏普通图 */
|
||
.header-buy-product-card:hover .header-buy-product-img .header-default-img {
|
||
opacity: 0;
|
||
}
|
||
|
||
.header-buy-product-card:hover .header-buy-product-img .header-hover-img {
|
||
opacity: 1;
|
||
}
|
||
|
||
/* 产品标题样式:不加粗,字体大小16px,超出一行显示省略号 */
|
||
.header-buy-product-title {
|
||
font-weight: normal;
|
||
font-size: 1em;
|
||
color: #1d1d1f;
|
||
text-align: center;
|
||
margin-top: 0.75em;
|
||
word-break: break-word;
|
||
line-height: 1.4;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 1;
|
||
-webkit-box-orient: vertical;
|
||
white-space: normal;
|
||
}
|
||
|
||
/* 动画 */
|
||
@keyframes fadeIn {
|
||
from {
|
||
opacity: 0;
|
||
transform: translateY(-0.5em);
|
||
}
|
||
|
||
to {
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
/* 1280px及以下屏幕,渐进式调整间距 */
|
||
@media screen and (max-width: 1280px) {
|
||
.header-log {
|
||
margin-right: 2em;
|
||
}
|
||
|
||
.header-nav-items {
|
||
margin-right: 1em;
|
||
}
|
||
|
||
.header-nav-outer {
|
||
padding: 0 12em;
|
||
}
|
||
|
||
.header-dropdown-content {
|
||
padding: 0 12em;
|
||
}
|
||
|
||
.header-dropdown-content1 {
|
||
padding: 0 12em;
|
||
}
|
||
|
||
.header-buy-dropdown {
|
||
padding: 3.5em 12em;
|
||
}
|
||
|
||
.header-buy-dropdown-content {
|
||
max-width: 1200px;
|
||
row-gap: 100px;
|
||
}
|
||
}
|
||
|
||
/* 1152px及以下,进一步缩小 */
|
||
@media screen and (max-width: 1152px) {
|
||
.header-log {
|
||
margin-right: 1em;
|
||
}
|
||
|
||
.header-nav-outer {
|
||
padding: 0 10em;
|
||
}
|
||
|
||
.header-dropdown-content {
|
||
padding: 0 10em;
|
||
}
|
||
|
||
.header-dropdown-content1 {
|
||
padding: 0 10em;
|
||
}
|
||
|
||
.header-buy-dropdown {
|
||
padding: 3.5em 10em;
|
||
}
|
||
|
||
.buy-dropdown-content {
|
||
max-width: 1080px;
|
||
row-gap: 80px;
|
||
}
|
||
}
|
||
|
||
/* 1080px及以下,最小间距 */
|
||
@media screen and (max-width: 1080px) {
|
||
.header-log {
|
||
margin-right: 1em;
|
||
}
|
||
|
||
.header-nav-outer {
|
||
padding: 0 8em;
|
||
}
|
||
|
||
.header-dropdown-content {
|
||
padding: 0 8em;
|
||
}
|
||
|
||
.header-dropdown-content1 {
|
||
padding: 0 8em;
|
||
}
|
||
|
||
.header-buy-dropdown {
|
||
padding: 3.5em 8em;
|
||
}
|
||
|
||
.header-buy-dropdown-content {
|
||
max-width: 1000px;
|
||
row-gap: 60px;
|
||
}
|
||
}
|
||
</style>
|
||
<div class="header">
|
||
<!-- 导航外容器:1920px宽,下拉框基于此定位 -->
|
||
<div class="header-nav-outer">
|
||
<!-- 顶部导航栏 -->
|
||
<div class="header-nav-bar">
|
||
<div style="display:flex;align-items:center">
|
||
<a href="/" style="display:flex;align-items:center">
|
||
<img src="__IMAGES__/logo.png" alt="orico" class="header-log">
|
||
</a>
|
||
</div>
|
||
<div class="header-nav-items">
|
||
{if condition="!empty($header_categorys)"}
|
||
<div class="header-nav-item">
|
||
<div class="header-nav-title">{:lang_i18n('产品列表')}</div>
|
||
<div class="header-dropdown" >
|
||
<div class="header-dropdown-tabs">
|
||
{volist name="header_categorys" id="vo" key="idx"}
|
||
<div class="header-tab-item {if condition="$idx == 1"}active{/if}" data-tab="tag-{$vo.id}">{$vo.name}</div>
|
||
{/volist}
|
||
</div>
|
||
{volist name="header_categorys" id="vo" key="idx"}
|
||
<div class="header-dropdown-content header-tab-content {if condition="$idx == 1"}active{/if}" id="tag-{$vo.id}">
|
||
<div class="header-dropdown-category">
|
||
{if condition="!empty($vo.children)"}
|
||
{volist name="vo.children" id="vc"}
|
||
<div class="header-category-box">
|
||
{volist name="vc" id="vcc"}
|
||
<div class="header-category-block">
|
||
<div class="header-category-title">
|
||
<a href="{:url('product/subcategory', ['id' => $vcc.id])}" target="_self">
|
||
{$vcc.name}
|
||
</a>
|
||
</div>
|
||
<ul class="header-category-list">
|
||
{if condition="!empty($vcc.children)"}
|
||
{volist name="vcc.children" id="vccc" length="4"}
|
||
<li class="header-category-item">
|
||
<a href="{:url('product/subcategory', ['id' => $vccc.id])}" target="_self">
|
||
{$vccc.name}
|
||
</a>
|
||
</li>
|
||
{/volist}
|
||
{/if}
|
||
</ul>
|
||
</div>
|
||
{/volist}
|
||
</div>
|
||
{/volist}
|
||
{/if}
|
||
</div>
|
||
{if condition="!empty($vo.recommends)"}
|
||
<div class="header-dropdown-products">
|
||
{volist name="vo.recommends" id="recommend"}
|
||
<div class="header-product-card">
|
||
<a href="{$recommend.link}">
|
||
<div class="header-product-img">
|
||
<img src="{$recommend.image}" alt="">
|
||
</div>
|
||
<div class="header-product-name">{$recommend.title}</div>
|
||
</a>
|
||
</div>
|
||
{/volist}
|
||
</div>
|
||
{/if}
|
||
</div>
|
||
{/volist}
|
||
</div>
|
||
</div>
|
||
{/if}
|
||
{if condition="!empty($header_navigation)"}
|
||
{volist name="header_navigation" id="nav"}
|
||
<div class="header-nav-item">
|
||
{if condition="empty($nav.children)"}
|
||
<div class="header-nav-title">
|
||
<a href="{$nav.link}" target="{$nav.blank==1?'_blank':'_self'}">{$nav.name}</a>
|
||
</div>
|
||
{else /}
|
||
<div class="header-nav-title">{$nav.name}</div>
|
||
<div class="header-dropdown">
|
||
<div class="header-dropdown-content1">
|
||
{volist name="nav.children" id="child"}
|
||
<div class="header-product-card-1">
|
||
<a href="{$child.link}" target="{$child.blank==1?'_blank':'_self'}">
|
||
<div class="header-product-img-1">
|
||
<img src="{$child.image}" alt="">
|
||
</div>
|
||
<div class="header-product-title-1">{$child.name}</div>
|
||
<div class="header-product-name-1">{$child.desc}</div>
|
||
</a>
|
||
</div>
|
||
{/volist}
|
||
</div>
|
||
</div>
|
||
{/if}
|
||
</div>
|
||
{/volist}
|
||
{/if}
|
||
</div>
|
||
|
||
<!-- 右侧功能按钮 -->
|
||
<div class="header-nav-actions">
|
||
<div class="header-search-wrapper">
|
||
<span class="header-nav-btn">
|
||
<img src="__IMAGES__/icon-search.png" alt="">
|
||
</span>
|
||
<div class="header-search-dropdown" id="searchDropdown">
|
||
<span class="header-search-dropdown-delete-icon">✕</span>
|
||
<div class="header-search-input-wrapper">
|
||
<input type="text" class="header-search-input" placeholder="{:lang_i18n('搜索产品、分类...')}">
|
||
<button class="header-search-submit">{:lang_i18n('搜索')}</button>
|
||
</div>
|
||
<div class="header-search-history" id="searchHistory">
|
||
<div class="header-history-title">
|
||
<span>{:lang_i18n('最近搜索')}</span>
|
||
<span class="header-clear-history" id="clearHistory">{:lang_i18n('清空')}</span>
|
||
</div>
|
||
<div class="header-history-list" id="historyList"></div>
|
||
</div>
|
||
<div class="header-hot-products">
|
||
<div class="header-hot-title">{:lang_i18n('热销产品')}</div>
|
||
<div class="header-hot-product-list">
|
||
{if condition="!empty($header_hot_products)"}
|
||
{volist name="header_hot_products" id="pro"}
|
||
<div class="header-hot-product-item" data-keyword="keyword-{$pro.id}">
|
||
<div class="header-hot-product-img">
|
||
<a href="{:url('product/detail', ['id' => $pro.id])}">
|
||
<img src="{:thumb($pro.cover_image)}" alt="">
|
||
</a>
|
||
</div>
|
||
<div class="header-hot-product-name">{$pro.name}</div>
|
||
</div>
|
||
{/volist}
|
||
{/if}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="header-lang-wrapper">
|
||
<span class="header-nav-btn">
|
||
<img src="__IMAGES__/icon-language.png" alt="">
|
||
</span>
|
||
<div class="header-lang-dropdown" id="langDropdown">
|
||
<span class="header-lang-dropdown-delete-icon">✕</span>
|
||
{volist name="header_languages" id="vo"}
|
||
<a href="{$vo.lang_url}" class="header-lang-item" data-lang="zh-CN" target="_self">
|
||
<img src="{$vo.lang_icon}" alt="">
|
||
|
||
{eq name=":cookie('think_lang')" value="zh-cn"}
|
||
<span class="header-lang-code">{$vo.country_zh_name}</span>
|
||
<span class="header-lang-name">{$vo.lang_name}</span>
|
||
{else}
|
||
<span class="header-lang-code">{$vo.country_en_name}</span>
|
||
<span class="header-lang-name-en">{$vo.lang_en_name}</span>
|
||
{/eq}
|
||
</a>
|
||
{/volist}
|
||
</div>
|
||
</div>
|
||
<div class="header-buy-wrapper">
|
||
<button class="header-buy-btn">{:lang_i18n('购买')}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 购买下拉框 -->
|
||
<div class="header-buy-dropdown" id="buyDropdown">
|
||
<div class="header-buy-dropdown-content">
|
||
{if condition="!empty($header_mall_entrance)"}
|
||
{volist name="header_mall_entrance" id="ma"}
|
||
<a class="header-buy-product-card" target="_self" href="{$ma.link}">
|
||
<div class="header-buy-product-img">
|
||
<img class="header-default-img" src="{$ma.image}" alt="{$ma.name}">
|
||
<img class="header-hover-img" src="{$ma.hover_image}" alt="{$ma.name}">
|
||
</div>
|
||
<div class="header-buy-product-title">{$ma.name}</div>
|
||
</a>
|
||
{/volist}
|
||
{/if}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
const tabItems = document.querySelectorAll('.header-tab-item');
|
||
const tabContents = document.querySelectorAll('.header-tab-content');
|
||
|
||
tabItems.forEach(tab =>
|
||
{
|
||
tab.addEventListener('click', () =>
|
||
{
|
||
tabItems.forEach(item => item.classList.remove('active'));
|
||
tab.classList.add('active');
|
||
const tabId = tab.getAttribute('data-tab');
|
||
tabContents.forEach(content =>
|
||
{
|
||
content.classList.remove('active');
|
||
if (content.id === tabId) {
|
||
content.classList.add('active');
|
||
}
|
||
});
|
||
});
|
||
});
|
||
|
||
let searchHistory = JSON.parse(localStorage.getItem('searchHistory') || '[]');
|
||
|
||
function renderHistory ()
|
||
{
|
||
const historyList = document.getElementById('historyList');
|
||
const historySection = document.getElementById('searchHistory');
|
||
if (searchHistory.length === 0) {
|
||
historySection.style.display = 'none';
|
||
return;
|
||
}
|
||
historySection.style.display = 'block';
|
||
historyList.innerHTML = searchHistory.map((item, index) => `
|
||
<div class="header-history-item" data-keyword="${item}">
|
||
<span>${item}</span>
|
||
<span class="header-delete-icon" data-index="${index}">✕</span>
|
||
</div>
|
||
`).join('');
|
||
document.querySelectorAll('.header-history-item').forEach(item =>
|
||
{
|
||
const keyword = item.getAttribute('data-keyword');
|
||
const deleteBtn = item.querySelector('.header-delete-icon');
|
||
item.addEventListener('click', (e) =>
|
||
{
|
||
if (e.target === deleteBtn) return;
|
||
performSearch(keyword);
|
||
});
|
||
if (deleteBtn) {
|
||
deleteBtn.addEventListener('click', (e) =>
|
||
{
|
||
e.stopPropagation();
|
||
const index = parseInt(deleteBtn.getAttribute('data-index'));
|
||
searchHistory.splice(index, 1);
|
||
localStorage.setItem('searchHistory', JSON.stringify(searchHistory));
|
||
renderHistory();
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
function addToHistory (keyword)
|
||
{
|
||
if (!keyword.trim()) return;
|
||
searchHistory = searchHistory.filter(item => item !== keyword);
|
||
searchHistory.unshift(keyword);
|
||
if (searchHistory.length > 10) searchHistory.pop();
|
||
localStorage.setItem('searchHistory', JSON.stringify(searchHistory));
|
||
renderHistory();
|
||
}
|
||
|
||
const clearHistoryBtn = document.getElementById('clearHistory');
|
||
if (clearHistoryBtn) {
|
||
clearHistoryBtn.addEventListener('click', () =>
|
||
{
|
||
searchHistory = [];
|
||
localStorage.setItem('searchHistory', JSON.stringify(searchHistory));
|
||
renderHistory();
|
||
});
|
||
}
|
||
|
||
function performSearch (keyword)
|
||
{
|
||
if (keyword.trim()) {
|
||
addToHistory(keyword);
|
||
window.location.href = "{:url('product/search')}?keywords=" + encodeURIComponent(keyword);
|
||
if (searchDropdown) searchDropdown.classList.remove('show');
|
||
if (searchInput) searchInput.value = '';
|
||
}
|
||
}
|
||
|
||
const searchBtn = document.querySelector('.header-search-wrapper .header-nav-btn');
|
||
const searchDropdown = document.getElementById('searchDropdown');
|
||
const searchInput = document.querySelector('.header-search-input');
|
||
const searchSubmit = document.querySelector('.header-search-submit');
|
||
const langDropdown = document.getElementById('langDropdown');
|
||
const buyDropdown = document.getElementById('buyDropdown');
|
||
const langCloseBtn = document.querySelector('.header-lang-dropdown-delete-icon');
|
||
const searchCloseBtn = document.querySelector('.header-search-dropdown-delete-icon');
|
||
|
||
// 语言关闭按钮
|
||
if (langCloseBtn && langCloseBtn) {
|
||
langCloseBtn.addEventListener('click', (e) =>
|
||
{
|
||
e.stopPropagation();
|
||
langDropdown.classList.remove('show');
|
||
});
|
||
}
|
||
//搜索关闭
|
||
if (searchCloseBtn && searchCloseBtn) {
|
||
searchCloseBtn.addEventListener('click', (e) =>
|
||
{
|
||
|
||
e.stopPropagation();
|
||
searchDropdown.classList.remove('show');
|
||
});
|
||
}
|
||
// 鼠标移入导航项时,关闭购买下拉框
|
||
const navItems = document.querySelectorAll('.nav-item');
|
||
navItems.forEach(item =>
|
||
{
|
||
item.addEventListener('mouseenter', () =>
|
||
{
|
||
if (buyDropdown) {
|
||
buyDropdown.classList.remove('show');
|
||
}
|
||
});
|
||
});
|
||
|
||
if (searchBtn && searchDropdown) {
|
||
searchBtn.addEventListener('click', (e) =>
|
||
{
|
||
e.stopPropagation();
|
||
if (langDropdown) langDropdown.classList.remove('show');
|
||
if (buyDropdown) buyDropdown.classList.remove('show');
|
||
searchDropdown.classList.toggle('show');
|
||
if (searchDropdown.classList.contains('show')) {
|
||
renderHistory();
|
||
}
|
||
});
|
||
}
|
||
|
||
if (searchSubmit) {
|
||
searchSubmit.addEventListener('click', () =>
|
||
{
|
||
performSearch(searchInput.value);
|
||
});
|
||
}
|
||
|
||
if (searchInput) {
|
||
searchInput.addEventListener('keypress', (e) =>
|
||
{
|
||
if (e.key === 'Enter') {
|
||
performSearch(searchInput.value);
|
||
}
|
||
});
|
||
}
|
||
|
||
const hotProducts = document.querySelectorAll('.header-hot-product-item');
|
||
hotProducts.forEach(product =>
|
||
{
|
||
product.addEventListener('click', () =>
|
||
{
|
||
const keyword = product.getAttribute('data-keyword');
|
||
if (keyword) performSearch(keyword);
|
||
});
|
||
});
|
||
|
||
const langBtn = document.querySelector('.header-lang-wrapper .header-nav-btn');
|
||
if (langBtn && langDropdown) {
|
||
langBtn.addEventListener('click', (e) =>
|
||
{
|
||
e.stopPropagation();
|
||
if (searchDropdown) searchDropdown.classList.remove('show');
|
||
if (buyDropdown) buyDropdown.classList.remove('show');
|
||
langDropdown.classList.toggle('show');
|
||
});
|
||
}
|
||
|
||
const buyWrapper = document.querySelector('.header-buy-wrapper');
|
||
if (buyWrapper && buyDropdown) {
|
||
buyWrapper.addEventListener('click', () =>
|
||
{
|
||
console.log('123232323')
|
||
buyDropdown.classList.add('show');
|
||
});
|
||
}
|
||
|
||
document.addEventListener('click', (e) =>
|
||
{
|
||
if (!e.target.closest('.header-search-wrapper')) {
|
||
if (searchDropdown) searchDropdown.classList.remove('show');
|
||
}
|
||
if (!e.target.closest('.header-lang-wrapper')) {
|
||
if (langDropdown) langDropdown.classList.remove('show');
|
||
}
|
||
if (!e.target.closest('.header-buy-wrapper')) {
|
||
if (buyDropdown) buyDropdown.classList.remove('show');
|
||
}
|
||
});
|
||
|
||
if (searchDropdown) searchDropdown.addEventListener('click', (e) => e.stopPropagation());
|
||
if (langDropdown) langDropdown.addEventListener('click', (e) => e.stopPropagation());
|
||
if (buyDropdown) buyDropdown.addEventListener('click', (e) => e.stopPropagation());
|
||
|
||
renderHistory();
|
||
</script>
|