Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SquareTurntable
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴江涛
SquareTurntable
Commits
9fd9d56e
Commit
9fd9d56e
authored
Jul 26, 2023
by
吴江涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加提示
parent
4c8f2116
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
9 deletions
+19
-9
SquareTurntable.jsx
src/components/SquareTurntable/SquareTurntable.jsx
+11
-2
homeDemo.jsx
src/pages/homeDemo/homeDemo.jsx
+7
-6
index.js
src/store/index.js
+1
-1
No files found.
src/components/SquareTurntable/SquareTurntable.jsx
View file @
9fd9d56e
...
...
@@ -40,7 +40,14 @@ class SquareTurntable extends React.Component {
itemSelectImg
=
""
,
updateInfoFunction
=
()
=>
{},
}
=
this
.
props
;
if
(
this
.
state
.
isClick
)
return
false
;
if
(
this
.
state
.
isClick
)
{
console
.
log
(
"已经点过啦~憋点啦!憋点啦!"
);
return
false
;
}
if
(
!!!
targetId
)
{
console
.
log
(
"我辣么大个中奖id呢!转盘罢工了"
);
return
false
;
}
this
.
setState
({
isClick
:
true
});
// 初始速度
let
_moveTime
=
moveTime
;
...
...
@@ -70,7 +77,9 @@ class SquareTurntable extends React.Component {
_beginIndex
++
;
if
(
_beginIndex
>=
len
)
_beginIndex
=
0
;
select
=
this
.
prizeRefList
[
_beginIndex
];
// console.log(JSON.parse(select.getAttribute("data-prize-id")));
if
(
!!!
select
.
getAttribute
(
"data-prize-id"
))
{
console
.
log
(
"当前元素未绑定id哦"
,
select
);
}
if
(
!!
itemSelectImg
)
{
this
.
prizeRefList
[
_beginIndex
].
lastChild
.
style
.
visibility
=
"visible"
;
}
...
...
src/pages/homeDemo/homeDemo.jsx
View file @
9fd9d56e
...
...
@@ -32,7 +32,8 @@ class HomeDemo extends React.Component {
console
.
log
(
"table"
,
this
.
table
)
const
res
=
await
API
.
doTurntableDraw
();
if
(
res
?.
success
)
{
const
result
=
await
this
.
table
.
draw
(
res
?.
data
.
prizeId
);
console
.
log
(
"prizeId"
,
res
?.
data
?.
prizeId
);
const
result
=
await
this
.
table
.
draw
(
res
?.
data
?.
prizeId
);
if
(
!!
result
)
{
console
.
log
(
"抽奖结束"
,
result
)
}
...
...
@@ -43,16 +44,16 @@ class HomeDemo extends React.Component {
return
(
/**
* ref 必须 获取对象
* drawApi 必须 抽奖接口
*
(废弃)
drawApi 必须 抽奖接口
* prizeList 必须 奖品列表
* itemSelectImg 必须 奖品选中效果 这里的元素将覆盖在奖品格子上
* renderItem 必须 定义每个格子里的内容如何布局和展示
* className 非必须 默认全屏样式
* renderBg 非必须 用于渲染背景,也可用于其他元素渲染,元素位置位于底层
* renderCenter 非必须 转盘中心位置,可用于渲染抽奖按钮或logo啥的
* updateInfoFunction 非必须 抽奖接口成功后将调用
*
(废弃)
updateInfoFunction 非必须 抽奖接口成功后将调用
* matchInitName 非必须 默认prizeId,用于初始化时往dom上挂载该命名属性的值,用于后续与接口返回的字段匹配
* matchApiName 非必须 默认prizeId, 定义读取接口返回的哪个字段名用于字段匹配
*
(废弃)
matchApiName 非必须 默认prizeId, 定义读取接口返回的哪个字段名用于字段匹配
*
* -- 转盘参数相关 --
* moveTime 非必须 默认100,每隔多少毫秒移动一个格子
...
...
src/store/index.js
View file @
9fd9d56e
...
...
@@ -8,7 +8,7 @@ const store = makeAutoObservable({
/** 前端开发配置 */
frontVariable
:
{},
/** 当前页面 */
curPage
:
PAGE_MAP
.
LOADING
_PAGE
,
curPage
:
PAGE_MAP
.
HOME
_PAGE
,
isChangePage
:
false
,
pageData
:
{},
/** 场景切换 */
...
...
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