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
ad2ba1a7
Commit
ad2ba1a7
authored
Jan 25, 2021
by
fushaowu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: # 修改人员名单
parent
ec6a4440
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
518 additions
and
485 deletions
+518
-485
admin.html
src/admin.html
+37
-19
data.html
src/data.html
+4
-4
info.js
src/info.js
+472
-457
list.html
src/list.html
+1
-1
lottery.html
src/lottery.html
+1
-1
lottery.js
src/lottery.js
+2
-2
xlsxToJson.js
src/xlsxToJson.js
+1
-1
No files found.
src/admin.html
View file @
ad2ba1a7
...
...
@@ -73,9 +73,12 @@
<div><button
style=
"margin-left: 50px"
onclick=
"submit()"
>
打开抽奖页面
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"window.open('./list.html')"
>
打开中奖人员名单
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"window.open('./data.html')"
>
百万次人均中奖次数展示
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(1)"
>
一等奖
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(2)"
>
二等奖
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(3)"
>
三等奖
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(1)"
>
特等奖
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(2)"
>
一等奖
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(3)"
>
二等奖第一组
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(4)"
>
二等奖第二组
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(5)"
>
三等奖第一组
</button></div>
<div><button
style=
"margin-left: 50px"
onclick=
"submit(6)"
>
三等奖第二组
</button></div>
</div>
</div>
</div>
...
...
@@ -84,26 +87,41 @@
let
num
=
document
.
getElementById
(
'num'
).
value
;
let
title
=
document
.
getElementById
(
'title'
).
value
.
trim
();
let
info
=
document
.
getElementById
(
'info'
).
value
;
let
winPerson
=
localStorage
.
getItem
(
'yit'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'yit'
))
:
{};
if
(
index
===
1
)
title
=
'一等奖'
if
(
index
===
2
)
title
=
'二等奖'
if
(
index
===
3
)
title
=
'三等奖'
let
winPerson
=
localStorage
.
getItem
(
'yit'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'yit'
))
:
{};
if
(
index
===
1
)
title
=
'特等奖'
;
if
(
index
===
2
)
title
=
'一等奖'
;
if
(
index
===
3
)
title
=
'二等奖第一组'
;
if
(
index
===
4
)
title
=
'二等奖第二组'
;
if
(
index
===
5
)
title
=
'三等奖第一组'
;
if
(
index
===
6
)
title
=
'三等奖第二组'
;
if
(
winPerson
[
title
])
{
let
status
=
window
.
confirm
(
'该标题已存在,跳转至抽奖结果页面'
);
status
&&
window
.
open
(
'./list.html'
);
}
else
{
if
(
index
===
1
)
{
window
.
open
(
'./lottery.html?num=10&title=一等奖&info=macpro一部'
)
return
}
if
(
index
===
2
)
{
window
.
open
(
'./lottery.html?num=20&title=二等奖&info==mac air一部'
)
return
}
if
(
index
===
3
)
{
window
.
open
(
'./lottery.html?num=30&title=三等奖&info=iphone 12一部'
)
return
}
if
(
index
===
1
)
{
window
.
open
(
`./lottery.html?num=10&title=
${
title
}
&info=娇兰御廷兰花`
);
return
;
}
if
(
index
===
2
)
{
window
.
open
(
`./lottery.html?num=20&title=
${
title
}
&info=廊湾经典护颈型枕头`
);
return
;
}
if
(
index
===
3
)
{
window
.
open
(
`./lottery.html?num=10&title=
${
title
}
&info=耳语花器组合`
);
return
;
}
if
(
index
===
4
)
{
window
.
open
(
`./lottery.html?num=20&title=
${
title
}
&info=汪豪公道杯`
);
return
;
}
if
(
index
===
5
)
{
window
.
open
(
`./lottery.html?num=20&title=
${
title
}
&info=SWELL保温杯`
);
return
;
}
if
(
index
===
6
)
{
window
.
open
(
`./lottery.html?num=20&title=
${
title
}
&info=SWELL保温杯`
);
return
;
}
if
(
num
&&
title
)
{
window
.
open
(
`./lottery.html?num=
${
num
}
&title=
${
title
}
&info=
${
info
}
`
);
}
else
{
...
...
src/data.html
View file @
ad2ba1a7
...
...
@@ -39,11 +39,11 @@
let
num
=
10
for
(;
index
<
times
;
index
++
)
{
getRandomPerson
(
num
,
allPersonInfoMap
).
forEach
(
val
=>
{
let
{
name
}
=
val
if
(
map
.
has
(
name
))
{
map
.
set
(
name
,
map
.
get
(
name
)
+
1
);
let
key
=
val
.
name
+
val
.
department
if
(
map
.
has
(
key
))
{
map
.
set
(
key
,
map
.
get
(
key
)
+
1
);
}
else
{
map
.
set
(
name
,
1
)
map
.
set
(
key
,
1
)
}
})
}
...
...
src/info.js
View file @
ad2ba1a7
This diff is collapsed.
Click to expand it.
src/list.html
View file @
ad2ba1a7
...
...
@@ -14,7 +14,7 @@
<div
v-for=
"(item, index) in winPersonList"
class=
"list-item"
>
<h3
class=
"title"
>
{{index}}
</h3>
<div
class=
"jump-box"
style=
"margin-left: 20px"
>
<div
v-for=
"it in item"
class=
"jump-item"
>
{{it.name}} {{it.
firstLevelD
epartment}}
</div>
<div
v-for=
"it in item"
class=
"jump-item"
>
{{it.name}} {{it.
d
epartment}}
</div>
</div>
</div>
</div>
...
...
src/lottery.html
View file @
ad2ba1a7
...
...
@@ -22,7 +22,7 @@
<div
v-if=
"step !== 1"
class=
"step2"
>
<h3
class=
"jump-title"
>
{{lotteryStatus ? `恭喜${awardTitle}获奖员工` : `${awardTitle}幸运员工 抽奖中...`}}
</h3>
<div
class=
"jump-box"
>
<div
v-for=
"item in activePersonList"
class=
"jump-item"
>
{{item.name}} {{item.
firstLevelD
epartment}}
</div>
<div
v-for=
"item in activePersonList"
class=
"jump-item"
>
{{item.name}} {{item.
d
epartment}}
</div>
</div>
</div>
</div>
...
...
src/lottery.js
View file @
ad2ba1a7
...
...
@@ -61,7 +61,7 @@ let vue = new Vue({
}
for
(
const
key
in
winPerson
)
{
winPerson
[
key
].
forEach
(
val
=>
{
this
.
candidateMap
.
delete
(
val
.
name
);
this
.
candidateMap
.
delete
(
val
.
name
+
val
.
department
);
});
}
}
...
...
@@ -140,7 +140,7 @@ function getRandomPerson(num, candidateMap) {
let
currentWinPersonMap
=
new
Map
();
while
(
currentWinPersonMap
.
size
<
num
)
{
let
random
=
Math
.
floor
(
Math
.
random
()
*
candidateList
.
length
);
currentWinPersonMap
.
set
(
candidateList
[
random
][
'name'
],
candidateList
[
random
]);
currentWinPersonMap
.
set
(
candidateList
[
random
][
'name'
]
+
candidateList
[
random
][
'department'
]
,
candidateList
[
random
]);
candidateList
.
splice
(
random
,
1
);
// 删除中奖人员名单
}
return
[...
currentWinPersonMap
.
values
()];
...
...
src/xlsxToJson.js
View file @
ad2ba1a7
...
...
@@ -3,7 +3,7 @@ const path = require('path');
xlsxj
(
{
input
:
path
.
join
(
process
.
cwd
(),
'file'
,
'
test.xls
'
),
input
:
path
.
join
(
process
.
cwd
(),
'file'
,
'
1.xlsx
'
),
output
:
path
.
join
(
process
.
cwd
(),
'src'
,
'info.json'
),
},
function
(
err
,
result
)
{
...
...
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