🐞 fix(邀请码): 修复分页引发的问题
This commit is contained in:
parent
b8a7d5634f
commit
ea1de11eb5
@ -5,6 +5,7 @@ import useUserInfo from './useUserInfo'
|
|||||||
import useLogin from './useLogin'
|
import useLogin from './useLogin'
|
||||||
import useLoginRequest from './useLoginRequest'
|
import useLoginRequest from './useLoginRequest'
|
||||||
import { BASE_URL, WX_APPID } from '@/common/constant'
|
import { BASE_URL, WX_APPID } from '@/common/constant'
|
||||||
|
import { getFilterData } from '@/common/util'
|
||||||
|
|
||||||
interface Params {
|
interface Params {
|
||||||
code: string | null
|
code: string | null
|
||||||
@ -133,12 +134,13 @@ export const useRequest = (
|
|||||||
stateRef.current.query = {
|
stateRef.current.query = {
|
||||||
...sub_options,
|
...sub_options,
|
||||||
...(options.pagination && {
|
...(options.pagination && {
|
||||||
page: stateRef.current.page,
|
page: stateRef.current.page || '',
|
||||||
size: stateRef.current.pageSize,
|
size: stateRef.current.pageSize || '',
|
||||||
}),
|
}),
|
||||||
...stateRef.current.filter,
|
...stateRef.current.filter,
|
||||||
...stateRef.current.sort,
|
...stateRef.current.sort,
|
||||||
}
|
}
|
||||||
|
const query = getFilterData(stateRef.current.query)
|
||||||
try {
|
try {
|
||||||
const token = Taro.getStorageSync('token')
|
const token = Taro.getStorageSync('token')
|
||||||
const q = {
|
const q = {
|
||||||
@ -152,10 +154,10 @@ export const useRequest = (
|
|||||||
},
|
},
|
||||||
...(options.method?.toUpperCase() == 'GET'
|
...(options.method?.toUpperCase() == 'GET'
|
||||||
? {
|
? {
|
||||||
data: stateRef.current.query,
|
data: query,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
data: options.type?.toUpperCase() == 'FORMDATA' ? qs.stringify(stateRef.current?.query) : stateRef.current.query,
|
data: options.type?.toUpperCase() == 'FORMDATA' ? qs.stringify(stateRef.current?.query) : query,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
const result = await Taro.request(q as any)
|
const result = await Taro.request(q as any)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user