From ac04840889ab3bbf98813393c4d902e69e32361c Mon Sep 17 00:00:00 2001 From: Wayne Date: Fri, 8 Mar 2024 23:02:48 +0800 Subject: [PATCH] bug fix 20240308 --- app/app/appapi/controller/IndexController.php | 13 ++++++++++--- web/pages/index.vue | 13 ++++++++++++- web/pages/social.vue | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/app/appapi/controller/IndexController.php b/app/app/appapi/controller/IndexController.php index f4a1e50..105f1f3 100644 --- a/app/app/appapi/controller/IndexController.php +++ b/app/app/appapi/controller/IndexController.php @@ -47,6 +47,7 @@ class IndexController extends BaseController return $this->Success($result); } + // 取得父類別列表 public function getParentCateList(Request $request) { $param = $request->get(); @@ -61,9 +62,15 @@ class IndexController extends BaseController ->toArray(); - // foreach($list as $key => $val){ - - // } + foreach($list as $key => $val){ + // 取得子類別編號 + $list[$key]['cid'] = Db::name('category') + ->where('lang', $param['lang']) + ->where('parent_id', $val['id']) + ->order('sort_order', 'asc') + ->limit(1) + ->value('id'); + } return $this->Success($list); } diff --git a/web/pages/index.vue b/web/pages/index.vue index 7397f83..1db9847 100644 --- a/web/pages/index.vue +++ b/web/pages/index.vue @@ -6,6 +6,7 @@ import featureImg from '@/assets/img/iStock.jpg'; const { locale } = useI18n() const store = useStore(); +const router = useRouter(); const { config } = storeToRefs(store); @@ -58,6 +59,13 @@ onMounted(async () => { }); }) + +// 至產品頁 +const goProd = (cid) => { + if(cid && cid !== null){ + router.push({ path: '/products/list/' + cid }); + } +}