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
a3a88714
Commit
a3a88714
authored
Sep 01, 2021
by
wanghuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:转盘优化
parent
bb63845a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
39 deletions
+59
-39
BrowserLoading.jsx
...rc/components/_tb_comps/BrowserLoading/BrowserLoading.jsx
+3
-3
GoodsList.jsx
c_client/src/components/_tb_comps/GoodsList/GoodsList.jsx
+2
-3
RotateWheel.jsx
...ient/src/components/_tb_comps/RotateWheel/RotateWheel.jsx
+12
-6
RotateWheel.module.less
.../components/_tb_comps/RotateWheel/RotateWheel.module.less
+13
-11
rotatewheel.md
c_client/src/components/_tb_comps/RotateWheel/rotatewheel.md
+8
-3
index.jsx
c_client/src/pages/index/index.jsx
+14
-5
browseGoods.jsx
c_client/src/pages/packageGood/browseGoods/browseGoods.jsx
+3
-7
myPrize.jsx
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
+4
-1
No files found.
c_client/src/components/_tb_comps/BrowserLoading/BrowserLoading.jsx
View file @
a3a88714
...
@@ -2,19 +2,19 @@ import React, { useState, useEffect } from "react";
...
@@ -2,19 +2,19 @@ import React, { useState, useEffect } from "react";
import
{
View
,
Image
,
Text
}
from
"@tarojs/components"
;
import
{
View
,
Image
,
Text
}
from
"@tarojs/components"
;
import
LoadingBar
,{
LOAD_TYPE
}
from
"../LoadingBar/LoadingBar"
;
import
LoadingBar
,{
LOAD_TYPE
}
from
"../LoadingBar/LoadingBar"
;
import
styles
from
'./BrowserLoading.module.less'
import
styles
from
'./BrowserLoading.module.less'
import
{
LOAD_OBJ
}
from
'@/pages/packageGood/browseGoods/browseGoods
'
import
{
BROWSE_COUNTDOWN_OBJ
}
from
'@/const
'
const
BrowserLoading
=
(
props
)
=>
{
const
BrowserLoading
=
(
props
)
=>
{
const
{
loadFlag
,
count
}
=
props
;
const
{
loadFlag
,
count
}
=
props
;
return
(
return
(
<
View
className=
{
styles
[
"browse_loading"
]
}
>
<
View
className=
{
styles
[
"browse_loading"
]
}
>
{
loadFlag
==
LOAD
_OBJ
.
NUMBER
&&
(
{
loadFlag
==
BROWSE_COUNTDOWN
_OBJ
.
NUMBER
&&
(
<>
<>
<
View
className=
{
styles
[
"count_img"
]
}
>
<
View
className=
{
styles
[
"count_img"
]
}
>
<
View
className=
{
styles
[
"count_time"
]
}
>
{
count
}
s
</
View
>
<
View
className=
{
styles
[
"count_time"
]
}
>
{
count
}
s
</
View
>
</
View
>
</
View
>
</>
</>
)
}
)
}
{
loadFlag
==
LOAD
_OBJ
.
PICTURE
&&
<
LoadingBar
type=
{
LOAD_TYPE
.
TASK
}
/>
}
{
loadFlag
==
BROWSE_COUNTDOWN
_OBJ
.
PICTURE
&&
<
LoadingBar
type=
{
LOAD_TYPE
.
TASK
}
/>
}
</
View
>
</
View
>
);
);
};
};
...
...
c_client/src/components/_tb_comps/GoodsList/GoodsList.jsx
View file @
a3a88714
...
@@ -5,8 +5,7 @@ import tbccTs from 'tbcc-sdk-ts'
...
@@ -5,8 +5,7 @@ import tbccTs from 'tbcc-sdk-ts'
const
{
openDetail
}
=
tbccTs
.
tb
const
{
openDetail
}
=
tbccTs
.
tb
import
styles
from
'./GoodsList.module.less'
import
styles
from
'./GoodsList.module.less'
import
BrowserLoading
from
'../BrowserLoading/BrowserLoading'
import
BrowserLoading
from
'../BrowserLoading/BrowserLoading'
import
{
LOAD_OBJ
}
from
'@/pages/packageGood/browseGoods/browseGoods'
import
{
BROWSE_COUNTDOWN_OBJ
}
from
'@/const'
function
GoodsList
(
props
)
{
function
GoodsList
(
props
)
{
const
{
const
{
...
@@ -20,7 +19,7 @@ function GoodsList(props) {
...
@@ -20,7 +19,7 @@ function GoodsList(props) {
img
:
'//yun.dui88.com/taobaomini/clientCTest/goods_img@2x.png'
img
:
'//yun.dui88.com/taobaomini/clientCTest/goods_img@2x.png'
},
},
color
:
'#181818'
,
color
:
'#181818'
,
loadFlag
:
LOAD
_OBJ
.
DEFAULT
loadFlag
:
BROWSE_COUNTDOWN
_OBJ
.
DEFAULT
},
},
onOpenDetail
,
onOpenDetail
,
onCompleteTask
,
onCompleteTask
,
...
...
c_client/src/components/_tb_comps/RotateWheel/RotateWheel.jsx
View file @
a3a88714
...
@@ -19,8 +19,10 @@ const RotateWheel = (props) => {
...
@@ -19,8 +19,10 @@ const RotateWheel = (props) => {
duration
=
5000
,
duration
=
5000
,
timeFunction
=
'ease-out'
,
timeFunction
=
'ease-out'
,
nodeInfo
=
{
width
:
100
,
height
:
100
},
nodeInfo
=
{
width
:
100
,
height
:
100
},
imgInfo
=
{
width
:
80
,
height
:
80
},
showWay
=
"negative"
,
showWay
=
"negative"
,
isShowPrizeName
=
true
,
isShowPrizeName
=
true
,
prizeNameWidthRatio
=
1.2
,
callback
=
()
=>
{}
callback
=
()
=>
{}
}
=
props
;
}
=
props
;
/* 奖品列表 */
/* 奖品列表 */
...
@@ -58,7 +60,7 @@ const RotateWheel = (props) => {
...
@@ -58,7 +60,7 @@ const RotateWheel = (props) => {
* @description 计算奖品位置,旋转角度
* @description 计算奖品位置,旋转角度
*/
*/
const
computePosition
=
()
=>
{
const
computePosition
=
()
=>
{
if
(
!
prizeList
,
length
)
return
;
if
(
!
prizeList
.
length
)
return
;
let
centerX
,
centerY
,
color
,
rotate
;
let
centerX
,
centerY
,
color
,
rotate
;
/* 获取每块奖品的中心位置 */
/* 获取每块奖品的中心位置 */
prizelist
.
forEach
((
ele
,
i
)
=>
{
prizelist
.
forEach
((
ele
,
i
)
=>
{
...
@@ -186,7 +188,7 @@ const RotateWheel = (props) => {
...
@@ -186,7 +188,7 @@ const RotateWheel = (props) => {
<
View
<
View
className=
{
styles
[
'item'
]
}
className=
{
styles
[
'item'
]
}
style=
{
{
style=
{
{
backgroundColor
:
`${ele?.color}`
,
//
backgroundColor:`$
{
ele
?.
color
}
`,
width:`
$
{
nodeInfo
.
width
/
100
}
rem
`,
width:`
$
{
nodeInfo
.
width
/
100
}
rem
`,
height:`
$
{
nodeInfo
.
height
/
100
}
rem
`,
height:`
$
{
nodeInfo
.
height
/
100
}
rem
`,
transform:`
rotate
(
$
{
ele
?.
rotate
}
deg
)
`,
transform:`
rotate
(
$
{
ele
?.
rotate
}
deg
)
`,
...
@@ -199,14 +201,18 @@ const RotateWheel = (props) => {
...
@@ -199,14 +201,18 @@ const RotateWheel = (props) => {
isShowPrizeName
&&
isShowPrizeName
&&
<
View
<
View
className=
{
styles
[
'prize_name'
]
}
className=
{
styles
[
'prize_name'
]
}
style=
{
{
width
:
'90%'
,
height
:
`${30/100}rem`
}
}
style=
{
{
>
奖品名称奖品名称
{
i
}
</
View
>
width
:
`${prizeNameWidthRatio * 100}%`
,
height
:
`${30/100}rem`
,
}
}
>
{
ele
.
name
}
</
View
>
}
}
<
View
className=
{
styles
[
'prize_img'
]
}
<
View
className=
{
styles
[
'prize_img'
]
}
style=
{
{
style=
{
{
backgroundImage
:
`url(${ele.image})`
,
backgroundImage
:
`url(${ele.image})`
,
width
:
`${
80
/100}rem`
,
width
:
`${
imgInfo.width
/100}rem`
,
height
:
`${
80
/100}rem`
height
:
`${
imgInfo.height
/100}rem`
}
}
}
}
></
View
>
></
View
>
</
View
>
</
View
>
...
...
c_client/src/components/_tb_comps/RotateWheel/RotateWheel.module.less
View file @
a3a88714
.rotate_container{
.rotate_container{
width: 100%;
width: 100%;
height: 100%;
height: 100%;
border: 1px solid cyan;
//
border: 1px solid cyan;
box-sizing: border-box;
//
box-sizing: border-box;
position: relative;
position: relative;
border-radius: 50%;
border-radius: 50%;
display: flex;
display: flex;
...
@@ -18,21 +18,23 @@
...
@@ -18,21 +18,23 @@
transform-origin: center;
transform-origin: center;
flex-direction: column;
flex-direction: column;
border: 1px solid cyan;
//
border: 1px solid cyan;
box-sizing: border-box;
//
box-sizing: border-box;
.prize_name{
.prize_name{
margin: 0 auto;
//
margin: 0 auto;
border: 1px solid cyan;
//
border: 1px solid cyan;
box-sizing: border-box;
//
box-sizing: border-box;
display: flex;
//
display: flex;
justify-content: center;
//
justify-content: center;
align-items: center;
//
align-items: center;
text-align: center;
text-align: center;
white-space: nowrap;
white-space: nowrap;
font-size: 18px;
font-size: 18px;
text-overflow: ellipsis;
overflow: hidden;
}
}
.prize_img{
.prize_img{
.image-property(cover, center center);
.image-property(cover, center center);
...
...
c_client/src/components/_tb_comps/RotateWheel/rotatewheel.md
View file @
a3a88714
...
@@ -10,11 +10,12 @@
...
@@ -10,11 +10,12 @@
| divideNum | Number | 转盘划分为几等分 | 8 | 最少2等分|
| divideNum | Number | 转盘划分为几等分 | 8 | 最少2等分|
| circles | Number | 转盘基本转动圈数 | 4 | / |
| circles | Number | 转盘基本转动圈数 | 4 | / |
| duration | Number | 转盘持续时间 | 4000 | 毫秒 |
| duration | Number | 转盘持续时间 | 4000 | 毫秒 |
| timeFunction | String | 缓动动画方式 | 'ease-out' | TODO其他类型待补充 |
| timeFunction | String | 缓动动画方式 | 'ease-out' | 'ease-in-out', cubic-bezier(xx,xx,xx,xx) |
| nodeInfo | Object | 单个奖品区域大小 | {width:100,height:100} | 宽高各100px |
| nodeInfo | Object | 单个奖品区域大小 | {width:100,height:100} | 宽高100px |
| imgInfo | Object | 奖品图片大小 | {width:80,height:80} | 宽高80px |
| showWay | String | 奖品排列方式 | 'negative' |negative逆时针排列 positive顺时针排列|
| showWay | String | 奖品排列方式 | 'negative' |negative逆时针排列 positive顺时针排列|
| isShowPrizeName | Boolean | 是否展示奖品名称 | true | true展示 false不展示 |
| isShowPrizeName | Boolean | 是否展示奖品名称 | true | true展示 false不展示 |
<!-- | showNameMaxLength | Number | 奖品名称长度展示限制 | 8 | / | -->
| prizeNameWidthRatio | Number | 奖品名称容器宽度与nodeInfo宽度的比值 | 1.2 | 超过容器宽度则...省略 |
##### 出参
##### 出参
| 配置项 | 类型 | 描述 | 默认值 | 备注 |
| 配置项 | 类型 | 描述 | 默认值 | 备注 |
...
@@ -37,6 +38,10 @@ const rotateConfig = { //不传走默认配置
...
@@ -37,6 +38,10 @@ const rotateConfig = { //不传走默认配置
width
:
100
,
width
:
100
,
height
:
100
height
:
100
},
},
imgInfo
:{
width
:
80
,
height
:
80
},
showWay
:
'negative'
,
//positive/negative
showWay
:
'negative'
,
//positive/negative
isShowPrizeName
:
true
isShowPrizeName
:
true
}
}
...
...
c_client/src/pages/index/index.jsx
View file @
a3a88714
...
@@ -40,13 +40,15 @@ const rotateConfig = {
...
@@ -40,13 +40,15 @@ const rotateConfig = {
circles
:
4
,
circles
:
4
,
divideNum
:
8
,
divideNum
:
8
,
duration
:
5000
,
duration
:
5000
,
timeFunction
:
'ease-out'
,
timeFunction
:
'ease-
in-
out'
,
nodeInfo
:{
nodeInfo
:{
width
:
100
,
width
:
100
,
height
:
100
height
:
100
},
},
imgInfo
:{
width
:
80
,
height
:
80
},
showWay
:
'negative'
,
//positive/negative
showWay
:
'negative'
,
//positive/negative
isShowPrizeName
:
true
isShowPrizeName
:
true
,
prizeNameWidthRatio
:
1.2
}
}
const
SCROLLXVIEW_CONFIG
=
{
const
SCROLLXVIEW_CONFIG
=
{
...
@@ -81,9 +83,14 @@ function Index() {
...
@@ -81,9 +83,14 @@ function Index() {
const
showHelp
=
useRef
(
false
)
const
showHelp
=
useRef
(
false
)
/* 背景音乐 */
/* 背景音乐 */
// const {playAudio,musicUrl,setOpenStatus,openStatus} = useAudio(BGMUSIC_URL.MUSIC,true
)
const
{
playAudio
,
musicUrl
,
setOpenStatus
,
openStatus
}
=
useAudio
(
CLOUD_OBJ
[
'1'
]
)
const
playCurrentAudio
=
()
=>
{
// setOpenStatus(!openStatus)
playAudio
(()
=>
{
onHandleIndex
(
'prize'
)
})
}
const
fetchActivityInfo
=
async
()
=>
{
const
fetchActivityInfo
=
async
()
=>
{
const
{
success
,
data
}
=
await
API
.
getActivityBaseInfoById
()
const
{
success
,
data
}
=
await
API
.
getActivityBaseInfoById
()
...
@@ -184,7 +191,7 @@ function Index() {
...
@@ -184,7 +191,7 @@ function Index() {
updateActInfo
&&
fetchActivityInfo
()
updateActInfo
&&
fetchActivityInfo
()
},
},
'rule'
:
()
=>
setRuleModalVisible
(
true
),
'rule'
:
()
=>
setRuleModalVisible
(
true
),
'prize'
:
()
=>
navigateTo
(
'/pages/packagePrize/myPrize/myPrize'
)
,
'prize'
:
()
=>
{
navigateTo
(
'/pages/packagePrize/myPrize/myPrize'
)}
,
'game'
:
()
=>
navigateTo
(
'/pages/packageGame/game/game'
)
'game'
:
()
=>
navigateTo
(
'/pages/packageGame/game/game'
)
}
}
Fn
[
type
]()
Fn
[
type
]()
...
@@ -219,6 +226,8 @@ function Index() {
...
@@ -219,6 +226,8 @@ function Index() {
<RotateWheel {...rotateConfig} callback={()=>{}} />
<RotateWheel {...rotateConfig} callback={()=>{}} />
</View> */
}
</View> */
}
<
View
className=
'view'
onTap=
{
playCurrentAudio
}
>
play audio
</
View
>
{
{
tasksModalVisible
&&
tasksModalVisible
&&
<
TasksModal
<
TasksModal
...
...
c_client/src/pages/packageGood/browseGoods/browseGoods.jsx
View file @
a3a88714
...
@@ -4,15 +4,11 @@ import GoodsTitle from '@/components/_tb_comps/GoodsTitle/GoodsTitle'
...
@@ -4,15 +4,11 @@ import GoodsTitle from '@/components/_tb_comps/GoodsTitle/GoodsTitle'
import
GoodsList
from
'@/components/_tb_comps/GoodsList/GoodsList'
import
GoodsList
from
'@/components/_tb_comps/GoodsList/GoodsList'
import
{
useDidShow
,
useRouter
,
useDidHide
}
from
'@tarojs/taro'
import
{
useDidShow
,
useRouter
,
useDidHide
}
from
'@tarojs/taro'
import
API
from
'@/api'
import
API
from
'@/api'
import
{
TASK_CONFIG
,
BROSE_GOOD_TYPE
}
from
'@/const'
import
{
TASK_CONFIG
,
BROSE_GOOD_TYPE
,
BROWSE_COUNTDOWN_OBJ
}
from
'@/const'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb'
import
styles
from
'./browseGoods.module.less'
import
styles
from
'./browseGoods.module.less'
export
const
LOAD_OBJ
=
{
PICTURE
:
'PICTURE'
,
NUMBER
:
"NUMBER"
,
DEFAULT
:
""
}
const
browseConfig
=
{
const
browseConfig
=
{
taskType
:
'browseGoods'
,
taskType
:
'browseGoods'
,
type
:
'01'
,
type
:
'01'
,
...
@@ -30,7 +26,7 @@ const browseConfig = {
...
@@ -30,7 +26,7 @@ const browseConfig = {
img
:
'//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
img
:
'//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
},
},
color
:
'#181818'
,
color
:
'#181818'
,
loadFlag
:
LOAD
_OBJ
.
PICTURE
loadFlag
:
BROWSE_COUNTDOWN
_OBJ
.
PICTURE
}
}
const
list
=
[
const
list
=
[
...
...
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
View file @
a3a88714
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Image
,
ScrollView
,
View
}
from
'@tarojs/components'
import
{
Image
,
ScrollView
,
View
}
from
'@tarojs/components'
import
API
from
'@/api'
import
API
from
'@/api'
import
{
DRAW_STATUS
,
PRIZE_TYPE
,
BENEFIT_TYPE
}
from
'@/const'
import
{
DRAW_STATUS
,
PRIZE_TYPE
,
BENEFIT_TYPE
,
BGMUSIC_URL
}
from
'@/const'
import
DeliveryModal
from
'@/components/_tb_modal/DeliveryModal/DeliveryModal'
import
DeliveryModal
from
'@/components/_tb_modal/DeliveryModal/DeliveryModal'
import
tbccTs
from
'tbcc-sdk-ts'
import
tbccTs
from
'tbcc-sdk-ts'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
...
@@ -14,6 +14,7 @@ import config from '@/config/index'
...
@@ -14,6 +14,7 @@ import config from '@/config/index'
const
{
commonToast
,
getUserAddress
,
navigateToOutside
,
setClipboard
}
=
tbccTs
.
tb
const
{
commonToast
,
getUserAddress
,
navigateToOutside
,
setClipboard
}
=
tbccTs
.
tb
const
{
getMyPrizeList
}
=
API
const
{
getMyPrizeList
}
=
API
import
{
useAudio
}
from
'@/hooks/useAudio'
// 我的奖品配置项
// 我的奖品配置项
const
prizeConfig
=
{
const
prizeConfig
=
{
...
@@ -60,6 +61,8 @@ function MyPrizeList() {
...
@@ -60,6 +61,8 @@ function MyPrizeList() {
const
[
memberVisible
,
setMemberVisible
]
=
useState
(
false
)
const
[
memberVisible
,
setMemberVisible
]
=
useState
(
false
)
const
[
deliveryModalVisible
,
setDeliveryModalVisible
]
=
useState
(
false
)
const
[
deliveryModalVisible
,
setDeliveryModalVisible
]
=
useState
(
false
)
// const {openStatus,setOpenStatus} = useAudio(BGMUSIC_URL.MUSIC,true)
useEffect
(()
=>
{
useEffect
(()
=>
{
fetchMyPriceList
()
fetchMyPriceList
()
},
[])
},
[])
...
...
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