diff --git a/src/api/home.ts b/src/api/home.ts index 761e393..ea7a271 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -96,7 +96,7 @@ type TGetCompListParam = { search?: string page?: number type?: number - pageSize: number + pageSize?: number cate?: number | string } @@ -109,6 +109,7 @@ export type TGetCompListResult = { title: string width: number name?: string + cate?: string } type getCompListReturn = TPageRequestResult diff --git a/src/components/modules/panel/wrap/CompListWrap.vue b/src/components/modules/panel/wrap/CompListWrap.vue index 0e9b2b6..3962ad4 100644 --- a/src/components/modules/panel/wrap/CompListWrap.vue +++ b/src/components/modules/panel/wrap/CompListWrap.vue @@ -55,7 +55,7 @@ type TState = { list: TGetCompListResult[] searchValue: string currentCategory: TGetCompListResult | null - types: [] + types: {cate: string, name: string}[] showList: TGetCompListResult[][] } @@ -129,7 +129,7 @@ const load = async (init: boolean = false) => { const res = await api.home.getCompList({ ...pageOptions, - cate: state.currentCategory?.id, + cate: state.currentCategory?.id || state.currentCategory?.cate, }) if (init) { state.list = res?.list diff --git a/src/components/modules/panel/wrap/GraphListWrap.vue b/src/components/modules/panel/wrap/GraphListWrap.vue index 5265f71..7eafe98 100644 --- a/src/components/modules/panel/wrap/GraphListWrap.vue +++ b/src/components/modules/panel/wrap/GraphListWrap.vue @@ -72,6 +72,7 @@ type TState = { type TCurrentCategory = { name: string + cate?: string | number id?: number } @@ -149,7 +150,7 @@ const load = async (init: boolean = false) => { state.loading = true pageOptions.page += 1 const list = await api.material.getList({ - ...{ cate: state.currentCategory?.id, search: state.searchKeyword, ...pageOptions }, + ...{ cate: state.currentCategory?.id || state.currentCategory?.cate, search: state.searchKeyword, ...pageOptions }, }) if (init) { state.list = list?.list @@ -168,6 +169,7 @@ const searchChange = (_: Event) => { } const selectTypes = (item: TCurrentCategory) => { + console.log(item) state.currentCategory = item load(true) }