Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
activities
/
web-lottery
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9cc50a83
authored
Nov 14, 2023
by
Lays-lzq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修复大转盘列表异常洗牌问题
parent
52d2fb63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
11 deletions
+25
-11
components/Lottery/Instant/Main.vue
+22
-8
store/lottery.js
+3
-3
No files found.
components/Lottery/Instant/Main.vue
View file @
9cc50a83
...
...
@@ -214,7 +214,8 @@ export default {
id
:
0
,
// 中奖等级
name
:
'谢谢参与'
// 中奖等级
},
// 中奖信息
randomType
:
Math
.
floor
(
Math
.
random
()
*
(
2
-
1
+
1
))
+
1
// 部分抽奖类型随机进1或2
randomType
:
Math
.
floor
(
Math
.
random
()
*
(
2
-
1
+
1
))
+
1
,
// 部分抽奖类型随机进1或2
formattedPrizeList
:
[]
}
},
computed
:
{
...
...
@@ -228,13 +229,8 @@ export default {
prizeList
()
{
return
this
.
lotteryInfo
.
prizeConfigs
},
formattedPrizeList
()
{
const
prizeLen
=
this
.
lotteryInfo
?.
prizeConfigs
?.
length
||
0
if
(
prizeLen
>=
6
&&
prizeLen
%
2
===
0
)
{
const
freePrizes
=
new
Array
(
2
).
fill
({
id
:
0
,
name
:
'谢谢参与'
})
return
[...
this
.
lotteryInfo
.
prizeConfigs
,
...
freePrizes
]
}
return
this
.
lotteryInfo
.
prizeConfigs
prizeLen
()
{
return
this
.
prizeList
.
length
},
isNotStart
()
{
// 抽奖不在活动日期内
...
...
@@ -251,7 +247,25 @@ export default {
return
''
},
},
watch
:
{
prizeLen
(
nVal
,
oVal
)
{
if
(
nVal
===
oVal
)
{
return
}
if
(
this
.
nVal
>=
6
&&
this
.
nVal
%
2
===
0
)
{
const
freePrizes
=
new
Array
(
2
).
fill
({
id
:
0
,
name
:
'谢谢参与'
})
this
.
formattedPrizeList
=
[...
this
.
lotteryInfo
.
prizeConfigs
,
...
freePrizes
]
}
this
.
formattedPrizeList
=
this
.
lotteryInfo
.
prizeConfigs
}
},
mounted
()
{
if
(
this
.
prizeLen
>=
6
&&
this
.
prizeLen
%
2
===
0
)
{
const
freePrizes
=
new
Array
(
2
).
fill
({
id
:
0
,
name
:
'谢谢参与'
})
this
.
formattedPrizeList
=
[...
this
.
lotteryInfo
.
prizeConfigs
,
...
freePrizes
]
}
else
{
this
.
formattedPrizeList
=
this
.
lotteryInfo
.
prizeConfigs
}
// this.lotteryInfo.showType = 4
Bus
.
$on
(
'updateMain'
,
data
=>
{
for
(
const
[
key
,
value
]
of
Object
.
entries
(
data
))
{
...
...
store/lottery.js
View file @
9cc50a83
...
...
@@ -30,7 +30,7 @@ export const mutations = {
},
SET_ISSHOWBIND
:
(
state
,
isShow
)
=>
{
state
.
isShowBind
=
isShow
}
}
,
}
export
const
actions
=
{
...
...
@@ -70,9 +70,9 @@ export const actions = {
}
})
},
updateInfo
({
state
},
val
)
{
updateInfo
({
commit
,
state
},
val
)
{
// const lotteryInfo = cloneDeep(state.lotteryInfo)
state
.
lotteryInfo
=
{
...
state
.
lotteryInfo
,
...
val
}
commit
(
'SET_LOTTERYINFO'
,
{
...
state
.
lotteryInfo
,
...
val
})
},
}
export
const
getters
=
{
...
...
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