From aba102d63c47c017cc7b2f6007d88b258437383d Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Wed, 2 Jul 2025 10:58:53 +0800 Subject: [PATCH 1/9] =?UTF-8?q?perf:=20=E5=85=B3=E9=94=AE=E8=AF=8D?= =?UTF-8?q?=E9=AB=98=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/common.php | 18 +++++++++--------- app/index/controller/Product.php | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/index/common.php b/app/index/common.php index 81d3df13..63d2a364 100644 --- a/app/index/common.php +++ b/app/index/common.php @@ -226,18 +226,18 @@ if (!function_exists('get_platform')) { if (!function_exists('highlight_keywords')) { /** * 高亮关键词 - * @param string $item - * @param string $keywords - * @param array $class + * @param string $text // 要处理的文本 + * @param string $keyword // 关键词 + * @param string|callable $repalce // 替换函数或字符串 * @return string */ - function highlight_keywords(string $text, string $keywords, array $class=[]): string + function highlight_keywords(string $text, string $keyword, string|callable $replace): string { - return preg_replace_callback('/' . preg_quote($keywords, '/') . '+/i', function($match) use($text, $class) { - if (empty($match)) { - return $text; - } - return '' . $match[0] . ''; + return preg_replace_callback('/' . preg_quote($keyword, '/') . '+/i', function($match) use($text, $replace) { + if (empty($match)) return $text; + if (is_string($replace)) return '' . $match[0] . ''; + if (is_callable($replace)) return $replace($match[0]); + return $match[0]; }, $text); } } diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php index b16ded89..1dcd0921 100644 --- a/app/index/controller/Product.php +++ b/app/index/controller/Product.php @@ -299,9 +299,10 @@ class Product extends Common 'query' => request()->param() ]) ->each(function ($item) use($keywords) { - $item['spu'] = highlight_keywords($item['spu'], $keywords, ['redpoint']); - $item['name'] = highlight_keywords($item['name'], $keywords, ['redpoint']); - $item['short_name'] = highlight_keywords($item['short_name'], $keywords, ['redpoint']); + $replace = fn($txt) => '' . $txt . ''; + $item['spu'] = highlight_keywords($item['spu'], $keywords, $replace); + $item['name'] = highlight_keywords($item['name'], $keywords, $replace); + $item['short_name'] = highlight_keywords($item['short_name'], $keywords, $replace); return $item; }); View::assign('products', $products); From 27f23cd32148e893771ada9c91f15a451dddbf23 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Wed, 2 Jul 2025 14:19:53 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20pc=20=E4=BA=A7=E5=93=81=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E5=88=86=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/pc/product/search.html | 5 +++++ public/static/index/pc/css/product_search.css | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/app/index/view/pc/product/search.html b/app/index/view/pc/product/search.html index 2356987d..be4a115f 100644 --- a/app/index/view/pc/product/search.html +++ b/app/index/view/pc/product/search.html @@ -14,6 +14,7 @@ + {notempty name="products"} +
{$page|raw}
+ {else/} +
暂无数据
+ {/notempty} {/block} \ No newline at end of file diff --git a/public/static/index/pc/css/product_search.css b/public/static/index/pc/css/product_search.css index 421b1371..26f12564 100644 --- a/public/static/index/pc/css/product_search.css +++ b/public/static/index/pc/css/product_search.css @@ -103,3 +103,25 @@ .orico_Page_search .searchMain ::placeholder { color: #737373; } +.orico_Page_search .searchMain .pagination { + zoom: 1; + text-align: center; + color: #555; + clear: both; + padding-bottom: 2rem; +} +.orico_Page_search .searchMain .pagination span { + padding: 0px 0px; + display: inline-block; +} +.orico_Page_search .searchMain .pagination li { + display: inline-block; + width: 34px; + height: 22px; + line-height: 22px; + font-size: 16px; +} +.orico_Page_search .searchMain .pagination li.active { + background-color: #444444; + color: #ffffff; +} From 45218f85af84482ea861426ea9a10b6790df1f2a Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Wed, 2 Jul 2025 14:44:35 +0800 Subject: [PATCH 3/9] =?UTF-8?q?pref:=20pc=20=E4=BA=A7=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=A1=A8=E5=8D=95=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/pc/product/detail.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/index/view/pc/product/detail.html b/app/index/view/pc/product/detail.html index 38cbe4b4..aee6899a 100644 --- a/app/index/view/pc/product/detail.html +++ b/app/index/view/pc/product/detail.html @@ -225,7 +225,7 @@ - + @@ -273,21 +273,12 @@ // 处理表单提交 modal.find("form").submit(function(e) { e.preventDefault(); + var form = $(this) var formData = $(this).serialize(); - // 这里可以添加代码将formData发送到服务器 - // 例如通过AJAX - console.log("提交的数据: " + formData); - // 提交成功后可以选择关闭模态框 - modal.hide(); - }); - - // 提交询盘 - $('#send').click(function() { - var form = $(this).parents('form'); $.ajax({ url: "{:url('product/inquiry')}", type: 'POST', - data: form.serialize(), + data: formData, success: function(r) { if (r.code == 0) { form[0].reset(); // 重置表单 @@ -297,6 +288,7 @@ }, error: function(e) { console.error(e); + modal.hide(); } }) }); From 96bd1fc4c23a90e1fa772d89fba984f58ade0242 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Wed, 2 Jul 2025 15:06:28 +0800 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20pc=20=E6=96=87=E7=AB=A0=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8F=90=E7=A4=BA=E8=AF=AD=E8=A8=80=E6=9C=AA=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Article.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index edbb3869..a0c4f7fc 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -170,9 +170,9 @@ class Article extends Common ]); $ret = ArticleLeaveMessageModel::create($data); if ($ret->isEmpty()) { - return error(lang('留言提交失败')); + return error(lang('信息提交失败!')); } - return success(lang('留言提交成功')); + return success(lang('信息已成功提交!')); } } From 3d83c95a722679d107ffd24cc9b76619a15567f8 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Wed, 2 Jul 2025 15:30:25 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20mobile=20nas=E4=B8=93=E9=A2=98?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/mobile/public/nas_header.html | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/index/view/mobile/public/nas_header.html b/app/index/view/mobile/public/nas_header.html index 7722b738..369d9d36 100644 --- a/app/index/view/mobile/public/nas_header.html +++ b/app/index/view/mobile/public/nas_header.html @@ -15,19 +15,6 @@
-
- -
-
-
-
{:lang_i18n('产品列表')}
- {notempty name="header_categorys"} - {volist name="header_categorys" id="ca"} - - {/volist} - {/notempty} -
-
{notempty name="header_navigation"} {volist name="header_navigation" id="nav"}
From b0935db1b8ca6e3a7e6b0fd8c769f39190c8b67b Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Thu, 3 Jul 2025 13:56:57 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20pc=20=E4=BA=A7=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E5=9B=BE=E5=86=8C=E4=B8=AD=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=94=BE=E7=AC=AC=E4=B8=80=E4=B8=AAsku=E4=B8=8B=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/pc/product/detail.html | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/index/view/pc/product/detail.html b/app/index/view/pc/product/detail.html index aee6899a..87f8250f 100644 --- a/app/index/view/pc/product/detail.html +++ b/app/index/view/pc/product/detail.html @@ -37,13 +37,13 @@
    + {volist name="sku.photo_album" id="photo"} +
  • + {/volist} {if condition="!empty($product.video_img) && !empty($product.video_url) && $idx == 1"}
  • {/if} - {volist name="sku.photo_album" id="photo"} -
  • - {/volist}
@@ -52,16 +52,9 @@
- {if condition="!empty($product.video_img) && !empty($product.video_url) && $idx == 1"} - - - {else/} {notempty name="sku.photo_album[0]"} {/notempty} - {/if}
{/volist} From 4942af1fae34ef35110d8ea18bb1ed209a5e0235 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Thu, 3 Jul 2025 14:01:34 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20mobile=20=E4=BA=A7=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E5=9B=BE=E5=86=8C=E4=B8=AD=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=94=BE=E7=AC=AC=E4=B8=80=E4=B8=AAsku=E4=B8=8B=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/mobile/product/detail.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/index/view/mobile/product/detail.html b/app/index/view/mobile/product/detail.html index 323f8c66..3ea3fc49 100644 --- a/app/index/view/mobile/product/detail.html +++ b/app/index/view/mobile/product/detail.html @@ -37,6 +37,13 @@
{/volist} + {if condition="!empty($product.video_img) && !empty($product.video_url) && $idx == 1"} +
+ +
+ {/if}
From b892a1346d6379a97c83f1d36a3a3e5027ddbe38 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Fri, 4 Jul 2025 10:34:23 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20openapi=20=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/openapi/controller/v1/Product.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/openapi/controller/v1/Product.php b/app/openapi/controller/v1/Product.php index b3ad3f94..c520191d 100644 --- a/app/openapi/controller/v1/Product.php +++ b/app/openapi/controller/v1/Product.php @@ -12,6 +12,7 @@ class Product */ public function list() { + $params = request()->get([ 'category_id', 'language' => 'zh-cn', @@ -47,8 +48,8 @@ class Product ->order(['sort' => 'asc', 'id' => 'desc']) ->hidden(['category_id']) ->paginate([ - 'list_row' => $params['size'], - 'page' => $params['page'] + 'list_rows' => $params['size'], + 'page' => $params['page'] ]) ->each(function($item) { if (!empty($item['cover_image']) && !str_starts_with($item['cover_image'], 'http')) { From 8116315a6d5ea22c607e0a11fd07d15d4894e819 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Fri, 4 Jul 2025 16:40:03 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20pc=20nas=E4=B8=93=E9=A2=98=E9=A1=B5?= =?UTF-8?q?=20=E5=AF=BC=E8=88=AA=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/pc/public/nas_header.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/index/view/pc/public/nas_header.html b/app/index/view/pc/public/nas_header.html index 0f35079a..1fac09bb 100644 --- a/app/index/view/pc/public/nas_header.html +++ b/app/index/view/pc/public/nas_header.html @@ -17,9 +17,10 @@