|
@@ -4,7 +4,7 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
import { goodsCategoryClient, advertisementClient } from '@/api';
|
|
import { goodsCategoryClient, advertisementClient } from '@/api';
|
|
|
import CategorySidebar from '@/components/category/CategorySidebar';
|
|
import CategorySidebar from '@/components/category/CategorySidebar';
|
|
|
import CategorySidebarItem from '@/components/category/CategorySidebarItem';
|
|
import CategorySidebarItem from '@/components/category/CategorySidebarItem';
|
|
|
-import CategoryTabbar from '@/components/category/CategoryTabbar';
|
|
|
|
|
|
|
+import CategoryTabbar, { TabItem } from '@/components/category/CategoryTabbar';
|
|
|
import { Image } from '@/components/ui/image';
|
|
import { Image } from '@/components/ui/image';
|
|
|
import TDesignToast from '@/components/tdesign/toast';
|
|
import TDesignToast from '@/components/tdesign/toast';
|
|
|
import { navigateTo } from '@tarojs/taro';
|
|
import { navigateTo } from '@tarojs/taro';
|
|
@@ -78,8 +78,11 @@ const CategoryPage: React.FC = () => {
|
|
|
// 当前选中的一级分类
|
|
// 当前选中的一级分类
|
|
|
const currentCategory = categories[activeCategoryIndex];
|
|
const currentCategory = categories[activeCategoryIndex];
|
|
|
|
|
|
|
|
|
|
+ // 当前一级分类的子分类, 当前先用当前选中的分类自身代替
|
|
|
|
|
+ const subCategories = categories.filter(item => item.id === currentCategory.id);
|
|
|
|
|
+
|
|
|
// 当前一级分类的子分类
|
|
// 当前一级分类的子分类
|
|
|
- const subCategories = currentCategory?.child_cate || [];
|
|
|
|
|
|
|
+ // const subCategories = currentCategory?.child_cate || [];
|
|
|
|
|
|
|
|
// 广告图片
|
|
// 广告图片
|
|
|
const advertisementImage = advertisements[0]?.imageFile?.fullUrl || '';
|
|
const advertisementImage = advertisements[0]?.imageFile?.fullUrl || '';
|
|
@@ -163,9 +166,9 @@ const CategoryPage: React.FC = () => {
|
|
|
<View className="sub-category-tabbar">
|
|
<View className="sub-category-tabbar">
|
|
|
<CategoryTabbar
|
|
<CategoryTabbar
|
|
|
tabList={subCategories.map((cat: Category) => ({
|
|
tabList={subCategories.map((cat: Category) => ({
|
|
|
- id: cat.id,
|
|
|
|
|
|
|
+ id: cat.id.toString(),
|
|
|
name: cat.name,
|
|
name: cat.name,
|
|
|
- }))}
|
|
|
|
|
|
|
+ } as TabItem))}
|
|
|
currentActive={activeSubCategoryId}
|
|
currentActive={activeSubCategoryId}
|
|
|
onChange={handleSubCategoryChange}
|
|
onChange={handleSubCategoryChange}
|
|
|
showMore={true}
|
|
showMore={true}
|