fix: 顶部“店铺”按钮不能显示在中文

This commit is contained in:
2025-06-10 10:08:08 +08:00
parent d6d2e048bf
commit 1ffb0f73c0

View File

@@ -1,203 +1,205 @@
<header class="header-PC"> <header class="header-PC">
<div id="header"> <div id="header">
<!-- LOG --> <!-- LOG -->
<div class="nav1"> <div class="nav1">
<a href="/"> <a href="/">
<img src="__IMAGES__/logo.png" /> <img src="__IMAGES__/logo.png" />
</a> </a>
</div> </div>
<!--顶部导航栏 --> <!--顶部导航栏 -->
<div class="nav2"> <div class="nav2">
<nav id="booNavigation" class="booNavigation"> <nav id="booNavigation" class="booNavigation">
<ul> <ul>
{if condition="!empty($header_categorys)"} {if condition="!empty($header_categorys)"}
<li class="navItem"> <li class="navItem">
<a href="javascript:void(0);">{:lang_i18n('产品列表')}</a> <a href="javascript:void(0);">{:lang_i18n('产品列表')}</a>
<img src="__IMAGES__/black-down.png" class="downimg" /> <img src="__IMAGES__/black-down.png" class="downimg" />
<ol class="navItemConten"> <ol class="navItemConten">
<!-- 左边子菜单--> <!-- 左边子菜单-->
<ul class="navItem_cyleft"> <ul class="navItem_cyleft">
{volist name="header_categorys" id="vo"} {volist name="header_categorys" id="vo"}
<li class="{$key == 0 ? 'it_active' : ''}"> <li class="{$key == 0 ? 'it_active' : ''}">
<a href="{:url('product/category', ['id' => $vo.id])}">{$vo.name}</a> <a href="{:url('product/category', ['id' => $vo.id])}">{$vo.name}</a>
</li> </li>
{/volist} {/volist}
</ul> </ul>
<!-- 右边子菜单--> <!-- 右边子菜单-->
{volist name="header_categorys" id="vo" key="idx"} {volist name="header_categorys" id="vo" key="idx"}
<div class="navItem_cyright" {eq name="idx" value="1" }style="display: block;"{else/}style="display: none;"{/eq}> <div class="navItem_cyright" {eq name="idx" value="1" }style="display: block;"{else/}style="display: none;"{/eq}>
{volist name="vo.children" id="vc"} {volist name="vo.children" id="vc"}
<dl class="nav_cyrightit"> <dl class="nav_cyrightit">
<dt> <dt>
<a href="{:url('product/subcategory', ['id' => $vc.id])}">{$vc.name}</a> <a href="{:url('product/subcategory', ['id' => $vc.id])}">{$vc.name}</a>
</dt> </dt>
{volist name="vc.children" id="vcc"} {volist name="vc.children" id="vcc"}
<dd> <dd>
<a href="{:url('product/subcategory', ['id' => $vcc.id])}">{$vcc.name}</a> <a href="{:url('product/subcategory', ['id' => $vcc.id])}">{$vcc.name}</a>
</dd> </dd>
{/volist} {/volist}
</dl> </dl>
{/volist} {/volist}
</div> </div>
{/volist} {/volist}
</ol> </ol>
</li> </li>
{/if} {/if}
{volist name="header_navigation" id="vo"} {volist name="header_navigation" id="vo"}
<li class="navItem"> <li class="navItem">
<a href="{$vo.link}" target="{$vo.blank==1?'_blank':'_self'}">{$vo.name}</a> <a href="{$vo.link}" target="{$vo.blank==1?'_blank':'_self'}">{$vo.name}</a>
{if condition="!empty($vo.children)"} {if condition="!empty($vo.children)"}
<img src="__IMAGES__/black-down.png" class="downimg" /> <img src="__IMAGES__/black-down.png" class="downimg" />
<!--下拉菜单 --> <!--下拉菜单 -->
<ol class="navItemConten1"> <ol class="navItemConten1">
{volist name="vo.children" id="voc"} {volist name="vo.children" id="voc"}
<li> <li>
<a href="{$voc.link}" target="{$voc.blank==1?'_blank':'_self'}">{$voc.name}</a> <a href="{$voc.link}" target="{$voc.blank==1?'_blank':'_self'}">{$voc.name}</a>
</li> </li>
{/volist} {/volist}
</ol> </ol>
{/if} {/if}
</li> </li>
{/volist} {/volist}
</ul> </ul>
</nav> </nav>
</div> </div>
<!-- 顶部搜索/国家选择/商店--> <!-- 顶部搜索/国家选择/商店-->
<div class="nav3"> <div class="nav3">
<img src="__IMAGES__/icon-search.png" id="openModalBtn" class="searchimg" /> <img src="__IMAGES__/icon-search.png" id="openModalBtn" class="searchimg" />
<div class="choesCountry"> <div class="choesCountry">
<img src="__IMAGES__/icon-language.png" id="countrycheck" class="checkimg" /> <img src="__IMAGES__/icon-language.png" id="countrycheck" class="checkimg" />
<!--国家选择 --> <!--国家选择 -->
<div class="topCountry" id="top-country"> <div class="topCountry" id="top-country">
<ul> <ul>
<li class="closec"> <li class="closec">
<span class="closecountrybt">×</span> <span class="closecountrybt">×</span>
</li> </li>
{volist name="header_languages" id="vo"} {volist name="header_languages" id="vo"}
<a href="{$vo.lang_url}"> <a href="{$vo.lang_url}">
<li> <li>
<div class="cico"> <div class="cico">
<img src="{$vo.lang_icon}" class="countryimg" /> <img src="{$vo.lang_icon}" class="countryimg" />
</div> </div>
<p class="countryName">{$vo.country_en_name} - {$vo.lang_en_name}</p> <p class="countryName">{$vo.country_en_name} - {$vo.lang_en_name}</p>
</li> </li>
</a> </a>
{/volist} {/volist}
</ul> </ul>
</div> </div>
</div> </div>
{notempty name="basic_config['navigation_store_url']['value']"} {eq name=":cookie('think_lang')" value="en-us"}
<a class="storetopbt" href="{$basic_config['navigation_store_url']['value']}"> {notempty name="basic_config['navigation_store_url']['value']"}
<img src="__IMAGES__/shopico.png" class="storeImgico" />{:lang_i18n('店铺')} <a class="storetopbt" href="{$basic_config['navigation_store_url']['value']}">
</a> <img src="__IMAGES__/shopico.png" class="storeImgico" />{:lang_i18n('店铺')}
{/notempty} </a>
</div> {/notempty}
</div> {/eq}
</div>
</div>
<!-- 搜索弹框--> <!-- 搜索弹框-->
<div class="searchmodalMian" id="scmodal"> <div class="searchmodalMian" id="scmodal">
<div class="searchmodalct"> <div class="searchmodalct">
<span class="close-btn">×</span> <span class="close-btn">×</span>
<input type="text" name="keywords" id="serrchinput" autocomplete="off" /> <input type="text" name="keywords" id="serrchinput" autocomplete="off" />
<!-- 历史记录 --> <!-- 历史记录 -->
<div class="searchhistory"> <div class="searchhistory">
<p class="h_title">{:lang_i18n('搜索记录')}</p> <p class="h_title">{:lang_i18n('搜索记录')}</p>
<ul></ul> <ul></ul>
</div> </div>
<div class="popProduct"> <div class="popProduct">
<p class="h_title">{:lang_i18n('热销产品')}</p> <p class="h_title">{:lang_i18n('热销产品')}</p>
<div class="popmain"> <div class="popmain">
{volist name="header_hot_products" id="vo"} {volist name="header_hot_products" id="vo"}
<div class="popitem"> <div class="popitem">
<a href="{:url('product/detail', ['id' => $vo.id])}"><img src="{$vo.cover_image}" class="popimg" /></a> <a href="{:url('product/detail', ['id' => $vo.id])}"><img src="{$vo.cover_image}" class="popimg" /></a>
<div class="productName">{$vo.name}</div> <div class="productName">{$vo.name}</div>
<div class="produc-dec">{$vo.short_name}</div> <div class="produc-dec">{$vo.short_name}</div>
</div> </div>
{/volist} {/volist}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</header> </header>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
// 搜索历史记录处理 // 搜索历史记录处理
function history (keywords) { function history(keywords) {
var history = localStorage.getItem('header_search_keywords'); var history = localStorage.getItem('header_search_keywords');
if (!history) { if (!history) {
history = []; history = [];
} else { } else {
history = JSON.parse(history); history = JSON.parse(history);
} }
// 记录搜索关键词 // 记录搜索关键词
if (keywords) { if (keywords) {
if (history.includes(keywords)) { if (history.includes(keywords)) {
history.splice(history.indexOf(keywords), 1); history.splice(history.indexOf(keywords), 1);
} }
history.unshift(keywords); history.unshift(keywords);
if (history.length > 3) { if (history.length > 3) {
history.pop(); history.pop();
} }
localStorage.setItem('header_search_keywords', JSON.stringify(history)); localStorage.setItem('header_search_keywords', JSON.stringify(history));
return history; return history;
} }
// 回显搜索历史记录 // 回显搜索历史记录
history.forEach(function (item) { history.forEach(function (item) {
$('.searchhistory ul').append('<li><a href="{:url(\'product/search\')}?keywords=' + item + '">' + item + '</a></li>'); $('.searchhistory ul').append('<li><a href="{:url(\'product/search\')}?keywords=' + item + '">' + item + '</a></li>');
}); });
return history; return history;
} }
// 封装一个函数用于处理鼠标悬停显示和隐藏内容 // 封装一个函数用于处理鼠标悬停显示和隐藏内容
function handleHover ($element, $content) { function handleHover($element, $content) {
$element.mouseenter(function () { $element.mouseenter(function () {
$content.stop(true, true).slideDown(60); $content.stop(true, true).slideDown(60);
}).mouseleave(function () { }).mouseleave(function () {
$content.stop(true, true).slideUp(60); $content.stop(true, true).slideUp(60);
}); });
} }
// 处理第一个导航项 // 处理第一个导航项
handleHover($('.navItem').eq(0), $('.navItem').eq(0).find('.navItemConten')); handleHover($('.navItem').eq(0), $('.navItem').eq(0).find('.navItemConten'));
// 鼠标移入navItem_cyleft里面的li标签添加类移除其他li的类 // 鼠标移入navItem_cyleft里面的li标签添加类移除其他li的类
$('.navItem_cyleft li').mouseenter(function () { $('.navItem_cyleft li').mouseenter(function () {
$(this).addClass('it_active').siblings().removeClass('it_active'); $(this).addClass('it_active').siblings().removeClass('it_active');
$('.navItem_cyright').hide(); $('.navItem_cyright').hide();
$('.navItem_cyright').eq($(this).index()).show(); $('.navItem_cyright').eq($(this).index()).show();
}); });
// 处理第5 - 8个导航项 // 处理第5 - 8个导航项
for (let i = 4; i < 8; i++) { for (let i = 4; i < 8; i++) {
handleHover($('.navItem').eq(i), $('.navItem').eq(i).find('.navItemConten1')); handleHover($('.navItem').eq(i), $('.navItem').eq(i).find('.navItemConten1'));
} }
// 点击搜索 // 点击搜索
$('#openModalBtn').click(function () { $('#openModalBtn').click(function () {
$('#scmodal').toggle(); $('#scmodal').toggle();
}); });
$('.close-btn').click(function () { $('.close-btn').click(function () {
$('#scmodal').hide(); $('#scmodal').hide();
}); });
// 搜索历史记录回显 // 搜索历史记录回显
history(); history();
// 执行搜索 // 执行搜索
$('#serrchinput').keydown(function (event) { $('#serrchinput').keydown(function (event) {
if (event.originalEvent.keyCode == 13) { if (event.originalEvent.keyCode == 13) {
var keywords = $(this).val(); var keywords = $(this).val();
if (keywords == '') { if (keywords == '') {
return false; return false;
} }
// 记录搜索关键词 // 记录搜索关键词
history(keywords); history(keywords);
// 跳转到搜索页面 // 跳转到搜索页面
window.location.href = "{:url('product/search')}" + '?keywords=' + keywords; window.location.href = "{:url('product/search')}" + '?keywords=' + keywords;
} }
}); });
// 点击选择国家 // 点击选择国家
$('#countrycheck').click(function () { $('#countrycheck').click(function () {
$('#top-country').toggle(); $('#top-country').toggle();
}); });
$('.closecountrybt').click(function () { $('.closecountrybt').click(function () {
$('#top-country').hide(); $('#top-country').hide();
}); });
}); });
</script> </script>