mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-03 03:56:41 +08:00
fix: type problems
This commit is contained in:
parent
5f37f0e4b0
commit
2cdf950844
@ -96,7 +96,7 @@ type TGetCompListParam = {
|
|||||||
search?: string
|
search?: string
|
||||||
page?: number
|
page?: number
|
||||||
type?: number
|
type?: number
|
||||||
pageSize: number
|
pageSize?: number
|
||||||
cate?: number | string
|
cate?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +109,7 @@ export type TGetCompListResult = {
|
|||||||
title: string
|
title: string
|
||||||
width: number
|
width: number
|
||||||
name?: string
|
name?: string
|
||||||
|
cate?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type getCompListReturn = TPageRequestResult<TGetCompListResult[]>
|
type getCompListReturn = TPageRequestResult<TGetCompListResult[]>
|
||||||
|
@ -55,7 +55,7 @@ type TState = {
|
|||||||
list: TGetCompListResult[]
|
list: TGetCompListResult[]
|
||||||
searchValue: string
|
searchValue: string
|
||||||
currentCategory: TGetCompListResult | null
|
currentCategory: TGetCompListResult | null
|
||||||
types: []
|
types: {cate: string, name: string}[]
|
||||||
showList: TGetCompListResult[][]
|
showList: TGetCompListResult[][]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ const load = async (init: boolean = false) => {
|
|||||||
|
|
||||||
const res = await api.home.getCompList({
|
const res = await api.home.getCompList({
|
||||||
...pageOptions,
|
...pageOptions,
|
||||||
cate: state.currentCategory?.id,
|
cate: state.currentCategory?.id || state.currentCategory?.cate,
|
||||||
})
|
})
|
||||||
if (init) {
|
if (init) {
|
||||||
state.list = res?.list
|
state.list = res?.list
|
||||||
|
@ -72,6 +72,7 @@ type TState = {
|
|||||||
|
|
||||||
type TCurrentCategory = {
|
type TCurrentCategory = {
|
||||||
name: string
|
name: string
|
||||||
|
cate?: string | number
|
||||||
id?: number
|
id?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +150,7 @@ const load = async (init: boolean = false) => {
|
|||||||
state.loading = true
|
state.loading = true
|
||||||
pageOptions.page += 1
|
pageOptions.page += 1
|
||||||
const list = await api.material.getList({
|
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) {
|
if (init) {
|
||||||
state.list = list?.list
|
state.list = list?.list
|
||||||
@ -168,6 +169,7 @@ const searchChange = (_: Event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectTypes = (item: TCurrentCategory) => {
|
const selectTypes = (item: TCurrentCategory) => {
|
||||||
|
console.log(item)
|
||||||
state.currentCategory = item
|
state.currentCategory = item
|
||||||
load(true)
|
load(true)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user