From 6d9a0f3d06886a4fd2a0c6d6b35ecb37f936e847 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 26 May 2025 17:36:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mobile=E4=BA=A7=E5=93=81=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Product.php | 14 ++- app/index/lang/en-us/mobile.php | 2 + app/index/view/mobile/product/search.html | 30 +++++- app/index/view/mobile/public/header.html | 6 +- public/static/index/mobile/css/download.css | 23 ---- .../index/mobile/css/product_search.css | 100 ++++++++++++++++++ public/static/index/mobile/css/public.css | 24 +++++ public/static/index/mobile/images/ssapp.png | Bin 0 -> 831 bytes 8 files changed, 170 insertions(+), 29 deletions(-) create mode 100644 public/static/index/mobile/css/product_search.css create mode 100644 public/static/index/mobile/images/ssapp.png diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php index dc2270b8..74ea6b86 100644 --- a/app/index/controller/Product.php +++ b/app/index/controller/Product.php @@ -267,7 +267,12 @@ class Product extends Common */ public function search() { - $keywords = request()->param('keywords', ''); + $param = request()->param([ + 'keywords', + 'page/d' => 1, + 'size/d' => 10 + ]); + $keywords = $param['keywords'] ?? ''; // 关键词搜索 $products = ProductModel::field([ @@ -283,7 +288,11 @@ class Product extends Common ->onSale(true) ->onShelves(true) ->order(['sort' => 'asc', 'id' => 'desc']) - ->select() + ->paginate([ + 'list_rows' => $param['size'], + 'page' => $param['page'], + 'query' => request()->param() + ]) ->each(function ($item) use($keywords) { $item['spu'] = str_replace($keywords, ''.$keywords.'', $item['spu']); $item['name'] = str_replace($keywords, ''.$keywords.'', $item['name']); @@ -291,6 +300,7 @@ class Product extends Common return $item; }); View::assign('products', $products); + View::assign('page', $products->render()); return View::fetch('search'); } diff --git a/app/index/lang/en-us/mobile.php b/app/index/lang/en-us/mobile.php index 1e6e13c8..93092f50 100644 --- a/app/index/lang/en-us/mobile.php +++ b/app/index/lang/en-us/mobile.php @@ -58,4 +58,6 @@ return [ '支持型号' => 'Supported Models', '支持系统' => 'Supported Systems', '全站搜索' => 'Search', + '搜索' => 'Search', + '请搜索' => 'Please search...', ]; \ No newline at end of file diff --git a/app/index/view/mobile/product/search.html b/app/index/view/mobile/product/search.html index 5a0ec62e..31f070e9 100644 --- a/app/index/view/mobile/product/search.html +++ b/app/index/view/mobile/product/search.html @@ -1,7 +1,33 @@ {extend name="public/base" /} {block name="style"} - + {/block} {block name="main"} - +
