Browse Source

Merge remote-tracking branch 'origin/master'

master
zhangf@suq.cn 2 weeks ago
parent
commit
aa0e96e8fb
  1. 36
      app/common.php
  2. 10
      public/themes/dist_static/static/css/common.css
  3. 8
      public/themes/dist_static/static/css/product.css
  4. 4
      public/themes/dist_static/static/js/common.js
  5. 16
      public/themes/website/1/zh/demo/components/header.html
  6. 55
      public/themes/website/1/zh/demo/contact.html
  7. 2
      public/themes/website/1/zh/demo/product.html

36
app/common.php

@ -1695,3 +1695,39 @@ if (!function_exists('getChildCategoriesContent')) {
}
}
}
// 函数名:getDescriptionSeparate (查询表 hc_category 中的字段 description 根据这个字段拆分成数组返回)
// 传入 cate_id 和 separate_str, 注意为空的判断;
if (!function_exists('getDescriptionSeparate')) {
function getDescriptionSeparate($cate_id)
{
if (empty($cate_id)) {
return [];
}
try {
$description = \think\facade\Db::table('hc_category')
->where('id', $cate_id)
->value('description');
if (empty($description)) {
return [];
}
// 使用正则提取所有以 http:// 或 https:// 开头的链接
// 匹配规则:以http(s)开头,直到遇到空白符或中文字符"分隔符"为止
preg_match_all('/https?:\/\/[^\s分隔符]+/', $description, $matches);
$result = $matches[0] ?? [];
// 过滤空值并重新索引
$result = array_filter($result, function ($value) {
return !empty(trim($value));
});
return array_values($result);
} catch (\Exception $e) {
return [];
}
}
}

10
public/themes/dist_static/static/css/common.css

@ -1443,7 +1443,7 @@ body {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 5rem;
padding: 3rem 5rem;
border-right: 1px solid rgba(46, 53, 58, 0.1);
}.nav-mega__cat {
display: flex;
@ -1484,19 +1484,19 @@ body {
display: grid;
grid-template-columns: minmax(0, 1fr) 20rem;
gap: 3.5625rem;
padding: 5rem;
padding: 3rem 5rem;
padding-right: 3.5625rem;
min-width: 0;
}.nav-mega__panels {
min-width: 0;
}.nav-mega__promo-side {
padding-top: 6.875rem;
padding-top: 4.875rem;
flex-shrink: 0;
}.nav-mega__heading {
display: inline-flex;
align-items: center;
gap: 1rem;
margin-bottom: 5rem;
margin-bottom: 3rem;
color: var(--color-text);
font-family: "MiSans VF", "PingFang SC", sans-serif;
font-size: var(--font-24);
@ -1622,7 +1622,7 @@ body {
}.nav-mega__links {
display: flex;
flex-direction: column;
gap: 1.5rem;
gap: 1rem;
margin: 0;
padding: 0;
list-style: none;

8
public/themes/dist_static/static/css/product.css

@ -245,8 +245,8 @@ body.is-p-subnav .site-header {
}
.p-intro__gallery img {
width: auto;
max-width: 100%;
max-height: 100%;
max-width: 80%;
max-height: 80%;
height: 100%;
object-fit: contain;
}
@ -560,8 +560,8 @@ body.is-p-subnav .site-header {
max-height: 35rem;
}
.p-download__visual img {
width: 100%;
height: 100%;
width: 80%;
height: 80%;
object-fit: contain;
display: block;
}

4
public/themes/dist_static/static/js/common.js

@ -103,10 +103,12 @@ $(function() {
$(this).attr("aria-expanded", String(!isExpanded));
});
// nav-mega 子组:标题 / 箭头均可展开收起
// nav-mega 子组:标题 / 箭头均可展开收起(同组互斥)
$(document).on("click", ".nav-mega__subgroup-title, .nav-mega__subgroup-toggle", function() {
const $subgroup = $(this).closest(".nav-mega__subgroup");
const $siblings = $subgroup.siblings(".nav-mega__subgroup");
const isExpanded = !$subgroup.hasClass("is-expanded");
$siblings.removeClass("is-expanded").find(".nav-mega__subgroup-toggle").attr("aria-expanded", false);
$subgroup.toggleClass("is-expanded", isExpanded);
$subgroup.find(".nav-mega__subgroup-toggle").attr("aria-expanded", isExpanded);
});

16
public/themes/website/1/zh/demo/components/header.html

@ -62,7 +62,13 @@
<img src="{hcTaglib:setting name='wechat_code' type='2' /}" alt="官方微信" width="120" height="120" />
</span>
</span>
<a class="site-header__social" href="https://v.douyin.com/y7mvLjAkdJ4/" aria-label="抖音" target="_blank">
{php}
$content_arr = getDescriptionSeparate(707);
$douyin_url = $content_arr['0'] ?? '';
$sina_url = $content_arr['1'] ?? '';
$zhihu_url = $content_arr['2'] ?? '';
{/php}
<a class="site-header__social" href="{$douyin_url}" aria-label="抖音" target="_blank">
<span class="site-header__icon" aria-hidden="true">
<svg
viewBox="0 0 16 16"
@ -82,7 +88,7 @@
</svg>
</span>
</a>
<a class="site-header__social" href="https://weibo.com/u/78123456789012345678" aria-label="微博" target="_blank">
<a class="site-header__social" href="{$sina_url}" aria-label="微博" target="_blank">
<span class="site-header__icon" aria-hidden="true">
<svg
viewBox="0 0 16 16"
@ -102,7 +108,7 @@
</svg>
</span>
</a>
<a class="site-header__social" href="https://www.zhihu.com/people/78123456789012345678" aria-label="知乎" target="_blank">
<a class="site-header__social" href="{$zhihu_url}" aria-label="知乎" target="_blank">
<span class="site-header__icon" aria-hidden="true">
<svg
viewBox="0 0 16 16"
@ -357,13 +363,13 @@
{hcTaglib:category id="364" item="vo" field="*"}
{php}
$zhanhui_and_activity = $vo;
$thumbnail_url = $vo['thumbnail']['url'] ?? '';
$thumbnail_url_header = $vo['thumbnail']['url'] ?? '';
{/php}
{/hcTaglib:category}
<a class="nav-mega__promo" href="{$zhanhui_and_activity.alias}">
<div class="nav-mega__promo-media">
<img
src="{$thumbnail_url}"
src="{$thumbnail_url_header}"
alt=""
width="320"
height="200"

55
public/themes/website/1/zh/demo/contact.html

@ -230,6 +230,7 @@ $(function () {
success: function (res) {
if (res.code === 0 || res.code === 200) {
$form[0].reset();
showFormToast('提交成功,我们会尽快与您联系!');
} else {
alert(res.msg || '提交失败,请稍后重试');
}
@ -245,8 +246,62 @@ $(function () {
return false;
});
// 表单提交成功提示
var $toast = null;
var toastTimer = null;
function showFormToast(msg) {
if (!$toast) {
$toast = $(
'<div class="form-toast">' +
' <svg viewBox="0 0 24 24" width="22" height="22" fill="none" xmlns="http://www.w3.org/2000/svg">' +
' <circle cx="12" cy="12" r="10.5" stroke="currentColor" stroke-width="1.5"/>' +
' <path d="M7.5 12.5L10.5 15.5L16.5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>' +
' </svg>' +
' <span class="form-toast__text"></span>' +
'</div>'
);
$('body').append($toast);
}
$toast.find('.form-toast__text').text(msg);
$toast.addClass('form-toast--show');
clearTimeout(toastTimer);
toastTimer = setTimeout(function () {
$toast.removeClass('form-toast--show');
}, 3000);
}
});
</script>
<style>
.form-toast {
position: fixed;
left: 50%;
top: 40px;
transform: translate(-50%, -16px);
z-index: 9999;
display: flex;
align-items: center;
gap: 10px;
padding: 14px 24px;
border-radius: 8px;
background: #fff;
color: var(--color-primary);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
font-size: 15px;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.form-toast--show {
opacity: 1;
visibility: visible;
transform: translate(-50%, 0);
}
.form-toast__text {
color: var(--color-text);
}
</style>
</body>
</html>

2
public/themes/website/1/zh/demo/product.html

@ -158,7 +158,7 @@ $resource_download = $main_content['resource_download'] ?? [];
<a class="s-btn s-btn--light s-btn--pill {if empty($content)}hidden{/if}" href="javascript:;" data-selection-trigger>查看选型表</a>
<div class="p-hero__media">
<div class="p-hero__mark" aria-hidden="true">{$sub_title}</div>
<img src="{:deal_image_url($thumbnail_url)}" width="434" height="601" alt="RA3系列伺服驱动器" />
<img src="{:deal_image_url($thumbnail_url)}" width="434" height="601" alt="{$thumbnail_name}" />
</div>
</div>
</section>

Loading…
Cancel
Save