From 5855a97255ea8c63e890b2b9943e7172710e7891 Mon Sep 17 00:00:00 2001 From: wolfcode <37436228+wolf-leo@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:23:27 +0800 Subject: [PATCH] Improve category selection in goods management - Simplify HTML structure and recommend a concise coding method for category selection in both add and edit pages of the mall goods module. - Modify the corresponding JS file to support the new category display format. - Refactor controller code to assign categories using a more efficient method. - Ensure consistent category data processing across all related views. Note: This change updates the way categories are presented to the admin user, enhancing usability and maintainability of the goods management system. --- app/admin/controller/mall/Goods.php | 2 ++ app/admin/view/mall/goods/add.html | 15 +++++++++++++++ app/admin/view/mall/goods/edit.html | 14 ++++++++++++++ app/admin/view/mall/goods/index.html | 5 ++++- app/admin/view/system/uploadfile/index.html | 3 +-- public/static/admin/js/mall/goods.js | 2 +- 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/app/admin/controller/mall/Goods.php b/app/admin/controller/mall/Goods.php index 3ba19f6..14beecd 100644 --- a/app/admin/controller/mall/Goods.php +++ b/app/admin/controller/mall/Goods.php @@ -2,6 +2,7 @@ namespace app\admin\controller\mall; +use app\admin\model\MallCate; use app\admin\model\MallGoods; use app\common\controller\AdminController; use app\admin\service\annotation\ControllerAnnotation; @@ -25,6 +26,7 @@ class Goods extends AdminController { parent::__construct($app); $this->model = new MallGoods(); + $this->assign('cate', (new MallCate())->column('title', 'id')); } /** diff --git a/app/admin/view/mall/goods/add.html b/app/admin/view/mall/goods/add.html index 44b169a..f150645 100644 --- a/app/admin/view/mall/goods/add.html +++ b/app/admin/view/mall/goods/add.html @@ -1,5 +1,7 @@