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
5a59fe7e
Commit
5a59fe7e
authored
Dec 22, 2023
by
hometown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 提交代码
parent
20a89551
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
57 deletions
+86
-57
scripts/deploy.test.sh
+1
-1
src/apis/common.ts
+11
-3
src/assets/images/homeTopBanner.png
+0
-0
src/assets/images/lotteryWrapBg.png
+0
-0
src/pages/Home/components/HomeContent.tsx
+23
-16
src/pages/Home/helper/order.ts
+0
-26
src/pages/Home/index.tsx
+17
-3
src/pages/Lottery/index.tsx
+32
-6
src/utils/auth.ts
+1
-1
src/utils/axios.ts
+1
-1
No files found.
scripts/deploy.test.sh
View file @
5a59fe7e
scp
-i
~/.ssh/id_rsa
-r
/Users/hometown/dh/eppfax-h5/dist/
*
root@
123.56.20.201
:/data/app_front_test/eppfax-h5
scp
-i
~/.ssh/id_rsa
-r
/Users/hometown/dh/eppfax-h5/dist/
*
root@
82.156.138.187
:/data/app_front_test/eppfax-h5
src/apis/common.ts
View file @
5a59fe7e
import
axiosInstance
from
'@/utils/axios'
import
axiosInstance
from
'@/utils/axios'
// 产品编码:4 一元购,5抽奖
export
type
ProductCode
=
'4'
|
'5'
/**
/**
* 获取登录地址
* 获取登录地址
*/
*/
...
@@ -40,9 +44,13 @@ interface QueryUserOrderResponse {
...
@@ -40,9 +44,13 @@ interface QueryUserOrderResponse {
lotteryOrderId
:
string
lotteryOrderId
:
string
}
}
export
const
queryUserOrder
=
async
():
Promise
<
BackendResponse
<
QueryUserOrderResponse
>>
=>
{
interface
QueryUserOrderRequestData
{
productCode
:
ProductCode
}
export
const
queryUserOrder
=
async
(
requestData
:
QueryUserOrderRequestData
):
Promise
<
BackendResponse
<
QueryUserOrderResponse
>>
=>
{
try
{
try
{
const
response
=
await
axiosInstance
.
get
<
BackendResponse
<
QueryUserOrderResponse
>>
(
'/api/order/getUserOrder'
)
const
response
=
await
axiosInstance
.
post
<
BackendResponse
<
QueryUserOrderResponse
>>
(
'/api/order/getUserOrder'
,
requestData
)
return
response
.
data
return
response
.
data
}
catch
(
error
)
{
}
catch
(
error
)
{
throw
error
throw
error
...
@@ -70,7 +78,7 @@ export const queryBranchList = async (): Promise<BackendResponse<QueryBranchList
...
@@ -70,7 +78,7 @@ export const queryBranchList = async (): Promise<BackendResponse<QueryBranchList
export
interface
CreateOrderRequestData
{
export
interface
CreateOrderRequestData
{
branchName
:
string
branchName
:
string
branchCode
:
string
branchCode
:
string
productCode
:
string
productCode
:
ProductCode
number
:
number
number
:
number
}
}
...
...
src/assets/images/homeTopBanner.png
View file @
5a59fe7e
This diff is collapsed.
Click to expand it.
src/assets/images/lotteryWrapBg.png
View file @
5a59fe7e
86.7 KB
|
W:
|
H:
356 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/pages/Home/components/HomeContent.tsx
View file @
5a59fe7e
...
@@ -8,14 +8,25 @@ import HomeProductItem from "@/pages/Home/components/HomeProductItem";
...
@@ -8,14 +8,25 @@ import HomeProductItem from "@/pages/Home/components/HomeProductItem";
import
{
Overlay
,
Popup
,
Toast
}
from
"@nutui/nutui-react"
;
import
{
Overlay
,
Popup
,
Toast
}
from
"@nutui/nutui-react"
;
import
HomeRuleContent
from
"@/pages/Home/components/HomeRuleContent"
;
import
HomeRuleContent
from
"@/pages/Home/components/HomeRuleContent"
;
import
apis
from
"@/apis"
;
import
apis
from
"@/apis"
;
import
{
type
QueryBranchListResponseData
}
from
"@/apis/common"
;
import
type
{
ProductCode
,
QueryBranchListResponseData
}
from
"@/apis/common"
;
import
OrderHelper
from
"@/pages/Home/helper/order"
;
import
OrderHelper
from
"@/pages/Home/helper/order"
;
import
{
useNavigate
}
from
"react-router-dom"
;
const
HomeContent
:
React
.
FC
=
()
=>
{
const
HomeContent
:
React
.
FC
=
()
=>
{
const
[
productList
]
=
useState
([
const
[
productList
]
=
useState
([
{
bannerImg
:
homeProductBanner1Img
,
title
:
"厅堂实物 1元购"
,
buttonTextColor
:
"#F41E71"
,
productCode
:
"4"
,
buttonText
:
"立即购买"
},
{
{
bannerImg
:
homeProductBanner2Img
,
title
:
"微信立减金抽奖100%中奖"
,
buttonTextColor
:
"#1FA189"
,
productCode
:
"5"
,
buttonText
:
"立即抽奖"
}
bannerImg
:
homeProductBanner1Img
,
title
:
"厅堂礼品 0元购"
,
buttonTextColor
:
"#F41E71"
,
productCode
:
"4"
,
buttonText
:
"立即购买"
},
{
bannerImg
:
homeProductBanner2Img
,
title
:
"微信立减金抽奖100%中奖"
,
buttonTextColor
:
"#1FA189"
,
productCode
:
"5"
,
buttonText
:
"立即抽奖"
}
]);
]);
const
[
branchList
,
setBranchList
]
=
useState
<
QueryBranchListResponseData
[]
>
([]);
const
[
branchList
,
setBranchList
]
=
useState
<
QueryBranchListResponseData
[]
>
([]);
...
@@ -24,7 +35,6 @@ const HomeContent: React.FC = () => {
...
@@ -24,7 +35,6 @@ const HomeContent: React.FC = () => {
const
[
activeBranchIdx
,
setActiveBranchIdx
]
=
useState
(
-
1
);
const
[
activeBranchIdx
,
setActiveBranchIdx
]
=
useState
(
-
1
);
const
[
activeProductIdx
,
setActiveProductIdx
]
=
useState
(
-
1
);
const
[
activeProductIdx
,
setActiveProductIdx
]
=
useState
(
-
1
);
const
[
toasted
,
setToasted
]
=
useState
(
false
);
const
[
toasted
,
setToasted
]
=
useState
(
false
);
const
navigate
=
useNavigate
();
function
handleClickProduct
(
idx
:
number
)
{
function
handleClickProduct
(
idx
:
number
)
{
if
(
toasted
)
{
if
(
toasted
)
{
...
@@ -38,19 +48,16 @@ const HomeContent: React.FC = () => {
...
@@ -38,19 +48,16 @@ const HomeContent: React.FC = () => {
function
handleConfirm
()
{
function
handleConfirm
()
{
if
(
activeBranchIdx
===
-
1
||
activeProductIdx
===
-
1
)
return
;
if
(
activeBranchIdx
===
-
1
||
activeProductIdx
===
-
1
)
return
;
const
selectedBranch
=
branchList
[
activeBranchIdx
];
const
selectedBranch
=
branchList
[
activeBranchIdx
];
if
(
activeProductIdx
===
0
)
{
console
.
log
(
selectedBranch
,
'ces'
);
setShowBranchListPopup
(
false
);
const
params
=
{
OrderHelper
.
submitOrder
({
branchName
:
selectedBranch
.
branchName
,
branchName
:
selectedBranch
.
branchName
,
branchCode
:
selectedBranch
.
branchCode
,
branchCode
:
selectedBranch
.
branchCode
,
productCode
:
productList
[
activeProductIdx
].
productCode
as
ProductCode
,
productCode
:
productList
[
activeProductIdx
].
productCode
,
number
:
1
number
:
1
});
}
else
if
(
activeProductIdx
===
1
)
{
navigate
(
`lottery?branchName=
${
selectedBranch
.
branchName
}
&branchCode=
${
selectedBranch
.
branchCode
}
`
);
}
}
setShowBranchListPopup
(
false
);
OrderHelper
.
submitOrder
(
params
);
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/pages/Home/helper/order.ts
View file @
5a59fe7e
import
apis
from
"@/apis"
;
import
apis
from
"@/apis"
;
import
{
type
CreateOrderRequestData
}
from
"@/apis/common"
;
import
{
type
CreateOrderRequestData
}
from
"@/apis/common"
;
import
{
type
NavigateFunction
}
from
"react-router-dom"
;
class
OrderHelper
{
class
OrderHelper
{
/**
/**
...
@@ -44,31 +43,6 @@ class OrderHelper {
...
@@ -44,31 +43,6 @@ class OrderHelper {
}
}
}
}
/**
* 获取用户的订单
*/
static
async
queryUserOrder
(
navigate
:
NavigateFunction
)
{
try
{
const
res
=
await
apis
.
common
.
queryUserOrder
();
if
(
!
res
.
ok
)
{
return
;
}
const
data
=
res
.
data
;
if
(
data
?.
lotteryOrderId
)
{
navigate
(
`/lottery?lotteryOrderId=
${
data
.
lotteryOrderId
}
`
,
{
replace
:
true
});
}
else
if
(
data
?.
orderId
)
{
navigate
(
`/orderDetail?orderId=
${
data
.
orderId
}
`
,
{
replace
:
true
});
}
}
catch
(
error
)
{
}
}
}
}
export
default
OrderHelper
;
export
default
OrderHelper
;
src/pages/Home/index.tsx
View file @
5a59fe7e
...
@@ -4,7 +4,7 @@ import {useNavigate, useSearchParams} from "react-router-dom";
...
@@ -4,7 +4,7 @@ import {useNavigate, useSearchParams} from "react-router-dom";
import
HomeBg
from
"@/pages/Home/components/HomeBg"
;
import
HomeBg
from
"@/pages/Home/components/HomeBg"
;
import
HomeContent
from
"@/pages/Home/components/HomeContent"
;
import
HomeContent
from
"@/pages/Home/components/HomeContent"
;
import
AuthUtil
from
"@/utils/auth"
;
import
AuthUtil
from
"@/utils/auth"
;
import
OrderHelper
from
"@/pages/Home/helper/order
"
;
import
apis
from
"@/apis
"
;
const
Home
:
React
.
FC
=
()
=>
{
const
Home
:
React
.
FC
=
()
=>
{
const
[
params
]
=
useSearchParams
();
const
[
params
]
=
useSearchParams
();
...
@@ -15,13 +15,27 @@ const Home: React.FC = () => {
...
@@ -15,13 +15,27 @@ const Home: React.FC = () => {
const
authenticateAndFetchOrders
=
async
()
=>
{
const
authenticateAndFetchOrders
=
async
()
=>
{
try
{
try
{
const
authResult
=
await
AuthUtil
.
auth
(
params
);
const
authResult
=
await
AuthUtil
.
auth
(
params
);
await
OrderHelper
.
queryUserOrder
(
navigate
);
const
[
res1
,
res2
]
=
await
Promise
.
all
([
await
apis
.
common
.
queryUserOrder
({
productCode
:
'4'
}),
await
apis
.
common
.
queryUserOrder
({
productCode
:
'5'
})
])
if
(
res1
.
ok
&&
res2
.
ok
)
{
// 买了普通产品
if
(
res1
.
data
.
orderId
)
{
navigate
(
`/orderDetail?orderId=
${
res1
.
data
.
orderId
}
`
,{
replace
:
true
})
}
// 买了抽奖,但是没抽 或者 抽过了
if
(
res2
.
data
.
orderId
||
res2
.
data
.
lotteryOrderId
)
{
navigate
(
`/lottery`
,{
replace
:
true
})
}
}
setIsAuthed
(
authResult
);
setIsAuthed
(
authResult
);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
};
};
authenticateAndFetchOrders
(
);
setTimeout
(
authenticateAndFetchOrders
,
400
);
},
[]);
},
[]);
return
(
return
(
...
...
src/pages/Lottery/index.tsx
View file @
5a59fe7e
...
@@ -9,7 +9,6 @@ import MyPrizeItem from "@/pages/Lottery/components/MyPrizeItem";
...
@@ -9,7 +9,6 @@ import MyPrizeItem from "@/pages/Lottery/components/MyPrizeItem";
import
{
Popup
,
Overlay
}
from
"@nutui/nutui-react"
;
import
{
Popup
,
Overlay
}
from
"@nutui/nutui-react"
;
import
{
type
SubmitDrawResponse
,
type
QueryMyPrizeListResponse
}
from
"@/apis/common"
;
import
{
type
SubmitDrawResponse
,
type
QueryMyPrizeListResponse
}
from
"@/apis/common"
;
import
{
Toast
}
from
"@nutui/nutui-react"
;
import
{
Toast
}
from
"@nutui/nutui-react"
;
import
{
useSearchParams
}
from
"react-router-dom"
;
import
apis
from
"@/apis"
;
import
apis
from
"@/apis"
;
const
LOTTERY_ACTIVE_CODE
=
"100001"
;
const
LOTTERY_ACTIVE_CODE
=
"100001"
;
...
@@ -25,7 +24,6 @@ interface LotteryConfig {
...
@@ -25,7 +24,6 @@ interface LotteryConfig {
}
}
const
Lottery
:
React
.
FC
=
()
=>
{
const
Lottery
:
React
.
FC
=
()
=>
{
const
[
params
]
=
useSearchParams
();
const
[
showMyPrizePopup
,
setShowMyPrizePopup
]
=
useState
(
false
);
const
[
showMyPrizePopup
,
setShowMyPrizePopup
]
=
useState
(
false
);
...
@@ -33,6 +31,10 @@ const Lottery: React.FC = () => {
...
@@ -33,6 +31,10 @@ const Lottery: React.FC = () => {
const
[
lotteryDrawInfo
,
setLotteryDrawInfo
]
=
useState
<
SubmitDrawResponse
>
();
const
[
lotteryDrawInfo
,
setLotteryDrawInfo
]
=
useState
<
SubmitDrawResponse
>
();
const
[
branchName
,
setBranchName
]
=
useState
(
''
);
const
[
branchCode
,
setBranchCode
]
=
useState
(
''
);
let
isLotteryed
=
false
;
let
isLotteryed
=
false
;
const
[
lotteryConfig
,
setLotteryConfig
]
=
useState
<
LotteryConfig
>
({
const
[
lotteryConfig
,
setLotteryConfig
]
=
useState
<
LotteryConfig
>
({
...
@@ -70,8 +72,8 @@ const Lottery: React.FC = () => {
...
@@ -70,8 +72,8 @@ const Lottery: React.FC = () => {
setLotteryRunningStatus
(
true
);
setLotteryRunningStatus
(
true
);
const
res
=
await
apis
.
common
.
submitDraw
({
const
res
=
await
apis
.
common
.
submitDraw
({
activityCode
:
LOTTERY_ACTIVE_CODE
,
activityCode
:
LOTTERY_ACTIVE_CODE
,
branchCode
:
params
.
get
(
"branchCode"
)
||
""
,
branchCode
:
branchCode
||
""
,
branchName
:
params
.
get
(
"branchName"
)
||
""
branchName
:
branchName
||
""
});
});
if
(
res
.
ok
)
{
if
(
res
.
ok
)
{
isLotteryed
=
true
;
isLotteryed
=
true
;
...
@@ -139,8 +141,19 @@ const Lottery: React.FC = () => {
...
@@ -139,8 +141,19 @@ const Lottery: React.FC = () => {
}
}
}
}
async
function
getOrderInfo
()
{
const
res1
=
await
apis
.
common
.
queryUserOrder
({
productCode
:
'5'
})
if
(
!
res1
.
ok
)
return
const
res2
=
await
apis
.
common
.
queryOrderInfo
(
res1
.
data
.
orderId
)
if
(
!
res2
.
ok
)
return
setBranchName
(
res2
.
data
.
orderDetail
.
branchName
)
setBranchCode
(
res2
.
data
.
orderDetail
.
branchCode
)
}
useEffect
(()
=>
{
useEffect
(()
=>
{
document
.
title
=
"抽奖活动"
;
getOrderInfo
().
then
(()
=>
{})
const
handleBackButtonEvent
=
(
e
:
PopStateEvent
)
=>
{
const
handleBackButtonEvent
=
(
e
:
PopStateEvent
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -168,9 +181,22 @@ const Lottery: React.FC = () => {
...
@@ -168,9 +181,22 @@ const Lottery: React.FC = () => {
</
div
>
</
div
>
<
img
className=
{
styles
.
lotteryRuleTitleBg
}
src=
{
lotteryRuleTitleBgImg
}
alt=
""
/>
<
img
className=
{
styles
.
lotteryRuleTitleBg
}
src=
{
lotteryRuleTitleBgImg
}
alt=
""
/>
<
div
className=
{
styles
.
lotteryRuleContent
}
>
<
div
className=
{
styles
.
lotteryRuleContent
}
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
该活动仅供掌银新客选择(线下礼品、线上微信立减金抽奖二选一),
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
活动时间:2024/1/1—2024/3/31
</
div
>
</
div
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
每季度每个客户号仅可参与其中一项。
</
div
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
活动对象:闸北掌银注册客户。欢迎掌银新客,数币新客,信用卡新客,或财富
贵宾等客户积极参与。
</
div
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
活动规则:使用农行掌银扫活动二维码进入页面,活动礼品分为实物礼品和线上
礼券两类,活动期间内每人限参与其中1类,每类限参与1次,客户支付1元即表示参
与活动,参与成功后1元将原路退回。实物礼品以网点现场礼品为准,线上礼券为微
信立减金抽奖,立减金面额有2.22元、5.55元、8.88元、10元、58.88元,线上礼券
每月限量,每月1号刷新库存,当月礼券抽完活动即止。
</
div
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
重要提示:微信立减金兑换有效期为当月月底前,使用有效期为自兑换之日起7天内
(含兑换当日),过期不予补发。
</
div
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
凡参与本活动的客户,即视为同意接受本活动相关规则,活动期间用户不得使用
不正当手段以及其他破坏活动规则、违背活动公平原则的方式参加本次活动,否则
活动方有权取消用户参与资格,收回已经领取的权益。
</
div
>
<
div
className=
{
styles
.
lotteryRuleItem
}
><
span
></
span
>
本次活动页面服务由“艾普金服(北京)科技有限公司上海分公司”提供,如有活动
相关问题请咨询客服热线010-57256207(周一至周日8:00-16:00)。
</
div
>
</
div
>
</
div
>
{
/*我的奖品*/
}
{
/*我的奖品*/
}
...
...
src/utils/auth.ts
View file @
5a59fe7e
...
@@ -5,7 +5,7 @@ class AuthUtil {
...
@@ -5,7 +5,7 @@ class AuthUtil {
static
async
auth
(
params
:
URLSearchParams
):
Promise
<
boolean
>
{
static
async
auth
(
params
:
URLSearchParams
):
Promise
<
boolean
>
{
return
await
new
Promise
((
resolve
)
=>
{
return
await
new
Promise
((
resolve
)
=>
{
if
(
process
.
env
.
REACT_APP_ENV
===
"development"
)
{
if
(
process
.
env
.
REACT_APP_ENV
===
"development"
)
{
LocalStorageUtil
.
setItem
(
"__TOKEN__"
,
"
6cbcd670a7244055b7b3366bafa68022
"
);
LocalStorageUtil
.
setItem
(
"__TOKEN__"
,
"
ada783c899924df29b3c2e7d4a75ffd4
"
);
resolve
(
true
);
resolve
(
true
);
}
else
{
}
else
{
const
token
=
LocalStorageUtil
.
getItem
(
"__TOKEN__"
);
const
token
=
LocalStorageUtil
.
getItem
(
"__TOKEN__"
);
...
...
src/utils/axios.ts
View file @
5a59fe7e
...
@@ -19,7 +19,7 @@ const responseInterceptor = (response: AxiosResponse): AxiosResponse => {
...
@@ -19,7 +19,7 @@ const responseInterceptor = (response: AxiosResponse): AxiosResponse => {
// });
// });
setTimeout
(()
=>
{
setTimeout
(()
=>
{
LocalStorageUtil
.
clear
();
LocalStorageUtil
.
clear
();
window
.
location
.
replace
(
"/"
);
//
window.location.replace("/");
},
2000
);
},
2000
);
}
}
return
response
;
return
response
;
...
...
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