Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
qinhaitao
taobao-mini-template
Commits
52d2d3a2
Commit
52d2d3a2
authored
Sep 06, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Plain Diff
标准化api
parents
2dc09458
f0c7a7aa
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
394 additions
and
374 deletions
+394
-374
Modal.jsx
c_client/src/components/_base/Modal/Modal.jsx
+0
-1
RankList.module.less
...c/components/_tb_comps/Rank/RankList/RankList.module.less
+2
-1
RotateWheel.jsx
...ient/src/components/_tb_comps/RotateWheel/RotateWheel.jsx
+0
-20
rotatewheel.md
c_client/src/components/_tb_comps/RotateWheel/rotatewheel.md
+1
-1
SwiperView.jsx
c_client/src/components/_tb_comps/SwiperView/SwiperView.jsx
+89
-85
SwiperView.less
c_client/src/components/_tb_comps/SwiperView/SwiperView.less
+77
-44
SwiperView.md
c_client/src/components/_tb_comps/SwiperView/SwiperView.md
+1
-0
JackpotModal.jsx
...nt/src/components/_tb_modal/JackpotModal/JackpotModal.jsx
+18
-12
const.js
c_client/src/const.js
+0
-55
useReceive.js
c_client/src/hooks/useReceive.js
+40
-99
mock.js
c_client/src/mock.js
+39
-2
index.jsx
c_client/src/pages/index/index.jsx
+18
-21
myPrize.jsx
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
+10
-28
preComp.jsx
c_client/src/pages/preComp/preComp.jsx
+42
-5
prize.js
c_client/src/utils/prize.js
+57
-0
No files found.
c_client/src/components/_base/Modal/Modal.jsx
View file @
52d2d3a2
...
...
@@ -3,7 +3,6 @@ import React, { useState } from 'react'
import
Overlay
from
'../Overlay/Overlay'
import
styles
from
'./modal.module.less'
import
classnames
from
'classnames'
export
default
function
Modal
(
props
)
{
const
{
closePostion
=
'top-right'
,
onClose
=
()
=>
{
},
top
=
'40%'
,
hideCloseButton
=
false
,
closeOnClickOverlay
=
false
,
closePos
=
{
right
:
0
,
top
:
-
30
}
}
=
props
...
...
c_client/src/components/_tb_comps/Rank/RankList/RankList.module.less
View file @
52d2d3a2
...
...
@@ -9,9 +9,10 @@
}
.scroll-item {
.flex-row-space();
.wh(100%,
66
px);
.wh(100%,
70
px);
background-color: #F7F0E6;
border: 1px solid #ECDBC0;
box-sizing: border-box;
}
.scroll-item__rank {
width: 33%;
...
...
c_client/src/components/_tb_comps/RotateWheel/RotateWheel.jsx
View file @
52d2d3a2
...
...
@@ -29,8 +29,6 @@ const RotateWheel = props => {
const
[
prizelist
,
setPrizelist
]
=
useState
(
prizeList
);
/* 平分角度 */
const
[
angle
,
setAngle
]
=
useState
(
oneTurn
/
divideNum
);
/* my.createAniamation */
const
[
myAnimation
,
setMyAnimation
]
=
useState
();
/* 展示奖品列表 */
const
[
show
,
setShow
]
=
useState
(
false
);
/* 转动一圈时的角度值 */
...
...
@@ -164,23 +162,6 @@ const RotateWheel = props => {
setRotateInOneTurn
(
oneturnAngle
);
};
// my.createAnimation 旋转动画rot:旋转角度,timegap:旋转时间
// const animateRotation = (rot, timegap) => {
// var animation = my.createAnimation({
// transformOrigin: "center center",
// duration: 5000,
// timeFunction: "ease-out",
// delay: 0
// })
// console.log('animation',animation);
// animation.rotate(rot).step();
// setMyAnimation(animation.export())
// setTimeout(() => {
// setMyAnimation()
// }, 5000);
// }
return
(
<
View
className=
{
styles
[
"rotate"
]
}
...
...
@@ -201,7 +182,6 @@ const RotateWheel = props => {
?
`all ${ani.option.timeFunction} ${ani.option.duration}ms`
:
""
}
}
// animation={myAnimation}
>
{
show
&&
prizelist
.
length
&&
...
...
c_client/src/components/_tb_comps/RotateWheel/rotatewheel.md
View file @
52d2d3a2
**记事本打开
**
**记事本打开
((cmd + k) + v)**
##### 大转盘配置项入参
...
...
c_client/src/components/_tb_comps/SwiperView/SwiperView.jsx
View file @
52d2d3a2
...
...
@@ -4,7 +4,6 @@ import { View, Image, Text, Swiper, SwiperItem } from "@tarojs/components";
import
'./SwiperView.less'
import
Taro
,{
showToast
,
redirectTo
,
navigateTo
}
from
'@tarojs/taro'
// import {useCallbackState} from '@/hooks/useSyncState'
export
const
EASING_WAYS
=
{
'DEFAULT'
:
'default'
,
'LINEAR'
:
'linear'
,
...
...
@@ -20,7 +19,7 @@ const SwiperView = (props) => {
const
{
swiperList
=
[],
easingFunction
=
`
${
EASING_WAYS
.
LINEAR
}
`
,
circular
=
tru
e
,
circular
=
fals
e
,
autoplay
=
false
,
vertical
=
false
,
duration
=
1000
,
...
...
@@ -34,7 +33,7 @@ const SwiperView = (props) => {
}
=
props
;
const
[
currentIndex
,
setCurrentIndex
]
=
useState
(
0
);
const
[
currentIndex
,
setCurrentIndex
]
=
useState
(
1
);
const
indexref
=
useRef
(
0
)
...
...
@@ -91,22 +90,25 @@ const SwiperView = (props) => {
const
turnRound
=
((
type
)
=>
{
const
motion
=
{
[
motionType
.
LEFT
]:()
=>
{
if
(
indexref
.
current
===
0
)
{
setCurrentIndex
(
swiperList
.
length
-
1
)
indexref
.
current
=
swiperList
.
length
-
1
return
;
setTimeout
(()
=>
{
// setCurrentIndex((indexref.current==0) ? (swiperList.length - 1) : (indexref.current - 1))
// indexref.current = (indexref.current==0) ? (swiperList.length - 1) : (indexref.current - 1)
// console.log('left----',currentIndex,indexref.current);
if
(
currentIndex
>=
1
){
setCurrentIndex
(
currentIndex
-
1
)
}
setCurrentIndex
(
indexref
.
current
-
1
)
indexref
.
current
=
indexref
.
current
-
1
console
.
log
(
'left----'
,
currentIndex
,
indexref
.
current
);
},
0
);
},
[
motionType
.
RIGHT
]:()
=>
{
setTimeout
(()
=>
{
setCurrentIndex
((
indexref
.
current
==
(
swiperList
.
length
-
1
))
?
0
:
(
indexref
.
current
+
1
))
indexref
.
current
=
(
indexref
.
current
==
(
swiperList
.
length
-
1
))
?
0
:
(
indexref
.
current
+
1
)
console
.
log
(
'right----'
,
currentIndex
,
indexref
.
current
);
// setCurrentIndex((indexref.current == (swiperList.length - 1)) ? 0 : (indexref.current + 1))
// indexref.current = (indexref.current == (swiperList.length - 1)) ? 0 : (indexref.current + 1)
// console.log('right----',currentIndex,indexref.current);
if
(
currentIndex
<
swiperList
.
length
-
1
){
setCurrentIndex
(
currentIndex
+
1
)
}
},
0
);
}
...
...
@@ -119,20 +121,21 @@ const SwiperView = (props) => {
},[
currentIndex
])
return
(
<
View
className=
"contain"
>
<
View
className=
'left_btn'
onTap=
{
()
=>
turnRound
(
'LEFT'
)
}
>
<<
</
View
>
<
View
className=
"scroll_container"
style=
{
{
width
:
`${65
0/100}rem`
,
width
:
`${70
0/100}rem`
,
overflow
:
'hidden'
}
}
>
<
View
className=
'left_btn'
onTap=
{
()
=>
turnRound
(
'LEFT'
)
}
>
<<
</
View
>
<
Swiper
className=
"swiper_group"
current=
{
currentIndex
}
easingFunction=
{
easingFunction
}
onChange=
{
swiperChange
}
onTransition=
{
(
e
)
=>
onTransition
(
e
)
}
circular=
{
circular
}
vertical=
{
vertical
}
autoplay=
{
autoplay
}
...
...
@@ -194,6 +197,7 @@ const SwiperView = (props) => {
))
}
</
Swiper
>
</
View
>
<
View
className=
'right_btn'
onTap=
{
()
=>
turnRound
(
'RIGHT'
)
}
>
>>
</
View
>
</
View
>
);
...
...
c_client/src/components/_tb_comps/SwiperView/SwiperView.less
View file @
52d2d3a2
.contain{
width: 100%;
position: relative;
}
.left_btn{
width: 80px;
height: 40px;
display: flex;
position: absolute;
justify-content: center;
align-items: center;
z-index: 1;
top: 50%;
transform: translateY(-50%);
border: 1px solid cyan;
box-sizing: border-box;
}
.right_btn{
width: 80px;
height: 40px;
display: flex;
position: absolute;
justify-content: center;
align-items: center;
z-index: 1;
top: 50%;
transform: translateY(-50%);
border: 1px solid cyan;
box-sizing: border-box;
}
.left_btn{
left: 10px;
}
.right_btn{
right: 10px;
}
.scroll_container{
// width: 450px;
// overflow: hidden;
width: 80%;
margin: 0 auto;
//
display: flex;
//
justify-content: space-around;
//
align-items: center;
display: flex;
justify-content: space-around;
align-items: center;
position: relative;
.swiper_group {
...
...
@@ -22,8 +61,8 @@
.image-property(cover, center center);
border: 1px solid cyan;
box-sizing: border-box;
//
border: 1px solid cyan;
//
box-sizing: border-box;
}
.scroll_item {
...
...
@@ -32,6 +71,10 @@
position: relative;
border-radius: 20px;
.image-property(cover, top center);
.checkPic {
width: 60px;
height: 60px;
...
...
@@ -40,15 +83,6 @@
right: 40px;
top: 40px;
}
.item_img_content {
width: 100%;
.img {
margin: 20px auto 10px;
display: block;
border-radius: 20px;
background-repeat: no-repeat;
background-position: top center;
}
.text_content{
margin: 0 auto;
box-sizing: border-box;
...
...
@@ -66,7 +100,6 @@
}
}
}
&.current_item {
.item_img_content {
...
...
@@ -76,6 +109,7 @@
}
}
}
}
// &.item_left{
// transform: translateX(-300px);
...
...
@@ -93,10 +127,9 @@
}
}
}
@keyframes movein {
from {
transform: perspective(1000px) translate3d(0,0,0) rotate3d(0, 1, 0, 25deg) scale(0.85);
...
...
c_client/src/components/_tb_comps/SwiperView/SwiperView.md
View file @
52d2d3a2
...
...
@@ -14,6 +14,7 @@
| swiperContent | Object | 单个swiperItem的宽高 |{width:250,height:300,backgroundColor:'#fff',borderRadius:25,backgroundImage:''}|/|
| imgContent | Object | 图片宽高 |{width:200,height:200}|/|
| textContent | Object | 文本宽高 |{width:300,height:60}|/|
| showLeftRightBtn | Boolean | 是否显示左右点击按钮|/|
#### swiperList数据
```
json
...
...
c_client/src/components/_tb_modal/JackpotModal/JackpotModal.jsx
View file @
52d2d3a2
...
...
@@ -10,22 +10,28 @@ import useReceive from '@/hooks/useReceive'
const
{
receiveEnamePrize
,
receiveObjectPrize
}
=
API
const
{
commonToast
}
=
tbcc
.
tb
const
JackpotModal
=
(
props
)
=>
{
const
{
onClose
,
top
=
'50%'
,
bg
=
''
,
width
=
300
,
height
=
300
,
prizesData
=
{},
receive
=
false
}
=
props
import
{
receivePrize
}
from
'@/utils/prize'
const
[
getReceive
]
=
useReceive
({
receiveEnamePrize
,
receiveObjectPrize
})
const
prizeItem
=
{
image
:
''
,
name
:
''
,
type
:
''
,
// 奖品类型
id
:
''
,
// 奖品id
_id
:
''
,
ename
:
''
,
// 会员权益
benefitType
:
''
// 会员权益
}
const
JackpotModal
=
(
props
)
=>
{
const
{
onClose
,
top
=
'50%'
,
bg
=
''
,
width
=
300
,
height
=
300
,
prizesData
=
{},
receive
=
false
,
prizeItem
=
{},
showMember
=
()
=>
{}
}
=
props
const
handleClick
=
useThrottle
(
async
()
=>
{
if
(
receive
)
{
const
prizeId
=
prizesData
.
id
||
prizesData
.
_id
const
type
=
prizesData
.
type
const
result
=
await
getReceive
({
prizeId
,
type
})
if
(
result
)
{
commonToast
(
result
.
message
)
}
}
else
{
onClose
()
const
callObj
=
{
vipCallback
:()
=>
{
showMember
()},
updateCallback
:()
=>
{},
closeCallback
:()
=>
{
onClose
()}
}
receivePrize
(
prizeItem
,
callObj
);
})
return
(
...
...
c_client/src/const.js
View file @
52d2d3a2
...
...
@@ -25,62 +25,7 @@ export const CLOUD_OBJ = {
'3'
:
'cloud://B8F0BA22BBA74F8FEA261E1CC9D55355/欢呼声.mp3'
}
/* 测试数据mock */
export
const
prizeList
=
[
{
image
:
"https://yun.duiba.com.cn/spark/assets/240121a7e7e10a66ad0cfa99a8b3ba9631fc7855.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述1'
,
content
:
'商品描述商品描述商品描述商品描述商品描述1'
,
hasBtn
:
true
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/f9160b053f525455503ea58ae6b43bacea400362.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述2'
,
content
:
'商品描述商品描述商品描述商品描述商品描述2'
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/28b868b5da81ebd28a4eb14291a8ac287937221c.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述3'
,
content
:
'商品描述商品描述商品描述商品描述商品描述3'
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/3c305fb907bbebb85ad392cb959fbe62200c407f.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述4'
,
content
:
'商品描述商品描述商品描述商品描述商品描述4'
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/28b868b5da81ebd28a4eb14291a8ac287937221c.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述5'
,
content
:
'商品描述商品描述商品描述商品描述商品描述5'
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/3c305fb907bbebb85ad392cb959fbe62200c407f.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述6'
,
content
:
'商品描述商品描述商品描述商品描述商品描述6'
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/554a90eee5a31ae7628950907974bdee2da8c01e.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述7'
,
content
:
'商品描述商品描述商品描述商品描述商品描述7'
},
{
image
:
"https://yun.duiba.com.cn/spark/assets/554a90eee5a31ae7628950907974bdee2da8c01e.png"
,
name
:
'商品描述商品描述商品描述商品描述商品描述8'
,
content
:
'商品描述商品描述商品描述商品描述商品描述8'
}
];
/*
浏览页倒计时标识
...
...
c_client/src/hooks/useReceive.js
View file @
52d2d3a2
import
{
useCallback
}
from
'react'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
tbccTs
from
'tbcc-sdk-ts'
import
{
PRIZE_TYPE
}
from
'@/const'
const
{
getUserAddress
}
=
tbccTs
.
tb
import
API
from
'@/api'
import
{
receiveEnamePrize
,
receiveMemberEname
,
receiveObjectPrize
}
from
'tbcc-sdk-ts/lib/request/capiFn'
import
{
PRIZE_TYPE
,
BENEFIT_TYPE
}
from
'@/config/myPrize.config'
const
useReceive
=
(
config
)
=>
{
const
{
receiveEnamePrize
=
()
=>
{
},
receiveObjectPrize
=
()
=>
{
}
}
=
config
// 积分
const
handleGetCredits
=
useCallback
(
async
(
id
)
=>
{
// 判断是否为会员
const
receivePrize
=
async
(
item
,
callbackObj
=
{
vipCallback
:()
=>
{},
updateCallback
:()
=>
{},
closeCallback
:()
=>
{}})
=>
{
const
app
=
getApp
();
const
{
activityId
}
=
app
const
{
type
,
id
,
ename
=
''
,
benefitType
}
=
item
const
successMsg
=
'领取成功'
const
errorMsg
=
'请求失败'
if
(
type
===
PRIZE_TYPE
.
CREDITS
||
(
type
===
PRIZE_TYPE
.
ENAME
&&
benefitType
===
BENEFIT_TYPE
.
MEMBER
))
{
const
isVip
=
await
checkIsMember
()
console
.
log
(
isVip
)
if
(
!
isVip
)
{
return
{
message
:
'需加入会员才能领取成功哦'
,
state
:
'error'
}
if
(
!
isVip
)
{
commonToast
(
'需加入会员才能领取成功哦'
,
2000
,
()
=>
{
callbackObj
.
vipCallback
&&
callbackObj
.
vipCallback
()})
return
;
}
const
{
success
,
data
}
=
await
receiveEnamePrize
({
id
})
if
(
success
&&
data
)
{
return
{
message
:
'领取成功'
,
state
:
'success'
}
const
receiveFn
=
{
// 'update': async () => fetchMyPriceList(),
[
PRIZE_TYPE
.
ENAME
]:
async
()
=>
{
if
(
benefitType
===
BENEFIT_TYPE
.
MEMBER
)
{
await
receiveMemberEname
(
API
.
receiveMemberEname
,{
params
:
{
sellerId
:
config
.
sellerId
,
ename
,
id
},
successMsg
,
errorMsg
})
}
else
{
await
receiveEnamePrize
(
API
.
receiveEnamePrize
,
{
params
:
{
activityId
,
id
},
successMsg
,
errorMsg
})
}
},
[
checkIsMember
,
receiveEnamePrize
])
// 优惠券
const
handleGetEquity
=
useCallback
(
async
(
id
)
=>
{
const
{
success
,
data
}
=
await
receiveEnamePrize
({
id
})
if
(
success
&&
data
)
{
return
{
message
:
'领取成功'
,
state
:
'领取成功'
},
[
PRIZE_TYPE
.
OBJECT
]:
async
()
=>
{
await
receiveObjectPrize
(
API
.
receiveObjectPrize
,
{
params
:
{
activityId
,
id
},
successMsg
,
errorMsg
})
},
[
PRIZE_TYPE
.
CREDITS
]:
async
()
=>
{
await
receiveEnamePrize
(
API
.
receiveEnamePrize
,
{
params
:
{
activityId
,
id
},
successMsg
,
errorMsg
})
}
}
},
[
receiveEnamePrize
])
await
receiveFn
[
type
]()
// 更新奖品列表
callbackObj
.
updateCallback
&&
callbackObj
.
updateCallback
();
// 实物
const
handleReceiveObjectPrize
=
useCallback
(
async
(
params
)
=>
{
let
errorMessage
=
''
const
{
success
,
data
}
=
await
receiveObjectPrize
(
params
).
catch
(
res
=>
{
errorMessage
=
res
&&
res
.
message
})
||
{}
if
(
success
&&
data
)
{
return
{
message
:
'领取成功'
,
state
:
'success'
callbackObj
.
closeCallback
&&
callbackObj
.
closeCallback
();
}
}
else
{
return
{
message
:
errorMessage
,
state
:
'error'
}
}
},
[
receiveObjectPrize
])
// 确认地址
const
handleChooseAddress
=
useCallback
(
async
(
id
)
=>
{
let
errorMessage
=
''
const
userAddress
=
await
getUserAddress
().
catch
(
err
=>
{
errorMessage
=
err
&&
err
.
errorMessage
})
if
(
!
userAddress
)
{
return
{
message
:
errorMessage
,
state
:
'error'
}
receivePrize
}
const
{
name
,
telNumber
,
provinceName
,
cityName
,
cityCode
,
countyName
,
detailInfo
,
streetName
}
=
userAddress
||
{}
const
params
=
{
name
,
phone
:
telNumber
,
addressDetail
:
detailInfo
,
cityCode
,
city
:
cityName
,
province
:
provinceName
,
area
:
countyName
,
streetName
,
id
}
const
result
=
await
my
.
confirm
({
title
:
'提示'
,
content
:
'确认使用该收货地址:'
+
name
+
telNumber
+
userAddress
.
duibaAddress
.
address
,
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
})
if
(
result
.
confirm
)
{
return
await
handleReceiveObjectPrize
(
params
)
}
},
[
getUserAddress
])
// 导出的方法
const
exportFn
=
useCallback
(
async
({
type
,
prizeId
})
=>
{
// 领取优惠券
if
(
type
===
PRIZE_TYPE
.
ENAME
)
return
await
handleGetEquity
(
prizeId
)
// 领取实物
if
(
type
===
PRIZE_TYPE
.
OBJECT
)
return
await
handleChooseAddress
(
prizeId
)
// 领取积分
if
(
type
===
PRIZE_TYPE
.
CREDITS
)
return
await
handleGetCredits
(
prizeId
)
},
[
handleGetEquity
,
handleChooseAddress
,
handleGetCredits
])
return
[
exportFn
]
}
export
default
useReceive
c_client/src/mock.js
View file @
52d2d3a2
...
...
@@ -87,7 +87,7 @@ export const TASK_DATA = [
export
const
RANK_LIST
=
[
{
rank
:
1
,
userNick
:
'用户昵称'
,
userNick
:
'用户昵称
用户昵称用户昵称
'
,
hotValue
:
98882892
},
{
...
...
@@ -119,6 +119,31 @@ export const RANK_LIST = [
rank
:
7
,
userNick
:
'用户昵称'
,
hotValue
:
98882892
},
{
rank
:
8
,
userNick
:
'用户昵称'
,
hotValue
:
98882892
},
{
rank
:
9
,
userNick
:
'用户昵称'
,
hotValue
:
98882892
},
{
rank
:
10
,
userNick
:
'用户昵称'
,
hotValue
:
98882892
},
{
rank
:
11
,
userNick
:
'用户昵称'
,
hotValue
:
98882892
},
{
rank
:
12
,
userNick
:
'用户昵称'
,
hotValue
:
98882892
}
]
...
...
@@ -345,3 +370,15 @@ export const prizeList = [
}
];
export
const
BARRAGE_LIST
=
[
'111'
,
'222'
,
'333'
,
'444'
,
'555'
,
'666'
,
'777'
,
'888'
,
'999'
]
\ No newline at end of file
c_client/src/pages/index/index.jsx
View file @
52d2d3a2
...
...
@@ -2,7 +2,7 @@ import React, { useRef, useState } from 'react'
import
{
View
,
Image
}
from
'@tarojs/components'
import
Taro
,
{
useShareAppMessage
,
useDidShow
,
getApp
}
from
'@tarojs/taro'
import
classnames
from
'classnames'
import
{
SHARE_CONFIG
}
from
'@/const.js'
import
{
ACTIVITY_STATUS
,
SHARE_CONFIG
}
from
'@/const.js'
import
{
HELP_MODAL_TYPE
}
from
'@/config/help.config'
import
{
useLogin
,
useLoginFromShare
}
from
'@/hooks/useLogin'
import
{
useActivityInfoModel
,
useLoginInfoModel
}
from
'@/store'
...
...
@@ -11,6 +11,7 @@ import RuleModal from '@/components/_tb_modal/RuleModal/RuleModal'
import
DoHelpModal
from
'@/components/_tb_modal/DoHelpModal/DoHelpModal'
import
TasksModal
from
'@/components/_tb_modal/TasksModal/TasksModal'
import
CountDown
from
'@/components/_tb_comps/CountDown'
import
JackpotModal
from
'@/components/_tb_modal/JackpotModal'
import
styles
from
'./index.module.less'
import
tbcc
from
'tbcc-sdk-ts'
import
{
useEffect
}
from
'react'
...
...
@@ -46,16 +47,6 @@ function Index() {
// 助力弹窗标识
const
showHelp
=
useRef
(
false
)
/* 背景音乐 */
const
{
playAudio
,
musicUrl
,
setOpenStatus
,
openStatus
}
=
useAudio
(
BGMUSIC_URL
.
MUSIC
,
true
)
const
playCurrentAudio
=
()
=>
{
setOpenStatus
(
!
openStatus
)
// playAudio(()=>{
// onHandleIndex('prize')
// })
}
const
fetchActivityInfo
=
async
()
=>
{
const
{
success
,
data
}
=
await
API
.
getActivityBaseInfoById
()
if
(
success
)
{
...
...
@@ -71,7 +62,7 @@ function Index() {
success
&&
setUserInfo
(
data
)
}
useEffect
(()
=>
{
//
fetchActivityInfo()
fetchActivityInfo
()
// getImgShareUrl('cloud://CEFE74AE67921906B5AF842150646D35/share.png').then(url => {
// SHARE_IMG.current = url
// })
...
...
@@ -157,18 +148,24 @@ function Index() {
<
View
className=
{
styles
.
bemember
}
onTap=
{
()
=>
setMemberVisible
(
true
)
}
>
入会
</
View
>
{
/* 奖品查看左右滑动 */
}
{
/* <ScrollXView {...SCROLLXVIEW_CONFIG} prizeList={prizeList} /> */
}
<
View
className=
{
styles
[
'prize_modal_btn'
]
}
onTap=
{
()
=>
setPrizeModalVisible
(
true
)
}
>
中奖弹窗
</
View
>
{
/* swiper左右滑动 */
}
<
View
className=
'view'
onTap=
{
playCurrentAudio
}
>
play audio
</
View
>
{
/* <SwiperView swiperList={prizeList} /> */
}
{
/* 大转盘 */
}
{
/* <RotateWheel {...rotateConfig} callback={()=>{}} /> */
}
{
/* 中奖弹窗 */
}
{
false
&&
<
JackpotModal
closePostion=
'bottom'
bg=
''
width=
'500'
height=
'500'
top=
'45%'
prizeItem=
{
prizeItem
}
showMember=
{
()
=>
setMemberVisible
(
true
)
}
onClose=
{
()
=>
setPrizeModalVisible
(
false
)
}
/>
}
{
tasksModalVisible
&&
...
...
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
View file @
52d2d3a2
...
...
@@ -12,6 +12,7 @@ import styles from './myPrize.module.less'
import
{
useDidHide
,
getApp
}
from
'@tarojs/taro'
import
{
receiveEnamePrize
,
receiveObjectPrize
,
receiveMemberEname
}
from
'tbcc-sdk-ts/lib/request/capiFn'
import
config
from
'@/config/config'
import
{
receivePrize
}
from
'@/utils/prize'
import
{
PRIZE_CONFIG
,
DRAW_STATUS
,
PRIZE_TYPE
,
BENEFIT_TYPE
}
from
'@/config/myPrize.config'
const
{
objectStatus
:
_objectStatus
,
enameStatus
:
_enameStatus
,
orderStatus
,
commonStatus
}
=
PRIZE_CONFIG
...
...
@@ -19,7 +20,6 @@ const objectStatus = { ..._objectStatus, ...commonStatus }
const
enameStatus
=
{
...
_enameStatus
,
...
commonStatus
}
const
{
commonToast
,
navigateToOutside
,
setClipboard
}
=
tbccTs
.
tb
import
{
useAudio
}
from
'@/hooks/useAudio'
function
Empty
(
blankTxt
)
{
return
<
View
className=
{
styles
[
'my-prize-item__empty'
]
}
>
{
blankTxt
}
</
View
>
...
...
@@ -33,8 +33,6 @@ function MyPrizeList() {
const
[
memberVisible
,
setMemberVisible
]
=
useState
(
false
)
const
[
deliveryModalVisible
,
setDeliveryModalVisible
]
=
useState
(
false
)
// const {openStatus,setOpenStatus} = useAudio(BGMUSIC_URL.MUSIC,true)
useEffect
(()
=>
{
fetchMyPriceList
()
},
[])
...
...
@@ -73,32 +71,16 @@ function MyPrizeList() {
return
}
// 执行奖品领取
const
successMsg
=
'领取成功'
if
(
type
===
PRIZE_TYPE
.
CREDITS
||
(
type
===
PRIZE_TYPE
.
ENAME
&&
benefitType
===
BENEFIT_TYPE
.
MEMBER
))
{
const
isVip
=
await
checkIsMember
()
if
(
!
isVip
)
{
commonToast
(
'需加入会员才能领取成功哦'
,
2000
,
()
=>
{
setMemberVisible
(
true
)
})
return
;
}
}
const
receiveFn
=
{
'update'
:
async
()
=>
fetchMyPriceList
(),
[
PRIZE_TYPE
.
ENAME
]:
async
()
=>
{
if
(
benefitType
===
BENEFIT_TYPE
.
MEMBER
)
{
await
receiveMemberEname
(
API
.
updateEnamePrizeReceived
,{
params
:
{
sellerId
:
config
.
sellerId
,
ename
,
id
},
successMsg
})
}
else
{
await
receiveEnamePrize
(
API
.
receiveEnamePrize
,{
params
:
{
activityId
,
id
},
successMsg
})
}
receivePrize
(
item
,{
vipCallback
:()
=>
{
console
.
log
(
'enter the vip callback function'
);
setMemberVisible
(
true
)
},
[
PRIZE_TYPE
.
OBJECT
]:
async
()
=>
{
await
receiveObjectPrize
(
API
.
receiveObjectPrize
,{
params
:
{
activityId
,
id
},
successMsg
})
},
[
PRIZE_TYPE
.
CREDITS
]:
async
()
=>
{
await
receiveEnamePrize
(
API
.
receiveEnamePrize
,{
params
:
{
activityId
,
id
},
successMsg
})
}
updateCallback
:()
=>
{
console
.
log
(
'enter the update list callback function'
);
fetchMyPriceList
()
}
await
receiveFn
[
type
]()
receiveFn
[
'update'
]()
});
},
2000
)
// 入会插件
const
onClose
=
()
=>
{
...
...
@@ -158,7 +140,7 @@ function MyPrizeList() {
</
View
>
</
ContainerFit
>
{
deliveryModalVisible
&&
<
DeliveryModal
prizeItem=
{
currentPrize
}
task=
{
PRIZE_CONFIG
.
logisticsImage
}
onClose=
{
()
=>
setDeliveryModalVisible
(
false
)
}
/>
}
{
memberVisible
&&
<
member
-
modal
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
{
<
member
-
modal
expend=
{
memberVisible
}
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
</>
)
}
...
...
c_client/src/pages/preComp/preComp.jsx
View file @
52d2d3a2
...
...
@@ -4,7 +4,7 @@ import { useDidShow, useRouter, useDidHide, getApp } from '@tarojs/taro'
import
API
from
'@/api'
import
{
useLogin
,
useLoginFromShare
}
from
'@/hooks/useLogin'
import
{
useActivityInfoModel
,
useLoginInfoModel
}
from
'@/store'
import
{
prizeList
}
from
'@/mock'
import
{
prizeList
,
BARRAGE_LIST
}
from
'@/mock'
import
styles
from
'./preComp.module.less'
...
...
@@ -24,6 +24,17 @@ import RankTitle from '@/components/_tb_comps/Rank/RankTitle/RankTitle'
import
RankList
from
'@/components/_tb_comps/Rank/RankList/RankList'
import
Demo
from
'@/components/_tb_comps/_Progress/demo'
import
Countdown
from
'@/components/_tb_comps/CountDown/CountDown'
// import Demo from '@/components/_tb_comps/Rank/demo/index'
import
JackpotModal
from
'@/components/_tb_modal/JackpotModal'
import
{
VerticalBarrage
}
from
'@/components/_tb_comps/Barrage'
const
rotateConfig
=
{
bg
:
'https://yun.duiba.com.cn/spark/assets/8b6e920ffd09fab8f9ac2de09f9154879f4d0607.png'
,
...
...
@@ -70,19 +81,45 @@ const swiper_config = {
textContent
:{
width
:
300
,
height
:
60
}
}
export
default
function
PreComp
(
props
)
{
/* 背景音乐 */
const
{
playAudio
,
musicUrl
,
setOpenStatus
,
openStatus
}
=
useAudio
(
BGMUSIC_URL
.
MUSIC
,
true
)
const
playCurrentAudio
=
()
=>
{
setOpenStatus
(
!
openStatus
)
}
return
(
<
ContainerFit
hasFitPsd=
{
true
}
>
<
View
className=
{
styles
[
'scroll-view'
]
}
>
<
ScrollXView
prizeList=
{
prizeList
}
/>
{
/* <ScrollXView prizeList={prizeList} /> */
}
</
View
>
<
View
className=
{
styles
[
'comp-view'
]
}
>
{
/* 大转盘 */
}
{
/* <RotateWheel /> */
}
</
View
>
<
View
className=
{
styles
[
'comp-view'
]
}
>
{
/* swiper左右滑动 */
}
<
SwiperView
swiperList=
{
prizeList
}
/>
</
View
>
<
View
className=
{
styles
[
'comp-view'
]
}
>
{
/* 大转盘 */
}
<
RotateWheel
/>
{
/* 排行榜 进度条 */
}
{
/* <Demo /> */
}
{
/* 倒计时 */
}
<
View
className=
{
styles
[
'view'
]
}
style=
{
{
marginTop
:
`${300/100}rem`
}
}
>
{
/* <Countdown targetTime="2021-10-01 10:00:00" /> */
}
<
View
className=
{
styles
[
'view'
]
}
onTap=
{
playCurrentAudio
}
>
play audio
</
View
>
</
View
>
{
/* 竖向弹幕 */
}
{
/* <VerticalBarrage dataList={BARRAGE_LIST} /> */
}
</
ContainerFit
>
)
}
\ No newline at end of file
c_client/src/utils/prize.js
0 → 100644
View file @
52d2d3a2
import
{
PRIZE_CONFIG
,
DRAW_STATUS
,
PRIZE_TYPE
,
BENEFIT_TYPE
}
from
'@/config/myPrize.config'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
config
from
'@/config/config'
import
{
receiveEnamePrize
,
receiveObjectPrize
,
receiveMemberEname
}
from
'@/utils/util'
import
tbccTs
from
'tbcc-sdk-ts'
const
{
commonToast
,
navigateToOutside
,
setClipboard
}
=
tbccTs
.
tb
/**
* @description 领取奖品
* @param {*} item
* @param {*} vipCallback 入会回调
* @param {*} updateCallback 奖品页面更新列表回调
*
*/
import
{
getApp
,
setTabBarBadge
}
from
'@tarojs/taro'
export
const
receivePrize
=
async
(
item
,
callbackObj
=
{
vipCallback
:()
=>
{},
updateCallback
:()
=>
{},
closeCallback
:()
=>
{}})
=>
{
const
app
=
getApp
();
const
{
activityId
}
=
app
const
{
type
,
drawStatus
,
useUrl
=
''
,
id
,
_id
,
ename
=
''
,
benefitType
}
=
item
const
successMsg
=
'领取成功'
const
errorMsg
=
'请求失败'
if
(
type
===
PRIZE_TYPE
.
CREDITS
||
(
type
===
PRIZE_TYPE
.
ENAME
&&
benefitType
===
BENEFIT_TYPE
.
MEMBER
))
{
const
isVip
=
await
checkIsMember
()
if
(
!
isVip
)
{
commonToast
(
'需加入会员才能领取成功哦'
,
2000
,
()
=>
{
callbackObj
.
vipCallback
&&
callbackObj
.
vipCallback
()})
return
;
}
}
const
receiveFn
=
{
// 'update': async () => fetchMyPriceList(),
[
PRIZE_TYPE
.
ENAME
]:
async
()
=>
{
if
(
benefitType
===
BENEFIT_TYPE
.
MEMBER
)
{
await
receiveMemberEname
({
params
:
{
sellerId
:
config
.
sellerId
,
ename
,
id
},
successMsg
,
errorMsg
})
}
else
{
await
receiveEnamePrize
({
params
:
{
activityId
,
id
},
successMsg
,
errorMsg
})
}
},
[
PRIZE_TYPE
.
OBJECT
]:
async
()
=>
{
await
receiveObjectPrize
({
params
:
{
activityId
,
id
},
successMsg
,
errorMsg
})
},
[
PRIZE_TYPE
.
CREDITS
]:
async
()
=>
{
await
receiveEnamePrize
({
params
:
{
activityId
,
id
},
successMsg
,
errorMsg
})
}
}
await
receiveFn
[
type
]()
// 更新奖品列表
callbackObj
.
updateCallback
&&
callbackObj
.
updateCallback
();
callbackObj
.
closeCallback
&&
callbackObj
.
closeCallback
();
}
\ No newline at end of file
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