Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eppfax-h5-react
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
eppfax-h5-react
Commits
23cb7d4b
Commit
23cb7d4b
authored
Dec 25, 2023
by
hometown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: done.
parent
5a59fe7e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
src/pages/Home/components/HomeContent.tsx
+8
-2
src/pages/Home/index.tsx
+9
-6
No files found.
src/pages/Home/components/HomeContent.tsx
View file @
23cb7d4b
...
...
@@ -11,7 +11,11 @@ import apis from "@/apis";
import
type
{
ProductCode
,
QueryBranchListResponseData
}
from
"@/apis/common"
;
import
OrderHelper
from
"@/pages/Home/helper/order"
;
const
HomeContent
:
React
.
FC
=
()
=>
{
interface
HomeContentProps
{
queryUserOrders
:
()
=>
Promise
<
void
>
;
}
const
HomeContent
:
React
.
FC
<
HomeContentProps
>
=
(
props
)
=>
{
const
[
productList
]
=
useState
([
{
bannerImg
:
homeProductBanner1Img
,
...
...
@@ -36,7 +40,9 @@ const HomeContent: React.FC = () => {
const
[
activeProductIdx
,
setActiveProductIdx
]
=
useState
(
-
1
);
const
[
toasted
,
setToasted
]
=
useState
(
false
);
function
handleClickProduct
(
idx
:
number
)
{
async
function
handleClickProduct
(
idx
:
number
)
{
await
props
.
queryUserOrders
()
if
(
toasted
)
{
setActiveProductIdx
(
idx
);
setShowBranchListPopup
(
true
);
...
...
src/pages/Home/index.tsx
View file @
23cb7d4b
...
...
@@ -10,11 +10,7 @@ const Home: React.FC = () => {
const
[
params
]
=
useSearchParams
();
const
navigate
=
useNavigate
();
const
[
isAuthed
,
setIsAuthed
]
=
useState
(
false
);
useEffect
(()
=>
{
const
authenticateAndFetchOrders
=
async
()
=>
{
try
{
const
authResult
=
await
AuthUtil
.
auth
(
params
);
const
queryUserOrders
=
async
()
=>
{
const
[
res1
,
res2
]
=
await
Promise
.
all
([
await
apis
.
common
.
queryUserOrder
({
productCode
:
'4'
}),
await
apis
.
common
.
queryUserOrder
({
productCode
:
'5'
})
...
...
@@ -30,11 +26,18 @@ const Home: React.FC = () => {
navigate
(
`/lottery`
,{
replace
:
true
})
}
}
}
const
authenticateAndFetchOrders
=
async
()
=>
{
try
{
const
authResult
=
await
AuthUtil
.
auth
(
params
);
await
queryUserOrders
()
setIsAuthed
(
authResult
);
}
catch
(
error
)
{
}
};
useEffect
(()
=>
{
setTimeout
(
authenticateAndFetchOrders
,
400
);
},
[]);
...
...
@@ -43,7 +46,7 @@ const Home: React.FC = () => {
{
isAuthed
&&
(
<>
<
HomeBg
/>
<
HomeContent
/>
<
HomeContent
queryUserOrders=
{
queryUserOrders
}
/>
</>
)
}
</
div
>
...
...
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