Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
d915cca5
Commit
d915cca5
authored
Jun 10, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改首页refresh
parent
c1d38475
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
17 deletions
+19
-17
index.tsx
src/pages/home/components/AdvertisementSpace/index.tsx
+7
-11
PurchaseCenter.tsx
src/pages/home/components/Centers/PurchaseCenter.tsx
+2
-1
layout.tsx
src/pages/home/components/Centers/layout.tsx
+9
-4
useViewRequest.tsx
src/pages/home/hooks/useViewRequest.tsx
+1
-1
No files found.
src/pages/home/components/AdvertisementSpace/index.tsx
View file @
d915cca5
...
...
@@ -12,20 +12,16 @@ interface Iprops {
}
const
AdvertisementContainer
=
()
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
data
,
setData
]
=
useState
<
any
[]
>
([]);
const
getList
=
(
params
)
=>
{
setLoading
(
true
);
PublicApi
.
getManageContentAdvertFindAllByColumnType
(
params
)
.
then
(({
data
,
code
})
=>
{
setLoading
(
false
);
if
(
code
===
1000
)
{
useEffect
(()
=>
{
async
function
getList
(
params
:
{
columnType
:
string
})
{
const
{
data
,
code
}
=
await
PublicApi
.
getManageContentAdvertFindAllByColumnType
(
params
);
if
(
code
===
1000
)
{
setData
(
data
);
}
})
}
useEffect
(()
=>
{
getList
({
columnType
:
1
})
}
getList
({
columnType
:
'1'
})
},
[])
return
(
...
...
src/pages/home/components/Centers/PurchaseCenter.tsx
View file @
d915cca5
...
...
@@ -30,7 +30,7 @@ const isBusiness = [1, 2];
/** memberRoleType 是否是服务消费者 */
const
isConsumer
=
2
;
const
PurchaseCenter
:
React
.
FC
<
Iprops
>
=
()
=>
{
const
{
loading
,
responseData
,
filterEmptyList
,
isError
,
ref
,
inViewPort
}
=
useViewRequest
<
GetReportMemberHomeGetPurchaseTallyResponse
,
any
>
(
PublicApi
.
getReportMemberHomeGetPurchaseTally
,
{})
const
{
loading
,
responseData
,
filterEmptyList
,
isError
,
ref
,
inViewPort
,
refresh
}
=
useViewRequest
<
GetReportMemberHomeGetPurchaseTallyResponse
,
any
>
(
PublicApi
.
getReportMemberHomeGetPurchaseTally
,
{})
const
auth
=
getAuth
()
useEffect
(()
=>
{
...
...
@@ -64,6 +64,7 @@ const PurchaseCenter: React.FC<Iprops> = () => {
}
loading=
{
loading
}
isError=
{
isError
}
onRefresh=
{
refresh
}
>
<
Fragment
>
{
...
...
src/pages/home/components/Centers/layout.tsx
View file @
d915cca5
...
...
@@ -40,11 +40,15 @@ interface Iprops {
* 出错是的render方法
*/
customizeErrorRender
?:
(()
=>
React
.
ReactElement
)
|
null
// onRefresh: (
) => void
onRefresh
?:
(
params
:
any
)
=>
void
};
const
Layout
:
LayoutType
&
React
.
FC
<
Iprops
>
=
(
props
)
=>
{
const
{
title
,
tips
,
extra
,
children
,
loading
,
isError
,
customizeErrorRender
,
viewRef
}
=
props
;
const
{
title
,
tips
,
extra
,
children
,
loading
,
isError
,
customizeErrorRender
,
viewRef
,
onRefresh
}
=
props
;
const
handleRefresh
=
()
=>
{
onRefresh
?.({})
}
const
renderStatus
=
()
=>
{
if
(
loading
)
{
...
...
@@ -54,7 +58,7 @@ const Layout: LayoutType & React.FC<Iprops> = (props) => {
return
(
customizeErrorRender
?.()
||
(
<
div
>
<
Button
>
拉取数据时发生了错误,点击刷新
</
Button
>
<
Button
onClick=
{
handleRefresh
}
>
拉取数据时发生了错误,点击刷新
</
Button
>
</
div
>
)
)
...
...
@@ -165,7 +169,8 @@ Layout.defaultProps = {
tips
:
''
,
extra
:
null
,
isError
:
false
,
customizeErrorRender
:
null
customizeErrorRender
:
null
,
onRefresh
:
null
}
export
default
Layout
;
src/pages/home/hooks/useViewRequest.tsx
View file @
d915cca5
...
...
@@ -46,7 +46,7 @@ function useViewRequest<T, P>(fn: (postData: P) => Promise<ResponseDataType & {
},
[
inViewPort
])
const
refresh
=
async
<
T1
extends
P
>
(refreshParams: T1) =
>
{
fetchData
(
refreshParams
)
fetchData
(
refreshParams
||
params
)
}
const filterEmptyList = useMemo(() =
>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment