Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
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
frontend
GeekLearnMathWeapp
Commits
d2c8d408
Commit
d2c8d408
authored
Apr 23, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 兑换礼物优化
parent
51cf0600
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
exchange-item.tsx
src/pages/market/components/exchange-item.tsx
+7
-5
index.tsx
src/pages/market/index.tsx
+8
-2
No files found.
src/pages/market/components/exchange-item.tsx
View file @
d2c8d408
...
@@ -36,17 +36,19 @@ const ExchangeItem = (props: ExchangeItemProps) => {
...
@@ -36,17 +36,19 @@ const ExchangeItem = (props: ExchangeItemProps) => {
},
[
val
])
},
[
val
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
visible
)
{
if
(
visible
)
{
setTimeout
(()
=>
{
if
(
maxValue
>
stepValue
)
{
setVal
(
1
)
setVal
(
1
)
},
1000
)
}
else
{
setVal
(
0
)
}
}
}
},
[
visible
])
},
[
visible
,
stepValue
,
maxValue
])
const
handleAdd
=
useCallback
(()
=>
{
const
handleAdd
=
useCallback
(()
=>
{
const
next
=
val
+
1
const
next
=
val
+
1
if
(
next
*
stepValue
>
maxValue
)
{
if
(
next
*
stepValue
>
maxValue
)
{
return
showToast
({
title
:
'
学分
不足~'
,
icon
:
'none'
})
return
showToast
({
title
:
'
水晶
不足~'
,
icon
:
'none'
})
}
}
setVal
(
next
)
setVal
(
next
)
},
[
val
,
stepValue
,
maxValue
])
},
[
val
,
stepValue
,
maxValue
])
...
...
src/pages/market/index.tsx
View file @
d2c8d408
...
@@ -21,6 +21,7 @@ import styles from './index.module.scss'
...
@@ -21,6 +21,7 @@ import styles from './index.module.scss'
type
ExchangeGoods
=
{
type
ExchangeGoods
=
{
title
?:
string
;
title
?:
string
;
subTitle
:
string
;
subTitle
:
string
;
isUpComing
?:
boolean
;
description
:
string
;
description
:
string
;
price
:
number
;
price
:
number
;
isGuideCard
?:
boolean
;
isGuideCard
?:
boolean
;
...
@@ -36,6 +37,7 @@ const itemList: ExchangeGoods[] = [
...
@@ -36,6 +37,7 @@ const itemList: ExchangeGoods[] = [
price
:
600
,
price
:
600
,
isGuideCard
:
true
,
isGuideCard
:
true
,
stock
:
null
,
stock
:
null
,
isUpComing
:
true
,
img
:
assets
[
'item-1.png'
].
u
,
img
:
assets
[
'item-1.png'
].
u
,
},
},
{
{
...
@@ -43,6 +45,7 @@ const itemList: ExchangeGoods[] = [
...
@@ -43,6 +45,7 @@ const itemList: ExchangeGoods[] = [
description
:
'让元气满满的向日葵,陪伴你一起向阳而生吧。'
,
description
:
'让元气满满的向日葵,陪伴你一起向阳而生吧。'
,
price
:
600
,
price
:
600
,
stock
:
null
,
stock
:
null
,
isUpComing
:
true
,
img
:
assets
[
'item-2.png'
].
u
,
img
:
assets
[
'item-2.png'
].
u
,
},
},
{
{
...
@@ -50,6 +53,7 @@ const itemList: ExchangeGoods[] = [
...
@@ -50,6 +53,7 @@ const itemList: ExchangeGoods[] = [
description
:
'播下种子,浇水施肥,收获属于你的酸甜小小西红柿。'
,
description
:
'播下种子,浇水施肥,收获属于你的酸甜小小西红柿。'
,
price
:
600
,
price
:
600
,
stock
:
null
,
stock
:
null
,
isUpComing
:
true
,
img
:
assets
[
'item-3.png'
].
u
,
img
:
assets
[
'item-3.png'
].
u
,
},
},
{
{
...
@@ -57,6 +61,7 @@ const itemList: ExchangeGoods[] = [
...
@@ -57,6 +61,7 @@ const itemList: ExchangeGoods[] = [
description
:
'用心拼一朵玫瑰,送给为你辛苦的妈妈。'
,
description
:
'用心拼一朵玫瑰,送给为你辛苦的妈妈。'
,
price
:
700
,
price
:
700
,
stock
:
null
,
stock
:
null
,
isUpComing
:
true
,
img
:
assets
[
'item-4.png'
].
u
,
img
:
assets
[
'item-4.png'
].
u
,
},
},
{
{
...
@@ -64,6 +69,7 @@ const itemList: ExchangeGoods[] = [
...
@@ -64,6 +69,7 @@ const itemList: ExchangeGoods[] = [
description
:
'自带颜料的创意绘画本,让你随地作画,随时随地开启小画家模式。'
,
description
:
'自带颜料的创意绘画本,让你随地作画,随时随地开启小画家模式。'
,
price
:
700
,
price
:
700
,
stock
:
null
,
stock
:
null
,
isUpComing
:
true
,
img
:
assets
[
'item-5.png'
].
u
,
img
:
assets
[
'item-5.png'
].
u
,
},
},
]
]
...
@@ -137,7 +143,7 @@ const StudyMarket = () => {
...
@@ -137,7 +143,7 @@ const StudyMarket = () => {
const
pric
=
item
.
price
const
pric
=
item
.
price
let
disabledText
=
'积分不足'
let
disabledText
=
'积分不足'
let
disabled
=
point
<
pric
||
(
item
.
stock
!==
null
&&
item
.
stock
<
1
)
let
disabled
=
point
<
pric
||
(
item
.
stock
!==
null
&&
item
.
stock
<
1
)
if
(
item
.
subTitle
===
'神秘大礼'
)
{
if
(
item
.
isUpComing
)
{
disabled
=
true
disabled
=
true
if
(
point
>=
pric
)
{
if
(
point
>=
pric
)
{
disabledText
=
'敬请期待'
disabledText
=
'敬请期待'
...
@@ -171,7 +177,7 @@ const StudyMarket = () => {
...
@@ -171,7 +177,7 @@ const StudyMarket = () => {
cover=
{
item
.
img
}
cover=
{
item
.
img
}
stock=
{
item
.
stock
}
stock=
{
item
.
stock
}
price=
{
pric
}
price=
{
pric
}
disabled=
{
disabled
}
disabled=
{
!
storeGuideActive
&&
disabled
}
subtitle=
{
item
.
description
}
subtitle=
{
item
.
description
}
disabledText=
{
disabledText
}
disabledText=
{
disabledText
}
isGuideActive=
{
isMaskActive
&&
storeGuideStep
===
2
&&
index
===
0
}
isGuideActive=
{
isMaskActive
&&
storeGuideStep
===
2
&&
index
===
0
}
...
...
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