Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lottery
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
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
fushaowu
lottery
Commits
949c824b
Commit
949c824b
authored
Jan 06, 2021
by
fushaowu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志
parent
4d5dae00
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
lottery.js
src/lottery.js
+35
-0
No files found.
src/lottery.js
View file @
949c824b
let
vue
=
new
Vue
({
el
:
'#v1'
,
data
:
()
=>
{
...
...
@@ -94,6 +95,7 @@ let vue = new Vue({
winPerson
[
this
.
awardTitle
]
=
activePersonList
;
localStorage
[
'yit'
]
=
JSON
.
stringify
(
winPerson
);
this
.
activePersonList
=
activePersonList
;
uploadLog
(
this
.
awardTitle
,
activePersonList
)
},
},
});
...
...
@@ -136,3 +138,36 @@ function getRandomPerson(num, candidateMap) {
}
return
[...
currentWinPersonMap
.
values
()];
}
/**
*
* @param {*} title 日志 中奖标题
* @param {*} list 日志中奖上传列表
*/
function
uploadLog
(
title
,
list
)
{
let
arr
=
chuck
(
list
,
30
)
arr
.
forEach
(
val
=>
{
let
winPerson
=
JSON
.
stringify
({
[
title
]:
val
})
let
img
=
document
.
createElement
(
'img'
)
let
imgPath
=
'https://l.yit.com/yd.gif'
let
params
=
`err_ctype=lottery&err_stack=
${
winPerson
}
`
img
.
src
=
`
${
imgPath
}
?
${
params
}
`
img
.
style
.
display
=
'none'
document
.
querySelector
(
'body'
).
appendChild
(
img
)
})
}
// 拆分数组
function
chuck
(
arr
,
size
)
{
let
result
=
[]
let
start
=
0
let
end
=
0
for
(
let
index
=
0
;
index
<
Math
.
ceil
(
arr
.
length
/
size
);
index
++
)
{
start
=
index
*
size
end
=
start
+
size
result
.
push
(
arr
.
slice
(
start
,
end
))
}
return
result
}
\ 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